To
Camel supports the Message Endpoint from the EIP patterns using the Endpoint interface.
How does an application connect to a messaging channel to send and receive messages?
Connect an application to a messaging channel using a Message Endpoint, a client of the messaging system that the application can then use to send or receive messages.
Options
The To eip supports 3 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
|
uri |
Required Sets the uri of the endpoint to send to. |
String |
|
|
disabled |
Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime. |
false |
Boolean |
|
pattern |
Sets the optional ExchangePattern used to invoke this endpoint. Enum values:
|
ExchangePattern |
|
|
description |
Sets the description of this node. |
DescriptionDefinition |
Different between To and ToD
The
to
is used for sending
messages to a static
endpoint
.
In other words
to
sends message
only to the
same
endpoint.
The
toD
is used for sending
message to a dynamic
endpoint
.
The dynamic endpoint is evaluated
on-demand
by an
Expression
.
By default, the
Simple
expression is used to compute
the dynamic endpoint URI.
Using To
The following example route demonstrates the use of a File consumer endpoint and a JMS producer endpoint, by their URIs :
-
Java
-
XML
-
YAML
from("file:messages/foo")
.to("jms:queue:foo");
<route>
<from uri="file:messages/foo"/>
<to uri="jms:queue:foo"/>
</route>
- from:
uri: file:messages/foo
steps:
- to:
uri: jms:queue:foo