On Tue, Jul 7, 2009 at 6:14 AM, Carlo Camerino<car...@sxchange.com.ph> wrote: > Hi, > > I was just wondering on what is the best way to approach this. I have two > applications. One is a web application and another one is an application > running a camel context. > Given this, I want my web application to commuinicate to the camel context > which is running in a separate JVM on the same server. Hi
To pass messages between JVMs you need protocols that support this, such as the http or jms based. > > What is the best way to place a message on that context? I do not think there is one way that is better than the other. It depends on many factors. Maybe you already have a JMS messaging infrastructure you can use. But webservices is also a good solution as you can easily setup a service for it and its easy for clients to communicate with it. If you just need to pass a simple message then you can use easier protocols such as plain HTTP. Camel have the jetty component that can expose a plain http service. Then you can send to it using regular HTTP POST. > > Will I use CXF directly? Yeah that is also a solution. I > > I don't have a camel context running in my web application. Can i have a > producertemplate without a camel context? Yes Camel can easily be used as a client only. You do not need to declare any routes on the client side. All what is needed is 2 lines of code to setup the template CamelContext context = new DefaultCamelContext(); ProducerTemplate template = context.createNewProducerTemplate(); // then reuse this template to send to the remote JVM > > i've taught of two appraoches that I could use > > one is to use cxf to place a web service call on the other context and the > other one is to use JMS.... JMS is a bit overkill if you do not already have a JMS infrastructure. Its afterall a new server you need to setup and run. Althought a broker such as ActiveMQ can be embedded in any JVM. > > What's the best approach with regards to this kind of situation? > > Thanks > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus