Why is my processor not showing up in JConsole
Not every processor is managed and thus not all is visible in the JConsole.
A processor must implement the org.apache.camel.Service to be managed. Most EIP processors does this.
For example the minor ones such as setHeader does not and thus is not visible in JConsole.
From Camel 2.6 onwards your custom Processor should use the Spring JMX annotations (for Camel 2.9 onwards see the tip box below). Just add @ManagedResource to the class, and the other annotations for the attributes and operations. Then Camel will automatic use those when the processor is being registered in JMX.
@ManagedResource(description = "My Managed Component")
public static class MyCustomProcessor implements Processor {
private String foo = "hey";
@ManagedAttribute
public String getFoo() {
return foo;
}
@ManagedAttribute
public void setFoo(String foo) {
this.foo = foo;
}
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader("foo", getFoo());
}
}
The same applies when using beans in your routes.
@ManagedResource(description = "My Managed Bean")
public static class MyCustomBean {
private String foo = "hey";
@ManagedAttribute
public String getFoo() {
return foo;
}
@ManagedAttribute
public void setFoo(String foo) {
this.foo = foo;
}
public String doSomething(String body, @Headers Map<Object, Object> headers) throws Exception {
headers.put("foo", foo);
return "Hello " + body;
}
}
 | Camel 2.9 onwards provides Camel's own JMX annotations Notice that from Camel 2.9 onwards its encouraged to use the @ManagedResource, @ManagedAttribute and @ManagedOperation from the org.apache.camel.api.management package. This allows your custom code to not depend on Spring JARs anymore. |
See also