Samples - 6.3

Talend ESB Mediation Developer Guide

EnrichVersion
6.3
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

In this sample we find the 7 day weather forecast for Madrid, Spain:

from("weather:foo?location=Madrid,Spain&period=7 days").to("jms:queue:weather");

To just find the current weather for your current location you can use this:

from("weather:foo").to("jms:queue:weather");

And to find the weather using the producer we do:

from("direct:start")  .to("weather:foo?location=Madrid,Spain");

And we can send in a message with a header to get the weather for any location as shown:

String json = template.requestBodyAndHeader("direct:start", "", 
"CamelWeatherLocation", "Paris,France", String.class);

And to get the weather at the current location, then:

String json = template.requestBodyAndHeader("direct:start", "", 
"CamelWeatherLocation", "current", String.class);