You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mike Stroming <ms...@gmail.com> on 2012/12/05 04:39:40 UTC

setHeaders when message gets routed to different queues

Hi all,

I'm fairly new to Camel, so please forgive the ignorance.  I'm not sure if
this is a good way to design the logic, but let's say I have:

- set a bunch of header variables
- route message to queue A
- set the same header variables to new values
- route message to queue B

Will those original values of the header variables get overridden if queue
B's message gets processed first?  Or does each message in each queue have
it's own set of the header variables?

Thanks,
Mike

Re: setHeaders when message gets routed to different queues

Posted by Willem jiang <wi...@gmail.com>.
Hi Mike

Sorry, I made a typo on my last mail.

The message which you get from the queue is not the exactly same one you send to the queue.
So the change on the original message headers will *not* effect the message which you get from queue.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Wednesday, December 5, 2012 at 11:04 PM, Mike Stroming wrote:

> Thanks Willem. So, even when the message is sent to two different queues,
> there's only one copy of the message headers per message?
>  
> Thanks,
> Mike
>  
> On Wed, Dec 5, 2012 at 1:34 AM, Willem jiang <willem.jiang@gmail.com (mailto:willem.jiang@gmail.com)> wrote:
>  
> > Hi
> >  
> > When the message send to the queue, it will marshaled as a stream.
> > And you will get a copy of it from the queue, so when you change the
> > original message headers, it will effect the message which you already send
> > to queue.
> >  
> > --
> > Willem Jiang
> >  
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Web: http://www.fusesource.com | http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> > (English)
> > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >  
> >  
> >  
> >  
> > On Wednesday, December 5, 2012 at 11:39 AM, Mike Stroming wrote:
> >  
> > > Hi all,
> > >  
> > > I'm fairly new to Camel, so please forgive the ignorance. I'm not sure if
> > > this is a good way to design the logic, but let's say I have:
> > >  
> > > - set a bunch of header variables
> > > - route message to queue A
> > > - set the same header variables to new values
> > > - route message to queue B
> > >  
> > > Will those original values of the header variables get overridden if
> > queue
> > > B's message gets processed first? Or does each message in each queue have
> > > it's own set of the header variables?
> > >  
> > > Thanks,
> > > Mike
> >  
>  




Re: setHeaders when message gets routed to different queues

Posted by Mike Stroming <ms...@gmail.com>.
Thanks Willem.  So, even when the message is sent to two different queues,
there's only one copy of the message headers per message?

Thanks,
Mike

On Wed, Dec 5, 2012 at 1:34 AM, Willem jiang <wi...@gmail.com> wrote:

> Hi
>
> When the message send to the queue, it will marshaled as a stream.
> And you will get a copy of it from the queue, so when you change the
> original message headers, it will effect the message which you already send
> to queue.
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> (English)
>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
> On Wednesday, December 5, 2012 at 11:39 AM, Mike Stroming wrote:
>
> > Hi all,
> >
> > I'm fairly new to Camel, so please forgive the ignorance. I'm not sure if
> > this is a good way to design the logic, but let's say I have:
> >
> > - set a bunch of header variables
> > - route message to queue A
> > - set the same header variables to new values
> > - route message to queue B
> >
> > Will those original values of the header variables get overridden if
> queue
> > B's message gets processed first? Or does each message in each queue have
> > it's own set of the header variables?
> >
> > Thanks,
> > Mike
>
>
>
>

Re: setHeaders when message gets routed to different queues

Posted by Willem jiang <wi...@gmail.com>.
Hi  

When the message send to the queue, it will marshaled as a stream.
And you will get a copy of it from the queue, so when you change the original message headers, it will effect the message which you already send to queue.

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem




On Wednesday, December 5, 2012 at 11:39 AM, Mike Stroming wrote:

> Hi all,
>  
> I'm fairly new to Camel, so please forgive the ignorance. I'm not sure if
> this is a good way to design the logic, but let's say I have:
>  
> - set a bunch of header variables
> - route message to queue A
> - set the same header variables to new values
> - route message to queue B
>  
> Will those original values of the header variables get overridden if queue
> B's message gets processed first? Or does each message in each queue have
> it's own set of the header variables?
>  
> Thanks,
> Mike