2008/9/29 ee7arh <[EMAIL PROTECTED]>: > > Hi Willem, > > Thanks for your answer. > > I've actually solved the issue now using Spring Remoting but will explain in > more detail my original dilema since it took us a lot of hardwork and > searching to "stumble upon" the solution ;) > > Perhaps I should first clarify that what I was trying to achieve was to > replace RMI with Camel [using JMS underneath] within my application. I had a > multi threaded client application one 1 side which sent requests to an RMI > server application on the other side. Standard client/server stuff, sort of > like a WebServer where requests are in effect able to be processed by the > server in parallel (although each request is atomic). > > So instead of starting up an RMI server, I replaced this with Camel. My > routes were configured something like this: > > from("jms:queue:myqueue").to("bean:requestProcessor?methodName=processRequest"); > > In my former RMI "Impl" class which actually did the service processing on > the server side, instead of extending UnicastRemoteObject, I now just added > the following annotation at the top of the class: > > @Service(value = "requestProcessor") > > And within that class I had a method called "processRequest()". > > The behaviour I wanted was that whenever a client thread wanted the server > to process a service request, it would use the ExchangePattern.InOut when > calling sendBody() like so: > > myResponseObject = (MyResponse)camelTemplate.sendBody("jms:queue:myqueue", > ExchangePattern.InOut, myReqObject); > > This seemed to work fine but I noticed that the server would process only 1 > client request at a time. I guess this is because there is actually only a > single consumer on the server side reading off the underlying JMS queue.
Yeah - you can enable more concurrent processing of the requests by configuring your JMS component - or via the URI See http://activemq.apache.org/camel/jms.html e.g. from("jms:queue:myqueue?concurrentConsumers=50").to("bean:requestProcessor?methodName=processRequest"); > To acheive true Request/Response, I have turned to "Spring Remoting" to get > this working (which it now does having followed the examples provided - link > below [2] ). > > Do you think this is the right strategy in the end or was there something I > missed along the way which would I mean I can use pure Camel? > > [2] http://activemq.apache.org/camel/spring-remoting.html Spring Remoting is really just a POJO facade above the pure Camel underneath; so everything you can do with Spring Remoting should work with pure Camel too. Though I favour hiding all middleware code where possible... http://activemq.apache.org/camel/hiding-middleware.html so using Spring Remoting is a good thing IMHO as it hides both the JMS and Camel APIs from your business logic etc. -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://open.iona.com