10 Replies Latest reply: May 4, 2012 12:34 PM by Clebert Suconic RSS

MDB with message selector only processes 2 messages at a time

seacuke23 Newbie

I have a HornetQ queue and I've put 100 messages on it each with a 'name' property set to either F1, F2, F3, F4 or F5...evenly distributed...20 each.  I've set up an MDB and added a message selector.

 

 

        <activation-config-property>
          <activation-config-property-name>messageSelector</activation-config-property-name>
          <activation-config-property-value>name = 'F1'</activation-config-property-value>
        </activation-config-property>

 

 

I wanted to confirm that I would be able to control the number of MDBs I get when selecting messages so I just put a 5 second sleep in the onMessage.

 

 

    public void onMessage(Message message) {
        TextMessage msg = null;
        try {
            if (message instanceof TextMessage) {
                msg = (TextMessage) message;
                System.out.println("Received Message: " + msg.getText());
            } else {
                System.out.println("Message of wrong type: "  + message.getClass().getName());
            }
        } catch (JMSException e) {
            throw new RuntimeException(e);
        }
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

 

 

It doesn't seem to matter what I do...whether it's setting maxSession to 100, increasing all my AS thread pools to 500, I only get a max of 2 messages at a time. 

 

10:29:06,098 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-227391438)) Received Message: This is message 1
10:29:06,099 INFO  [stdout] (Thread-2 (HornetQ-client-global-threads-227391438)) Received Message: This is message 1
10:29:11,102 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-227391438)) Received Message: This is message 1
10:29:11,104 INFO  [stdout] (Thread-2 (HornetQ-client-global-threads-227391438)) Received Message: This is message 1
10:29:16,108 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-227391438)) Received Message: This is message 1
10:29:16,110 INFO  [stdout] (Thread-2 (HornetQ-client-global-threads-227391438)) Received Message: This is message 1
10:29:21,113 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-227391438)) Received Message: This is message 1
10:29:21,115 INFO  [stdout] (Thread-2 (HornetQ-client-global-threads-227391438)) Received Message: This is message 1

 

 

However, when I remove the selector altogether, I get every single message...which is why I'm posting in the HornetQ forum.  When I set maxSession to 1 it only processes 1 at a time, but when I set maxSession to anything over 2 it gets 2 at a time.  Is there something I'm missing?

 

Here's the version printout on server startup:

 

10:28:51,807 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-13) HornetQ Server version 2.2.13.Final (HQ_2_2_13_FINAL_AS7, 122) [1930ddca-8d6d-11e1-bdd4-2c41389967d9]) started