On Tue, Feb 9, 2010 at 12:02 PM, Mond Ray Mond <[email protected]> wrote: > > Thanks Claus > > I will look into that. > > To be honest I wanted to avoid coding at the JMS level if possible. I am > also trying out the use of Annotations to have the Property or Headers > injected automagically - is that possible? >
Try getting the simplest things working first. Then later you can migrate to using a bean with annotations etc. Btw those tqsMessages are they objects or just some constant keys. I assume its objects. You can use a scriping language such as juel, mvel, ognl, groovy etc. and do that in the route builder as they can invoke methods on objects in a path like structure. http://camel.apache.org/languages.html But again often 5 lines of Java code is easier than to battle with these sort of thing. > Best regards > > Ray > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Just use a Processor then you can access the IN Message on Exchange >> and get the jtsMessage and then set the headers. >> http://camel.apache.org/processor >> >> >> >> >> On Mon, Feb 8, 2010 at 3:34 PM, McDermott Raymond >> <[email protected]> wrote: >>> >>> I am new to Camel and am trying to convert a hand-coded bridging router >>> into >>> the Camel equivalent because - well, we have seen the light ;-) >>> >>> The router uses a converter and then and exchange pattern. All working >>> nicely. >>> >>> My next task is to inject some headers to assist the consuming clients to >>> pick the correct messages from the queue. >>> >>> My trouble is that I cannot quite my head around the method needed to >>> obtain >>> the data from the object that has the content body: >>> >>> This is my code with a comment showing where the magic is needed: >>> >>> package com.toyota.tme.integration.routes; >>> >>> import com.thoughtworks.xstream.XStream; >>> import com.toyota.tme.integration.domain.TqsMessage; >>> import org.apache.camel.builder.RouteBuilder; >>> import org.apache.camel.dataformat.xstream.XStreamDataFormat; >>> >>> public class RouteFromTQSToApp extends RouteBuilder { >>> �...@override >>> public void configure() throws Exception { >>> XStreamDataFormat xStreamDataFormat = new XStreamDataFormat(); >>> xStreamDataFormat.setXStream(new XStream()); >>> >>> from("mqseries:AMQD1") >>> .convertBodyTo(TqsMessage.class) >>> // Magic needed here... how do I reference the anonymous 'tqsMessage' >>> object? >>> .setOutHeader(TqsMessage.TQS_META_DATA, tqsMessage.tqsHeader) >>> .setOutHeader(TqsMessage.TQS_APPLICATION_ID, >>> tqsMessage.applicationIdentification.applicationId) >>> .setOutHeader(TqsMessage.TQS_APPLICATION_GROUP_ID, >>> tqsMessage.applicationIdentification.applicationGroupId) >>> // No further need of wizadry (at least not by me!) >>> .inOut() >>> .to("activeq:activemq.tqsBridge.FromTqs") >>> .marshal(xStreamDataFormat); >>> } >>> } >>> >>> I guess it has something to do with beanbinding but I just can't grok how >>> to >>> activate it in this use case! >>> >>> Any help will be greatly appreciated. >>> >>> Thanks >>> >>> Ray >>> -- >>> View this message in context: >>> http://old.nabble.com/obtaining-message-header-properties-from-message-body-tp27500730p27500730.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: > http://old.nabble.com/obtaining-message-header-properties-from-message-body-tp27500730p27513547.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
