Using context variables in REST endpoint URLs in Data Services - 7.3

ESB REST

Version
7.3
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Data Governance > Third-party systems > ESB components > ESB REST components
Data Quality and Preparation > Third-party systems > ESB components > ESB REST components
Design and Development > Third-party systems > ESB components > ESB REST components
Last publication date
2024-02-21

Context variables are supported in REST service provider and consumer endpoints in Data Services. This allows you to run multiple interacting services locally in Talend Studio, while having the endpoints contextualized so that you can deploy services to various environment using a different context.

For more technologies supported by Talend, see Talend components.

You can use context variables in the endpoint URL of tRESTRequest, tRESTClient and cREST, either an absolute or relative path.

For example, the following context variables are defined in Talend Studio.

Context Value

context.full_a

http://localhost:8090/services/customers

context.full_b http://localhost:8090/customers
context.full_c http://localhost:8090/any/customers

context.url_a

/customers

context.url_b

/services/customers

context.port_a

8090

context.port_b

8091

If you specify the endpoint URL with the context variables, the service will be exposed at the following addresses.

Endpoint Studio Runtime Microservice(app/docker)

context.full_a

http://localhost:8090/services/customers

http://localhost:8090/services/customers http://localhost:8090/services/customers
context.full_b http://localhost:8090/customers http://localhost:8090/customers http://localhost:8090/customers
context.full_c http://localhost:8090/any/customers http://localhost:8090/any/customers http://localhost:8090/any/customers

context.url_a

http://localhost:8090/customers http://localhost:8040/services/customers http://localhost:8065/services/customers

context.url_b

http://localhost:8090/services/customers http://localhost:8040/services/customers http://localhost:8065/services/customers
"http://localhost:"+ context.port_b + context.url_b http://localhost:8091/services/customers http://localhost:8091/services/customers http://localhost:8091/services/customers

context.url_a + "/rest"

http://localhost:8090/customers/rest http://localhost:8040/services/customers/rest http://localhost:8065/services/customers/rest

"http://localhost:8090" + context.url_a + "/" + System.getProperty("user.name")

http://localhost:8090/customers/<DynamicOSLoginUserName> http://localhost:8040/services/customers/<DynamicOSLoginUserName> http://localhost:8065/services/customers/<DynamicOSLoginUserName>
Note: If the endpoints contains a Java code like System.getProperty, user should set this properties before running the bundle in Talend Runtime or Microservice. Otherwise there will be an error as the properties are missing.