Globalmap variables in Mediation routes

Six Stars

Globalmap variables in Mediation routes

Hi,

 

I’ve been using Talend for about 18 months, mainly DI and services and I’m struggling to adapt to writing ESB routes.

 

Are global variables not available in ESB routes?

 

I’ve done a simple job which puts a string into a global variable and tries to retrieve it

 

globalMap.put("Test", "Test")

 

I get the error ‘globalMap cannot be resolved’

 

Am I doing something wrong or can you not use global variables in a route?

 

Thanks


Accepted Solutions
Moderator

Re: Globalmap variables in Mediation routes

Hello,

Talend Context variables in route URIs can be supplied at deployment time. Talend also uses CamelContext within its code.

Set CamelContext in cConfig. The example below, you can use getContext to get the existing context:

CamelContext my_camelContext = getContext(); 
System.out.println("DEBUG: " + my_camelContext.getName()); 

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

All Replies
Moderator

Re: Globalmap variables in Mediation routes

Hello,

Why don't you set headers on your messages using the csetheader component?

https://help.talend.com/reader/icR~K75bTkRQZM0EI_axiA/beKE5xwV3PN0wnxbedyu8g

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Globalmap variables in Mediation routes

Ok thanks @xdshi so is Globalmap not supported in routes?

Moderator

Re: Globalmap variables in Mediation routes

Hello,

Talend Context variables in route URIs can be supplied at deployment time. Talend also uses CamelContext within its code.

Set CamelContext in cConfig. The example below, you can use getContext to get the existing context:

CamelContext my_camelContext = getContext(); 
System.out.println("DEBUG: " + my_camelContext.getName()); 

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Globalmap variables in Mediation routes

Brilliant, thanks

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads