camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcdewit <>
Subject Custom processor methods not visible in JConsole
Date Thu, 02 Jul 2015 09:34:13 GMT

Part of my camel route consists of a JMS queue, being polled and its
messages being stored in a db, depending on message type. The route is
transacted, and therefore it's not possible to configure redeliveryDelay in
the ActiveMQXAConnectionFactory bean, but i had to use a custom processor
"redeliveryDelay" instead that checks the JMSXDeliveryCount in the header
and introduces a delay depending on the retry count.
I would like to have the possibility to configure/manage this processor and
its methods through jconsole/jmx but am having some problems with it:
- without using the annotations @ManagedResource, @ManagedAttribute i can
see the processor mbean, but cannot see its methods
- with annotations the processor mbean is not visible anymore (even if i
"implement Service" like mentioned in the camel FAQ, or if i implement the
deprecated ManagementAware). I also tried using only @ManagedResource or
@ManagedAttribute separately...
- when moving the processor to the recoverable camel:onException route
(preferable since its only executed when needed) the mbean is not visible at
all; even without annotations.

Any ideas?

regards, Tim

Relevant part of route:

<camel:route id="routeStoreInDB">
	<camel:from uri="jms:queue:incoming?transacted=true" />
	<camel:transacted ref="PROPAGATION_REQUIRED"/>
	<camel:process ref="redeliveryDelay" id="redeliveryDelay"/>
			<camel:spel>#{request.headers['CamelHL7MessageType'] ==
				<camel:bean ref="ADTHandler" method="processADT" />
				<camel:spel>#{request.headers['CamelHL7MessageType'] ==
				<camel:bean ref="ORMHandler" method="processORM" />
			<camel:log message="NOT HANDLED Type:${header.CamelHL7MessageType}
Msg:${body}" />
		<camel:log message="Recoverable error occurred! Will retry in a few
seconds..." loggingLevel="ERROR" logName="routeStoreInDB_ORM"/>
		<camel:rollback markRollbackOnly="true" />
		<camel:log message="Irrecoverable error occurred!" loggingLevel="ERROR"
		<camel:to uri="jms:queue:DLQ" />

Processor code:

import org.apache.camel.Exchange;
import org.apache.camel.Processor;

public class redeliveryDelay implements Processor {
    private long delay = 0;
    public long getDelay() {
        return delay;

    public void setDelay(long delay) {
        this.delay = delay;
    public void process(Exchange exchange) throws Exception {
        String redeliveryCountAsString =
exchange.getIn().getHeader("JMSXDeliveryCount", String.class);
        if(redeliveryCountAsString==null) { redeliveryCountAsString="1"; }
        int redeliveryCount = Integer.parseInt(redeliveryCountAsString);
        switch (redeliveryCount) {
            case  0: this.setDelay(0);             break;
            case  1: 
            case  2: 
            case  3: this.setDelay(5000);          break;   // 3 x 5 seconds
            case  4: this.setDelay(60*1000);       break;   // 1 minute
            case  5: this.setDelay(5*60*1000);     break;   // 5 minutes
            case  6: this.setDelay(30*60*1000);    break;   // 30 minutes
            case  7: this.setDelay(60*60*1000);    break;   // 60 minutes
            default: this.setDelay(8*60*60*1000); break;   // every 8 hours

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message