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.






James.Strachan wrote:
> 
> BTW am wondering if the issue is that the processor doesn't create an
> OUT body - so its gonna reuse the IN? e.g. I wonder if you set the
> header on the IN, or set some kinda  OUT body?
> 
> On 27/02/2008, Kamal <[EMAIL PROTECTED]> wrote:
>>
>>  We are using camel 1.2.0 and activemq 4.1.1. Should I try with the 1.3
>>  snapshot.
>>
>>
>>
>>  James.Strachan wrote:
>>  >
>>  > Which version of Camel are you using BTW? Just wondered if this has
>>  > been fixed since 1.2.0 (we so need 1.3.0 to be released! :)
>>  >
>>  > On 27/02/2008, Kamal <[EMAIL PROTECTED]> wrote:
>>  >>
>>  >>  I am trying to set the JMXGroupId property from within a processor
>> using
>>  >> the
>>  >>  following code.
>>  >>  exchange.getOut().setHeader("JMSXGroupID",groupId);
>>  >>  which doesn't work.
>>  >>
>>  >>  I also tried to get hold of the underlying JMSMessage by casting the
>>  >> Message
>>  >>  object, but the underlying JMS message object is null.
>>  >>                 Message outMessage = exchange.getOut();
>>  >>                 JmsMessage jmsOutMessage = (JmsMessage) outMessage;
>>  >>                 javax.jms.Message underlyingMessage =
>>  >> jmsOutMessage.getJmsMessage();
>>  >>                 System.out.println("underlyingMessage" +
>>  >> underlyingMessage);
>>  >>
>>  >>  The requirement is to extract information from the message and set
>> it as
>>  >> a
>>  >>  JMSXGroupID.  We don't have control over the producer.  We are using
>>  >>  ActiveMQ, with Camel embedded within the broker.
>>  >>
>>  >>  The following is my camel context configuration
>>  >>  <camelContext
>> xmlns="http://activemq.apache.org/camel/schema/spring";>
>>  >>           <route>
>>  >>                 <from uri="activemq:testQ-input"/>
>>  >>                 <process ref="groupIdInsertionProcessor"/>
>>  >>                 <to uri="activemq:testQ-output"/>
>>  >>           </route>
>>  >>  </camelContext>
>>  >>
>>  >>  <bean id="groupIdInsertionProcessor"
>>  >> class="xx.GroupIdInsertionProcessor"/>
>>  >>
>>  >>  public class GroupIdInsertionProcessor implements Processor {
>>  >>         public void process(Exchange exchange) throws Exception {
>>  >>                 Message inMessage = exchange.getIn();
>>  >>
>>  >> exchange.getOut().setHeader("JMSXGroupID",inMessage.getBody());
>>  >>         }
>>  >>  }
>>  >>
>>  >>
>>  >>  Thanks for the help.
>>  >>
>>  >>  Regards,
>>  >>  Kamal
>>  >>
>>  >> --
>>  >>  View this message in context:
>>  >>
>> http://www.nabble.com/setting-JMSXGroupId-property-from-within-a-processor-tp15706825s22882p15706825.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/setting-JMSXGroupId-property-from-within-a-processor-tp15706825s22882p15707114.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/setting-JMSXGroupId-property-from-within-a-processor-tp15706825s22882p15707491.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to