Need help on setHeader

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Need help on setHeader

sarfaraj
This post has NOT been accepted by the mailing list yet.
Hi,

My camel route have below splitter component

<split strategyRef="aggregatorStrategy">
                                <xpath>//device</xpath>
                                                               
                                <unmarshal>
                                        <jaxb prettyPrint="true" contextPath="com.model" />
                                </unmarshal>
                                <process ref="myAppProcessor" id="myapp" />
                                <to uri="ssh://root:pwd123@xx.xx.xx.xx:22"/>
                    <unmarshal>
                                        <jaxb prettyPrint="true" contextPath="com.model" />
                                </unmarshal>
                                <process ref="marshalProcessor" id="marshal-dlci-model" /> 
                        </split>
                        <process ref="transformProcessor" id="Transform" />
                       
                        And My request object look's like
                       
                       
            <device>
                <host>xx.xx.xx.xx</host>
               <userName>root</userName>
               <password>yyyy</password>
               <additionalInfo>ssssssss</additionalInfo>
            </device>
                       
                       
                        In above camel route i do the following
                        1) Split the device request using xpath (<xpath>//device</xpath>)
                        2) using jaxb unmarshal to device object
                        3) pass device object to "myAppProcessor" and set the command to body for ssh.
                        4) Execute the ssh and get the result in java.lang.String
                        5) Unmarshal to DeviceResponse
                        6) And finally aggregate the result in "transformProcessor" processor.
                       
                       
                        My question is ->>>> my device object have additionalInfo object which i want in a marshalProcessor.
                        Can someone tell me how to get that value in "marshalProcessor" ? I tried using setHeader but the scope was limited to next processor only.
Reply | Threaded
Open this post in threaded view
|

Re: Need help on setHeader

sarfaraj

One thought....


Does camel/servicemix provide defining and accessing variables in route? If yes, can I use that approach?

How do they work in multithreaded environment. E.g. in splitter splitted msgs will get executed in parallel. i.e. if they are static then they won’t work in my use case.

Can someone help?

       
/Sarfaraj
Reply | Threaded
Open this post in threaded view
|

Re: Need help on setHeader

Christian Mueller
Administrator
Yes.
If you have to be statefull, put the state into the exchange (properties,
message header). They are NOT only available until the next processor, if
you do it right.

Christian

Sent from a mobile device
Am 01.08.2012 14:56 schrieb "sarfaraj" <[hidden email]>:

>
> One thought....
>
>
> Does camel/servicemix provide defining and accessing variables in route? If
> yes, can I use that approach?
>
> How do they work in multithreaded environment. E.g. in splitter splitted
> msgs will get executed in parallel. i.e. if they are static then they won’t
> work in my use case.
>
> Can someone help?
>
>
> /Sarfaraj
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Need-help-on-setHeader-tp5716637p5716658.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>