<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Using JMS Topic with Jboss Messaging 1.4.2.GA-SP1 seems unreliable.
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/vjbhakta">Vijay Bhakta</a> in <i>JBoss Messaging</i> - <a href="https://community.jboss.org/message/745434#745434">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi,</p><p>Does anyone have experienced this and has a suggestion?<br/>I am using JBoss 4.2.3.GA with JBoss-Messaging 1.4.2.GA-SP1</p><p><br/>In my real application, I have now and then observed a JMS Message not received at one or the other client.<br/>To reproduce and analyze the same, I have made simple program closer to my scenario and focus on JMS.<br/>Let me brief you the scenario:<br/>1. A stateless Bean deployed with a method that generates 100 JMS messages to JMS Topic. Its more frequent when message size is ~1k.<br/>2. An external client 'API-Caller' that invokes the bean and calls the method, once every second for duration of 1-min. I launch typically more than 40 such clients.<br/>3. I stamped each Message with EventNumber, an incremental number to uniquely identify it.<br/>4. A Client 'Event-Listener' which subscribes to the JMS Topic and waits/receives messages. I launch 4 instances of this client on two different systems with 2 on each. Each 'Event-Listener' notes that the EventNumber if JMS Message skips a number.</p><p>I am running JBoss on Windows7 64-bit and Debian-Linux(Squeeze)<br/>And Clients 'API-Caller' and 'Event-Listener' on WindowsXP machine.</p><p>Running this test, I see that some JMS Messages are not received by one or the other client. Also, a Message received by one client is not recieved by other running on same system.</p><p><br/>A code outline of my stateless Bean :--------------------------------------></p><p>public class MyBean<br/>    implements IMyBean<br/>{</p><p>    private static synchronized int getEventNumber ()<br/>    {<br/>        return ++mEventNumber;<br/>    }</p><p><br/>    public int produce100Messages (int PayloadInBytes)<br/>    {<br/>        Connection connection = null;<br/>        Session session = null;<br/>        MessageProducer publisher = null;<br/>        Integer num = 0;</p><p>        String payload = "";<br/>        for(int i=0; i<PayloadInBytes; i++)<br/>        {<br/>            payload += "Z";            <br/>        }<br/>        <br/>        try<br/>        {<br/>            InitialContext ic = new InitialContext();</p><p>            ConnectionFactory cf = (ConnectionFactory) ic.lookup("java:/JmsXA");<br/>            Topic topic = (Topic) ic.lookup("topic/MyTopic");</p><p>            connection = cf.createConnection();<br/>            session = connection.createSession(true, Session.SESSION_TRANSACTED);<br/>            publisher = session.createProducer(topic);</p><p>            connection.start();</p><p>            num = getEventNumber();<br/>            num = num * 100;<br/>            for (int i = 0; i < 100; i++)<br/>            {<br/>                Message msg = session.createTextMessage(num.toString() + ";" + payload);<br/>                <br/>                publisher.send(msg);<br/>                num++;<br/>            }<br/>            num--;<br/>        }<br/>        catch (Exception anException)<br/>        {<br/>            anException.printStackTrace();<br/>        }<br/>        finally<br/>        {<br/>               ...<br/>               //Close producer, session, and connection<br/>            <br/>        }<br/>        return num;<br/>    }<br/>}</p><p><br/>The code outline at subscriber end :-------------------------------------------><br/>public class MYMsgListener<br/>    implements MessageListener<br/>{<br/>   ...</p><p>   public void onMessage (Message anArg0)<br/>    {<br/>     ...<br/>     ...</p><p>            String[] arrStr = ((TextMessage) anArg0).getText().split(";");            </p><p>            Integer eventNumber = Integer.parseInt(arrStr[0]);<br/>            mEventQ.add(eventNumber);<br/>     ...<br/>    }<br/>    ...</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/745434#745434">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Messaging at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>