Nader
Nader

Reputation: 31

Intercept ActiveMQ message with Camel

I need to register the time a message leaves ActiveMQs queue. I have Q1 and the consumer is a java application on Jboss server through activemq-ra.rar.

Is it possible to do that with Camel (included in ActiveMQ) interceptor? I am not programmer, so solution in XML DSL will be perfect.

Any help would be appreciated. thanx.

Upvotes: 1

Views: 150

Answers (2)

Nader
Nader

Reputation: 31

Using advisoryForConsumed and forwarding the advisory messages to a queue solved the problem for me.

In activemq.xml:

<destinationPolicy>
    <policyMap>
        <policyEntries>
            <policyEntry queue="Q1" advisoryForConsumed="true"/>
        </policyEntries>
    </policyMap>
</destinationPolicy>

then forwarding ActiveMQ.Advisory.MessageConsumed.Queue.Q1 to another queue, AvisoryConsumed.

<destinationInterceptors> 
    <virtualDestinationInterceptor> 
        <virtualDestinations> 
            <compositeTopic name="ActiveMQ.Advisory.MessageConsumed.Queue.Q1" >
                <forwardTo><queue physicalName="AvisoryConsumed" /> </forwardTo>
        </compositeTopic>
    </virtualDestinations>
</virtualDestinationInterceptor>

then when a message is consumed, there will be a message with brokerOutTime in AvisoryConsumed and the original message's properties.

Upvotes: 1

Matt Pavlovich
Matt Pavlovich

Reputation: 4306

Look into the logging broker plugin. It can output the information to a log, which you can then use to build your metric.

ref: Logging Broker Plugin

Upvotes: 0

Related Questions