Of course you are right. Sorry, my brain is not firing on all cylinders. The unit test I attached to the jira issue should confirm that the headers are being passed.
Claus Ibsen wrote: > > Hi > > I do think the headers are passed through now that the patch is applied. > > The component does this for input to the velocity context map > Map variableMap = ExchangeHelper.createVariableMap(exchange); > > This will store the information according to the wiki doc: > http://activemq.apache.org/camel/velocity.html > > So the message.in.headers is stored in headers > > And after the patch the headers on the out message is set like this: > Map<String, Object> headers = (Map<String, > Object>)velocityContext.get("headers"); > for (String key : headers.keySet()) { > out.setHeader(key, headers.get(key)); > } > > So I do think all the headers is stored on the out. > > But would be nice with a unit test that verifies this behaviour. Anyone > could whirl up a quick test and we could get it into the SVN. > > > Med venlig hilsen > > Claus Ibsen > ...................................... > Silverbullet > Skovsgårdsvænget 21 > 8362 Hørning > Tlf. +45 2962 7576 > Web: www.silverbullet.dk > > -----Original Message----- > From: Stephen J [mailto:[EMAIL PROTECTED] > Sent: 18. juni 2008 16:27 > To: [email protected] > Subject: Re: Exchange headers in velocity > > > After looking at the code a little more I'm starting to wonder if any > headers > that have been set in any previous exchanges, will make it out of the > velocity template endpoint. > > It does not appear that the headers that are passed into the velocity > endpoint are ever being copied to the outbound message. > > Could someone who know the code a little better comment on this? > > > James.Strachan wrote: >> >> I was just about to apply it then spotted Willem beat me to it :) Nice >> work guys! >> >> 2008/6/17 Stephen J <[EMAIL PROTECTED]>: >>> >>> I have submitted a potential patch to fix this issue. Please check the >>> jira >>> and let me know. >>> >>> >>> Hadrian Zbarcea wrote: >>>> >>>> setHeader() will add the header, that's correct. >>>> >>>> We'll make sense out of this. If you could turn your test into a >>>> junit test and attach it to the jira, it would be highly appreciated. >>>> >>>> Hadrian >>>> >>>> On Jun 17, 2008, at 12:59 PM, Stephen J wrote: >>>> >>>>> >>>>> This: >>>>> >>>>> $in.setHeader('fruit', 'apple') >>>>> >>>>> didn't seem to work. >>>>> >>>>> In my post velocity processor I tried to return the value like this: >>>>> >>>>> System.out.println(exchange.getIn().getHeader('fruit')); >>>>> >>>>> and it returns 'null' >>>>> >>>>> I also have some code that iterates through all the headers in the >>>>> "in" >>>>> message and the only thing that appears is the >>>>> org.apache.camel.velocity.resource header. >>>>> >>>>> One other thing that I want to be sure about. This setHeader() >>>>> statement >>>>> will add the header if it doesn't exist, correct? >>>>> >>>>> James.Strachan wrote: >>>>>> >>>>>> 2008/6/17 Stephen J <[EMAIL PROTECTED]>: >>>>>>> >>>>>>> none of the below work: >>>>>>> #set( $in.headers.fruit = 'apple' ) >>>>>>> #set( $headers.fruit = 'apple' ) >>>>>>> $in.headers.fruit = 'apple' >>>>>>> $headers.fruit = 'apple' >>>>>> >>>>>> I'm not sure if the velocity pseudo-bean properties stuff works with >>>>>> the Camel Exchange / Message interfaces. >>>>>> >>>>>> Does this work? >>>>>> >>>>>> $in.setHeader('fruit', 'apple') >>>>>> >>>>>> Maybe we could write a custom Velocity class to help its >>>>>> introspection >>>>>> stuff work with Exchange/Message interfaces? (Have never tried - not >>>>>> even sure its possible) >>>>>> >>>>>> -- >>>>>> James >>>>>> ------- >>>>>> http://macstrac.blogspot.com/ >>>>>> >>>>>> Open Source Integration >>>>>> http://open.iona.com >>>>>> >>>>>> >>>>> >>>>> -- >>>>> View this message in context: >>>>> http://www.nabble.com/Exchange-headers-in-velocity-tp17916457s22882p17920420.html >>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>> >>>> >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Exchange-headers-in-velocity-tp17916457s22882p17937402.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> James >> ------- >> http://macstrac.blogspot.com/ >> >> Open Source Integration >> http://open.iona.com >> >> > > -- > View this message in context: > http://www.nabble.com/Exchange-headers-in-velocity-tp17916457s22882p17983876.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > > -- View this message in context: http://www.nabble.com/Exchange-headers-in-velocity-tp17916457s22882p17984382.html Sent from the Camel - Users mailing list archive at Nabble.com.
