[prev in list] [next in list] [prev in thread] [next in thread] 

List:       activemq-dev
Subject:    Correlation Ack with original Request
From:       akhettar <ayache.khettar () gmail ! com>
Date:       2016-02-17 10:58:52
Message-ID: 1455706732318-4707652.post () n4 ! nabble ! com
[Download RAW message or body]

Hi 

I have already posted this on user forum but didn't attract any attention, I
am hoping it will here. 

I have written a plugin (public final class MessageAuditorPlugin extends
BrokerPluginSupport). I audit the incoming message before sending to a queue
(override the send() method) and I have also overridden the acknowledge()
method - see code snippet below. The client is set to Auto Acknowledgement
mode. So as soon as the client consume the response and acknowledgement is
automatically sent to the broker and get's picked in the override method
below acknowledge(ConsumerBrokerExchange consumerExchange, final MessageAck
ack). 

I am looking for a way of correlating the original request to the
acknowledgement. Bear in mind the MessageAck doesn't contain a direct
correlation Id to the original request. However, It does have MessageId
which is slightly different to that of the original Request - see below
pattern. I could use the below pattern to correlate request and
acknowledgement but not sure if this is the best way? 

Note the client is sending message to  IN-Queue to the broker and there is a
consumer  consuming response in OUT-Queue.

Any direction is really appreciated. 

Thanks 

Ayache 

Message Id pattern

First Request:

Request MessageId: ID:akhettar-58632-1455191246966-5:11:-1:1:1 
Acknowledgement MessageId: ID:akhettar-58632-1455191246966-5:11:-1:1 

Second Request:
Request MessageId: ID:akhettar-58632-1455191246966-5:11:-1:1:2 
Acknowledgement MessageId: ID:akhettar-58632-1455191246966-5:11:-1:2 

Code Snippet

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

    @Override 
    public void send(final ProducerBrokerExchange producerExchange, final
Message message) throws Exception { 
        // audit the message 
        super.send(producerExchange, message); 
    } 


    @Override 
    public void acknowledge(final ConsumerBrokerExchange consumerExchange,
final MessageAck ack) throws Exception { 
        // handle acknowledgment 
        
        getNext().acknowledge(consumerExchange, ack); 
    } 

}



--
View this message in context: \
http://activemq.2283324.n4.nabble.com/Correlation-Ack-with-original-Request-tp4707652.html
 Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic