Globalmap variables in Mediation routes

Highlighted
Seven 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.
Seven 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.
Seven Stars

Re: Globalmap variables in Mediation routes

Brilliant, thanks

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

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

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