java - Camel in OSGi Container: Apply InterceptStrategy to all camel contexts -


i have several bundles (a, b, , c) deployed osgi container, each containing camelcontext , routes. have bundle (m) camelcontext route (for collecting monitoring data) , interceptstrategy bean. interceptstrategy bean m automatically apply of other camelcontexts in container (i.e., in a, b, , c), without having modify other bundles.

ultimately, goal wiretap data each camelcontext route in m, without having make changes a, b, or c explicitly route exchange. approach or similar approach doable?

all of camelcontexts configured using spring xml.


update: additional context

bundles a, b, , c contain core product responsible processing data. bundle m contains optional monitoring tool, designed measure parameters of data flowing through a, b, , c. currently, adding on optional tool requires changing routes in a, b, , c add additional processors enrich exchange monitoring data , read monitoring data prior <to /> endpoints.

the goal able drop in bundle m verified-as-working system a, b, , c; , have automatically apply existing routes without having modify configuration existing-and-working bundles. is acceptable make modifications a, b, , c support this, long changes not cause a, b, , c rely on m run (i.e., abc must still run without m).

if there better means using interceptors, open that. primary goals are:

  1. keep a, b, , c decoupled m (particularly during development)
  2. ensure integrating m a, b, , c easy possible
  3. allow m integrated without having manually change a, b, or c

i dont think possible using interceptorstrategy since expects running in same camel context. ways aware of working across multiple contexts using vm endpoint (which limited same jvm), in case better utilising jms, jmx or similar.

jms

create interceptorstrategy each camel context in a, b & c publishes messages m

intercept().bean(transformformonitoring).to("jms:queue:monitoring");  from("whatever:endpoint")     .process(myprocessor)     .to("target:endpoint"); 

you use vm component on intercept() if dont want overhead of jms, limits monitoring component single jvm.

jmx

this bit more complicated, basic idea tell camel context publish mbeans a, b & c

<camelcontext id="camel" xmlns="http://camel.apache.org/schema/spring">   <jmxagent id="agent" mbeanobjectdomainname="your.domain.name"/>     ... </camelcontext> 

and have m connect jvm mbean server , utilise notificationlistener react exchanges.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -