java - MQ Message rollback -
i'm trying read messages mq queue in java , i'm little confused flow when comes time roll when handling exceptions.
i have reader class runs in loop , message. when initialize reader, creates connection , session. when comes time read message in loop, creates mqqueue
, mqqueuereceiver
. works fine , jmsmessage out of queue, handed thread work. if worker thread fails, want put message onto queue (so gets retried other nodes in cluster).
my question is, how roll back? noticed there's rollback()
method in mqqueuesession
class. i'm reusing same session messages. understand new session should created each message instead of reusing same 1 on , over?
this counter intuitive me.
also session created connection.createqueuesession(false, session.client_acknowledge);
. should use flag, other client_acknowledge
?
you should use session.session_transacted flag , session.commit/sessiuon.rollback commit/rollback messages done in current transaction
Comments
Post a Comment