AMQ transaction rollback and commit

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

AMQ transaction rollback and commit


I have written AMQ plugin - see bellow a snippet. I am overriding the send and messageConsumed methods. Whenever a message is consumed the client will either send a commit for successfully downloading the message or rollback when it is failed. The messageConsumed gets invoked for either cases and for each case there is some logic needs to be run. Is there a way of finding out from the context or MessageReference weither the client has commited the transation or rolled back?



 * Message AuditWriter Interceptor. It audits message into Cassandra datastore.
public final class MessageAuditorPlugin extends BrokerPluginSupport {

   private AuditWriter auditor;

    public void send(final ProducerBrokerExchange producerExchange, final Message message) throws Exception {
      //some logic....
     // call super
      super.send(producerExchange, message);

    public void messageConsumed(final ConnectionContext context, final MessageReference messageReference)  {
       // some logic....

        getNext().messageConsumed(context, messageReference);