[jboss-user] [JBoss Messaging] - Using JMS Topic with Jboss Messaging 1.4.2.GA-SP1 seems unreliable.

Vijay Bhakta do-not-reply at jboss.com
Mon Jul 2 08:32:55 EDT 2012


Vijay Bhakta [https://community.jboss.org/people/vjbhakta] created the discussion

"Using JMS Topic with Jboss Messaging 1.4.2.GA-SP1 seems unreliable."

To view the discussion, visit: https://community.jboss.org/message/745434#745434

--------------------------------------------------------------
Hi,
Does anyone have experienced this and has a suggestion?
I am using JBoss 4.2.3.GA with JBoss-Messaging 1.4.2.GA-SP1

In my real application, I have now and then observed a JMS Message not received at one or the other client.
To reproduce and analyze the same, I have made simple program closer to my scenario and focus on JMS.
Let me brief you the scenario:
1. A stateless Bean deployed with a method that generates 100 JMS messages to JMS Topic. Its more frequent when message size is ~1k.
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.
3. I stamped each Message with EventNumber, an incremental number to uniquely identify it.
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.
I am running JBoss on Windows7 64-bit and Debian-Linux(Squeeze)
And Clients 'API-Caller' and 'Event-Listener' on WindowsXP machine.
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.

A code outline of my stateless Bean :-------------------------------------->
public class MyBean
    implements IMyBean
{
    private static synchronized int getEventNumber ()
    {
        return ++mEventNumber;
    }

    public int produce100Messages (int PayloadInBytes)
    {
        Connection connection = null;
        Session session = null;
        MessageProducer publisher = null;
        Integer num = 0;
        String payload = "";
        for(int i=0; i<PayloadInBytes; i++)
        {
            payload += "Z";            
        }
        
        try
        {
            InitialContext ic = new InitialContext();
            ConnectionFactory cf = (ConnectionFactory) ic.lookup("java:/JmsXA");
            Topic topic = (Topic) ic.lookup("topic/MyTopic");
            connection = cf.createConnection();
            session = connection.createSession(true, Session.SESSION_TRANSACTED);
            publisher = session.createProducer(topic);
            connection.start();
            num = getEventNumber();
            num = num * 100;
            for (int i = 0; i < 100; i++)
            {
                Message msg = session.createTextMessage(num.toString() + ";" + payload);
                
                publisher.send(msg);
                num++;
            }
            num--;
        }
        catch (Exception anException)
        {
            anException.printStackTrace();
        }
        finally
        {
               ...
               //Close producer, session, and connection
            
        }
        return num;
    }
}

The code outline at subscriber end :------------------------------------------->
public class MYMsgListener
    implements MessageListener
{
   ...
   public void onMessage (Message anArg0)
    {
     ...
     ...
            String[] arrStr = ((TextMessage) anArg0).getText().split(";");            
            Integer eventNumber = Integer.parseInt(arrStr[0]);
            mEventQ.add(eventNumber);
     ...
    }
    ...
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/745434#745434]

Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120702/9107c10d/attachment-0001.html 


More information about the jboss-user mailing list