This content has been marked as final.
Show 6 replies
-
1. Re: about transaction and order
the.finder1 May 7, 2009 7:17 AM (in response to the.finder1)I found several strange problems:
1 €�messages after the 5th one was processed
2 €�there are 2 messages left, one is the 5th -
2. Re: about transaction and order
gaohoward May 7, 2009 7:35 AM (in response to the.finder1)Hi, some of the characters are not readable. Can you re-format?
Also please state the version of the JBM, and how you send the messages. Thanks. -
3. Re: about transaction and order
the.finder1 May 7, 2009 9:15 PM (in response to the.finder1)I found several strange problems:
1 messages after the 5th one was processed
2 there are 2 messages left, one is the 5th
My version is jboss-messaging-1.4.2.GA-SP1。 -
4. Re: about transaction and order
the.finder1 May 7, 2009 9:31 PM (in response to the.finder1)In my case, I need to process message by order, so I create a Session Bean (Processor) to do that, the code is like following:
@TransactionAttribute(TransactionAttributeType.REQUIRED) public boolean process() throws BusinessException { try { Message message = poll(); if (message != null) { handle(message); return true; } } catch (Exception e) { logger.error("error", e); throw new BusinessException(e); } return false; }
in the function poll(), I just create a MessageConsumer and call receive().
In another job, call this session bean like this:processor.open(); try { while (processor.process()) ; } finally { processor.close(); }
and in open() function, i create connection and session, and in close() function i close them.
In my test, first put 10 messages into the queue, and the 5th will throw a exception in process.
I found strange problems:
1. messages after the 5th one was processed, i.e. some of 6, 7, 8, 9, 10 was processed
2. there are 2 messages left, one is the 5th, another is any of 6, 7, 8, 9, 10
How to explain these?
And how to receive 1, 2, 3, 4, and then blocked.
My version jboss-messaging-1.4.2.GA-SP1.
The following is the code to send message:Connection connection = factory.createConnection(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer pub = session.createProducer(topic); ObjectMessage msg = session.createObjectMessage(); msg.setObject(cmd); pub.send(msg); pub.close(); session.close(); connection.close();
-
5. Re: about transaction and order
the.finder1 May 10, 2009 10:54 PM (in response to the.finder1)Anybody can help me?
Or I must be waiting for the next GA version to solve this problem? -
6. Re: about transaction and order
gaohoward May 11, 2009 12:56 PM (in response to the.finder1)I think you probably need this:
https://jira.jboss.org/jira/browse/JBMESSAGING-1416