Hi See this FAQ http://camel.apache.org/faq.html http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
On Tue, Jul 12, 2011 at 6:04 PM, shostelet <[email protected]> wrote: > Hi, > > I'm currently working on a ActiveMQ/Camel server using Stomp protocol, in > order to receive data, crunch them in some API, and give the result back on > a "response" ActiveMQ queue. > > I'm configuring the whole thing thanks to spring XML, as the first and last > time i've coded some java was at university :) > > The idea is to receieve a message from activemq:query, send the message to > my localhost api, and then send the result on a dedicated response queue, > identified by user's session ID, so i'm quite sure he's the only one who > might get the result. But I'm having problems configuring this last part, > despite many, many readings. > > I got ActiveMQ 5.5.0, and my camel.xml conf looks like : > > <route id="routeApi" inheritErrorHandler="true" autoStartup="true" > xmlns:ns2="http://camel.apache.org/schema/web"> > <from uri="activemq:query" /> > > <setBody id="setBody" inheritErrorHandler="true"> > <simple>name=${body}</simple> > </setBody> > > <setHeader id="setHeader-Method-Post" headerName="CamelHttpMethod" > inheritErrorHandler="true"> > <constant>POST</constant> > </setHeader> > > <setHeader id="setHeader-ContentType" headerName="Content-Type" > inheritErrorHandler="true"> > <constant>application/x-www-form-urlencoded;</constant> > </setHeader> > > <to uri="http://localapi/" id="toApi" /> > > <to uri="activemq:response/SESSION_ID" /> > </route> > > This is the last line that is a problem. I wanted to just type > uri="activemq:response/${header.sessionID}", with this data being part of > the original query message, but it doesnt work. > I tried to setup properties thanks to readings : > - chapter 6 of "Camel in action" > - this post > http://cmoulliard.blogspot.com/2009/05/trick-to-pass-uri-declared-in-property.html > some errors occurs : > > nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: > Invalid content was found starting with element 'property'. One of > '{"http://www.springframework.org/schema/beans":description, > "http://www.springframework.org/schema/beans":meta, > "http://www.springframework.org/schema/beans":bean, > "http://www.springframework.org/schema/beans":ref, > "http://www.springframework.org/schema/beans":idref, > "http://www.springframework.org/schema/beans":value, > "http://www.springframework.org/schema/beans":null, > "http://www.springframework.org/schema/beans":array, > "http://www.springframework.org/schema/beans":list, > "http://www.springframework.org/schema/beans":set, > "http://www.springframework.org/schema/beans":map, > "http://www.springframework.org/schema/beans":props, > WC[##other:"http://www.springframework.org/schema/beans"]}' is expected. > > Maybe a version issue ? > - and some more, but either i got error, or it wasnt dynamic in the end... > > I'm kind of stuck, but I can't imagine such a trivial thing is not > possible... > > I've bought myself "ActiveMQ in action" and "Camel in Action", read a lot of > posts, but nothing did the trick so far. > > I hope someone will be able to help me on that one. > Thank you, > Simon > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Make-camek-route-to-variable-queue-depending-on-some-activeMQ-message-s-header-value-tp4579413p4579413.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
