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.
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.
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...