Question

I am stuck in following scenario with blend of apache camel, cxf web service and osgi bundle in apache servicemix.

Scenario:

I have a spring web application (wa1) deployed in tomcat. On same machine, I have servicemix running. In servicemix, I have already deployed rest web service(ws1) using apache cxf in servicemix, one more bundle(b1) is deployed also.

Now, what I want is hit web service(ws1) from spring web application(with append parameter in URL) , after getting request at web service(ws1), get parameter from URL and send it to another bundle(i.e b1).

what I have done so far is : implemented web service, bundle and deployed both. I am getting parameter with URL each an every thing.

Now, my query is how to send parameter from web service to bundle. For this purpose, I thought apache camel is best candidate. So, I need some guidance which component should I use of apache camel.

eg:    from("ws1 with parameter").to("send this parameters to bundle(b1)").

How to implement this, what component, endpoint should I use? Please help me. And also , Is this right approach that I am following???

Was it helpful?

Solution

As you have already noticed, you should pick appropriate component to make work done :). In your scenario (same virtual machine - Servicemix and OSGi bundles) I'd like to recommend using Direct VM. Camel's Documentation explains it quite clearly:

This component allows also to connect routes deployed in different OSGI Bundles as you can see here after. Even if they are running in different bundles, the camel routes will use the same thread

You will find example in documentation as well.

Direct VM component is rather primitive (so quite fast as well), so you might need more advanced way of communication between bundles in future. A lot of people uses JMS for example. Any way, Direct VM makes it a day in many situations :).

Robert

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top