saving value to a context attribute in route

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

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.

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read