Configuring URI to call - 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

You can set the HTTP producer's URI directly form the endpoint URI. In the route below, Camel will call out to the external server, oldhost, using HTTP.

from("direct:start").to("http4://oldhost");

And the equivalent Spring sample:

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
   <route>
      <from uri="direct:start"/>
      <to uri="http4://oldhost"/>
   </route>
</camelContext>

You can override the HTTP endpoint URI by adding a header with the key Exchange.HTTP_URI on the message.

from("direct:start")
   .setHeader(Exchange.HTTP_URI, constant("http://newhost"))
   .to("http4://oldhost");

In the sample above Camel will call the http://newhost despite the fact the endpoint is configured with http4://oldhost. where Constants is the class, org.apache.camel.component.http4.Constants. If the http4 endpoint is working in bridge mode, it will ignore the Exchange.HTTP_URI message header.