[jboss-user] [JBoss Messaging] - Re: Can only send one message in XA transaction

orankelly do-not-reply at jboss.com
Mon Nov 24 07:30:29 EST 2008


"gaohoward" wrote : Can you also give the client code that consume the messages here? It may help to find the problem.

Sure, though it's very simple stuff:

  | public class SimpleListener implements javax.jms.MessageListener {
  |     private static final Logger LOG = LoggerFactory.getLogger(SimpleListener.class);
  |     
  |     public void onMessage(Message message) {
  |         try {
  |             if (message instanceof TextMessage) {
  |                 LOG.info("TextMessage received: {}", ((TextMessage) message).getText());
  |             } else {
  |                 LOG.info("{} received: {}", message.getClass().getSimpleName(), message);
  |             }
  |         } catch (Exception x) {
  |             LOG.error("", x);
  |         }
  |     }
  | }
  | 

The output to my logs after invoking the sender code seen in earlier posts:

  | 2008-11-24 12:19:29,828 INFO  [com.pbm.sms.event.SimpleListener] (WorkManager(2)-36) TextMessage received: Message 1
  | 


This is tied in to the topic using Spring's DefaultMessageListenerContainer (referencing the java:/JmsXA connection factory and JTA transaction manager). After posting this I will go away and write a plain MDB in order to further remove Spring from the equation but I'm not expecting much of a change in behaviour (famous last words...).


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4191726



More information about the jboss-user mailing list