Might be a bit tricky: maybe you could declare the context in one bundle, 
register it as an osgi service, and then pull it in to the routes in your other 
bundles. 

Another approach I've used in the past is to provide an osgi service for each 
route, which uses the producerTemplate to kick off thje route when another 
bundle invokes on the service. 

Alternatively, just use JMS with optimized vm transport to communicate in 
between the bunldles. 

Hope that helps,
Ade

----- Original Message -----
From: TheWinch <[email protected]>
To: [email protected] <[email protected]>
Sent: Tue Dec 22 04:08:02 2009
Subject: Sharing a CamelContext across several bundles


Hi everyone,

Do you know if it is possible to share a single CamelContext across several
bundles ? What I'de like to do is to have several bundles contribute to a
same CamelContext. Example in pseudo code:

From bundle A: define a context
<camel:camelContext>
  <!-- maybe some routes here -->
</camel:camelContext>

From bundle B: contribute some routes
<!-- this one should be retrieved from OSGi in some manner -->
<camel:camelContext>
  <route>
  <from uri="seda:a_queue"/>
  <to uri="seda:another_queue"/>
</camel:camelContext>

From bundle C:
<!-- this one should be retrieved from OSGi in some manner -->
<bean id="mybean" class="..."/>
<camel:camelContext>
  <route>
  <!-- this one is also referenced in bundle B -->
  <from uri="seda:another_queue"/>
  <to uri="bean:mybean"/>
</camel:camelContext>

-- 
View this message in context: 
http://old.nabble.com/Sharing-a-CamelContext-across-several-bundles-tp26885528p26885528.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to