CMessagingEndpoint - URI with dynamic parameters

One Star

CMessagingEndpoint - URI with dynamic parameters

Hi,
how can I add a dynamic value to the URI of cMessagingEndpoint?
Example:
I want so select data from database where id = <param>
The value for <param> is hold in header of the message.
I try to do like this, but that was not successfull:
"sql:select * from table where id = ${header.id}?dataSourceRef=myDS"


Thanks for help!
Community Manager

Re: CMessagingEndpoint - URI with dynamic parameters

Unfortunately as soon as the route is started, the endpoints are fixed. You can use code to start and stop sub-routes. This would allow you to stop a sub-route, change its endpoint and restart it, but that takes a fair bit of code and is not ideal. An easier way of achieving this might be to use a cTalendJob. You can send the message to the cTalendJob, the job called by the cTalendJob will act (give or take) just like a normal Talend job, which means you can easily use dynamic SQL. You can then return your message to the route.
One Star

Re: CMessagingEndpoint - URI with dynamic parameters

This code works:
"sql:select * from table where id=:#${header.id}?dataSourceRef=myDS"

The problem was the missing ":#" before the parametervalue!
Community Manager

Re: CMessagingEndpoint - URI with dynamic parameters

I didn't know this. I was basing my answer on trying to change direct and vm endpoints dynamically. Nice to know.

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

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