One Star

saving value to a context attribute in route

I have a simple route that listens to an ActiveMQ queue using cJMS. The message contains a JMS Property "Subject", and I want to decode it and save it into my context attribute "MySubject" for later use. I am using cProcessor (after the cJMS component) with the following code:
context.MySubject= exchange.getIn().getHeader("Subject").toString();
I can see the correct value returned by the code:  exchange.getIn().getHeader("Subject").toString() (using for example, System.out.println("*****" + exchange.getIn().getHeader("Subject").toString()) ), but when I use the cLog (after cProcessor) to print out the value of context.MySubject, it is null.
Can someone please tell me what I am missing?
Thanks
1 REPLY
One Star

Re: saving value to a context attribute in route

Hi
The log endpoint initialized at route start with null value from context variable; try to store your dynamic data using cSetHeader.