You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by npa <np...@gmail.com> on 2014/03/21 15:48:06 UTC

CAMEL: Adding Properties to a message in Spring DSL

I have a simple route in camel, which reads messages from an activemq queue
'A' and writes it to another activemq queue 'B'.I was able to get this to
this part to work.

But I need to add a new property to the message before writing it to 'B'. I
have tried to add the property 'prop1' to the message using the Spring DSL
below, but the property is not being added to the message.

Is this the correct way to add a property to a message in SPRING DSL?

<camelContext xmlns="http://camel.apache.org/schema/spring">
     <route>
        <from uri="activemq:queue:A"/>
          <setProperty propertyName="prop1">
            <simple>prop1Value</simple>
          </setProperty>
        <to uri="activemq:queue:B"/>
     </route>               
  </camelContext>



--
View this message in context: http://camel.465427.n5.nabble.com/CAMEL-Adding-Properties-to-a-message-in-Spring-DSL-tp5749204.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CAMEL: Adding Properties to a message in Spring DSL

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Use <setHeader> instead. as headers are part of the message.

You can read a bit more on the javadoc for Exchange and Message from
http://camel.apache.org/maven/current/camel-core/apidocs/index.html

Or more from the chapter 1 of the Camel in Action book, see section 1.3
http://manning.com/ibsen/chapter1sample.pdf


On Fri, Mar 21, 2014 at 3:48 PM, npa <np...@gmail.com> wrote:
> I have a simple route in camel, which reads messages from an activemq queue
> 'A' and writes it to another activemq queue 'B'.I was able to get this to
> this part to work.
>
> But I need to add a new property to the message before writing it to 'B'. I
> have tried to add the property 'prop1' to the message using the Spring DSL
> below, but the property is not being added to the message.
>
> Is this the correct way to add a property to a message in SPRING DSL?
>
> <camelContext xmlns="http://camel.apache.org/schema/spring">
>      <route>
>         <from uri="activemq:queue:A"/>
>           <setProperty propertyName="prop1">
>             <simple>prop1Value</simple>
>           </setProperty>
>         <to uri="activemq:queue:B"/>
>      </route>
>   </camelContext>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CAMEL-Adding-Properties-to-a-message-in-Spring-DSL-tp5749204.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io