"timfox" wrote : 
  | So you're creating a set of message listeners on the same session, and 
you're saying this gives you the aforementioned problem?
  | 
  | What are you doing in your message listeners? Are you accessing the session 
at all?

No sorry. I've got that wrong.

We're using a single thread to create a set of sessions. Each session has a 
single consumer (not multiple consumers per session as I stated earlier). Each 
consumer is configured with a message listener.

Previously our test was using a single thread to create 5 sessions, with one 
consumer/listener per session. This was causing frequent IllegalStateExceptions.

When I reconfigured the test to only create one session, with one 
consumer/listener the problem appears to go away.

The message listener used by each consumer is actually a singleton that simply 
stores the received payload so we can compare it with what was sent at the end 
of the test:


  |     public void onMessage(Message message) {
  |         // extract payload and received queue name and pass to test 
coordinator
  |         // for processing
  |         try {
  |             String queueName = ((Queue) message.getJMSDestination())
  |                     .getQueueName();
  |             Object payload = null;
  |             if (message instanceof TextMessage) {
  |                 payload = ((TextMessage) message).getText();
  |             } else if (message instanceof ObjectMessage) {
  |                 payload = ((ObjectMessage) message).getObject();
  |             } else {
  |                 throw new RuntimeException(
  |                         "Received unexpected JMS message type: "
  |                                 + message.getClass());
  |             }
  |             getMessageStore().store(queueName, payload);
  |         } catch (Exception ex) {
  |             throw new RuntimeException(//
  |                     "Failed to process received message", ex);
  |         }
  |     }
  | 

 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016800#4016800

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016800
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to