Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
Message EndpointCamel supports the Message Endpoint from the EIP patterns using the Endpoint interface. When using the DSL to create Routes you typically refer to Message Endpoints by their URIs rather than directly using the Endpoint interface. Its then a responsibility of the CamelContext to create and activate the necessary Endpoint instances using the available Component implementations. ExampleThe following example route demonstrates the use of a File Consumer Endpoint and JMS Producer Endpoint Using the Fluent Builders from("file://local/router/messages/foo") .to("jms:queue:foo");
Using the Spring XML Extensions <route> <from uri="file://local/router/messages/foo"/> <to uri="jms:queue:foo"/> </route>
Dynamic ToAvailable as of Camel 2.16 There is a new <toD> that allows to send a message to a dynamic computed Endpoint using one or more Expression that are concat together. By default the Simple language is used to compute the endpoint. For example to send a message to a endpoint defined by a header you can do <route> <from uri="direct:start"/> <toD uri="${header.foo}"/> </route> And in Java DSL from("direct:start") .toD("${header.foo}");
You can also prefix the uri with a value because by default the uri is evaluated using the Simple language <route> <from uri="direct:start"/> <toD uri="mock:${header.foo}"/> </route> And in Java DSL from("direct:start") .toD("mock:${header.foo}"); In the example above we compute an endpoint that has prefix "mock:" and then the header foo is appended. So for example if the header foo has value order, then the endpoint is computed as "mock:order". You can also use other languages than Simple such as XPath - this requires to prefix with language: as shown below (simple language is the default language). If you do not specify language: then the endpoint is a component name. And in some cases there is both a component and language with the same name such as xquery. <route> <from uri="direct:start"/> <toD uri="language:xpath:/order/@uri"/> </route> This is done by specifying the name of the language followed by a colon. from("direct:start") .toD("language:xpath:/order/@uri"); You can also concat multiple Language(s) together using the plus sign <route> <from uri="direct:start"/> <toD uri="jms:${header.base}+language:xpath:/order/@id"/> </route> In the example above the uri is a combination of Simple language and XPath where the first part is simple (simple is default language). And then the plus sign separate to another language, where we specify the language name followed by a colon from("direct:start") .toD("jms:${header.base}+language:xpath:/order/@id"); You can concat as many languages as you want, just separate them with the plus sign The Dynamic To has a few options you can configure
For more details see Using This PatternIf you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out. |