Friday, 15 June 2012

java - JMS and "transactional messages" -



java - JMS and "transactional messages" -

i'm new jms , appreciate help.

everything read jms gives me impression object "holds transaction" session object, meaning when "session.commit()", has happened since lastly commit settled.

my question regards, how handle patter want "transact messages", not session. imagine want receive big number of trades in concurrent scenario, , upon receiving individual message , processing you'd "message.commit()". how can implement scenario ? have maintain creating queuesessions every message wanted dequeue ? isn't there much overhead ?

thanks in advance

it correct, jms session object responsible managing transactions. session.commit() phone call commits messages received/sent in session. session.rollback() rolls messages in session.

for requirement can utilize non-transacted session client_acknowledge option. like:

createsession(false, session.client_acknowledge);

a client_acknowledge session let's message.acknowledge tells messaging provider remove message queue/topic.

but have maintain in mind implementation of message.acknowledge implementation dependent. messaging providers allow per message acknowledge others acknowledge messages. in per message acknowledge, message on acknowledge called, removed messaging provider. other messages received , not acknowledged not removed. in 'acknowledge all' type of implementation, calling acknowledge on 1 message acknowledge messages received before. same doing session.commit in transacted session.

java jms

No comments:

Post a Comment