-
1. Re: Proper way to commit / rollback using MessageListener
timfox Apr 9, 2010 5:35 AM (in response to timowe1980)Session.commit() or Session.rollback()
Same with core and JMS.
Assuming you're talking abvout JMS here.
Take a look at the Sun JMS Javadoc , JMS spec, or JMS tutorial for more info.
-
2. Re: Proper way to commit / rollback using MessageListener
leosbitto Apr 9, 2010 8:23 AM (in response to timowe1980)Timo Westkamper wrote:
With a transactional session what is the proper way to commit / rollback the session in MessageListener.onMessage, or is it done automatically?
Optionally you can use Connection.createSession(false, Session.CLIENT_ACKNOWLEDGE) and then call Message.acknowledge() in your MessageListener.onMessage code when you are done. This way when anything goes wrong, it is up to the JMS provider to redeliver the Message again in the future - I don't know how HornetQ behaves in this situation, though.
-
3. Re: Proper way to commit / rollback using MessageListener
leosbitto Apr 9, 2010 11:19 AM (in response to leosbitto)There is one major difference between the fully transactional JMS sessions and those created with the CLIENT_ACKNOWLEDGE option: with the fully transactional JMS sessions the messages sent by MessageProducers created by the same Session are in the transaction, too. As Tim suggested, study the JMS documentation, there is plenty of information available on the internet...