I have several bundles (A, B, and C) deployed to an OSGi container, each containing a CamelContext
and some routes. I have another bundle (M) with a CamelCont
I dont think this is possible using InterceptorStrategy
since that expects it is running in the same camel context. The only ways I am aware of working across multiple contexts is using the VM endpoint (which is obviously limited to the same JVM), however in this case you would probably be better utilising JMS, JMX or something similar.
JMS
Create an InterceptorStrategy
for each camel context in A, B & C
that publishes your messages to M
intercept().bean(transformForMonitoring).to("jms:queue:monitoring");
from("whatever:endpoint")
.process(myProcessor)
.to("target:endpoint");
You could also use the vm
component on the intercept()
if you dont want the overhead of JMS, however this limits your monitoring component to a single JVM.
JMX
This is a bit more complicated, but the basic idea is to tell the camel context to publish MBeans for A, B & C
...
and then have M
connect to the JVM MBean Server and utilise something like NotificationListener to react to the Exchanges.