On 27/02/2008, James Strachan <[EMAIL PROTECTED]> wrote:
> On 27/02/2008, Kamal <[EMAIL PROTECTED]> wrote:
> >
>
> > I wasn't setting the body, I was assuming that it would copy over the body
> > from in to out if I don't explicitly set it. I changed the processor as
> > follows and it worked
> >
> >
> > public class GroupIdInsertionProcessor implements Processor {
> > public void process(Exchange exchange) throws Exception {
> > Message inMessage = exchange.getIn();
> >
> > exchange.getOut().copyFrom(inMessage);
> >
> >
> exchange.getOut().setHeader("JMSXGroupID",inMessage.getBody());
> > }
> > }
> >
> >
> > Thank you for the help.
>
>
> Ah great - thanks! Sorry for things being so confusing :). A Processor
> can do anything it likes to the exchange and by default there is no
> output defined, unless the Processor creates it etc.
BTW I've just added a test case to the activemq-core module to test
this use case out...
https://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/camel/SetHeaderTest.java
Incidentally in the Java DSL you'd do this via code like this using
some kinda expression...
from("activemq:test-input").
setHeader("JMSXGroupID").el("${in.body}").
to("activemq:test-output");
or thanks to https://issues.apache.org/activemq/browse/CAMEL-348 you
can do it even easier...
from("activemq:test-input").
setHeader("JMSXGroupID").body().
to("activemq:test-output");
Its just we don't yet support the <setHeader> element in XML
http://issues.apache.org/activemq/browse/CAMEL-195
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com