-
1. Re: How to communicate among multiple camel context using camel osgi?
joe.luo Jul 21, 2009 5:16 AM (in response to jkhan)Here is documentation for Camel VM endpoint to make in memory communication, provided that the camel-core.jar is on the system/boot classpath.
For communication among multiple camel context, you could use any remoting endpoints (i.e. JMS, http, file). However, for direct and seda endpoints, they are local to context only.
-
2. Re: How to communicate among multiple camel context using camel osgi?
jkhan Jul 21, 2009 10:45 AM (in response to joe.luo)As I mentioned earlier that I am using SMX 4.1 which uses OSGi. Are you saying that I need to add camel-core.jar in the system/boot as classpath? I don't think this is good solution per OSGi.
Thanks
Jawed
-
3. Re: How to communicate among multiple camel context using camel osgi?
janstey Jul 21, 2009 1:20 PM (in response to jkhan)No, the classloading is via OSGi so you just need install the camel-core,camel-osgi features via the ServiceMix console and then ensure Camel is imported in your bundles.
If you are planning on having these CamelContexts spread across multiple machines you will need to use the other transports that Joe mentioned.
Cheers,
Jon
-
4. Re: How to communicate among multiple camel context using camel osgi?
jkhan Jul 21, 2009 2:08 PM (in response to janstey)Jon,
So I can use "vm:" to communicate between camel context if I am using same JVM (like single instance SMX4).
Thanks
Jawed
-
5. Re: How to communicate among multiple camel context using camel osgi?
janstey Jul 21, 2009 2:46 PM (in response to jkhan)Yeah, you got it. I imagine its quite a bit faster to do that too since its all in memory.
Cheers,
Jon
-
6. Re: How to communicate among multiple camel context using camel osgi?
oisin Jul 21, 2009 2:46 PM (in response to jkhan)So I can use "vm:" to communicate between camel context if I am using same JVM (like single instance SMX4).
I think vm: only works if you are sharing a classloader, which would mean it won't work in SMX4, where different classloaders are operated for each bundle.
The camel-osgi component may be what you are looking for, it exposes an endpoint as an OSGi service, which means that routes can communicate (note - I haven't tried this).
The camel-nmr component would also work for cross-context communication, but requires the NMR bundle to be deployed in the container and of course it will cause message normalization to happen, which may not be what you want.
-
7. Re: How to communicate among multiple camel context using camel osgi?
janstey Jul 21, 2009 2:53 PM (in response to oisin)I actually just did a test where there was a context created in each of two bundles. VM seems to work fine for me
Jawed, let us know if you run into any issues.
-
8. Re: How to communicate among multiple camel context using camel osgi?
jkhan Jul 21, 2009 7:32 PM (in response to janstey)I also tried and works for me. Attached are the 2 projects(camel-osgi-vm.zip and camel-osgi.zip) that I used from FUSE ESB 4.1.0.2
First camel-osgi bundle contains following route:
from("timer://myTimer?fixedRate=true&period=2000").to("vm:mytransform")..to("log:ExampleRouter");
Second camel-osgi-vm bundle contains following route:
from("vm:mytransform").bean(transform, "transform").to"log:ExampleRouter-vm");
Thank you.
Jawed
-
camel-osgi.zip 6.8 KB
-
camel-osgi-vm.zip 8.0 KB
-
-
9. Re: How to communicate among multiple camel context using camel osgi?
janstey Jul 22, 2009 7:42 AM (in response to jkhan)Glad to hear it works for you. Thanks for sharing your solution.
Cheers,
Jon