Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
minLevel1
maxLevel7

Endpoint URIs

Endpoints are defined by endpoint URIs, which have the following form:

...

NOTE: In the above example, HTTP URI is used to connect to Google and File URI will be used to read all files related to that file directory.

Configure Endpoints

Sometimes our endpoint URIs can become quite long since there may be accompanying configuration information that must be applied. There are two approaches to endpoint configuration:

Configure Endpoints Separately

We can configure our endpoints separately, and then refer to them from within the route:

Code Block
<endpoint id="myEndpoint" uri="ftp://foo@myserver">
    <property name="password" value="secret"/>
    <property name="recursive" value="true"/>
    <property name="ftp.dataTimeout" value="50000"/>
  </endpoint>

  <route>
    <from uri="ref:myEndPoint"/>
    ...
  </route>

Use of Property Attribute

We can configure options in the URI and then use a property attribute to define more options or to possibly override any options for URI).

Code Block
<endpoint id="foo" uri="ftp://foo@myserver?recursive=true">
  <property name="password" value="secret"/>
  <property name="ftp.dataTimeout" value="50000"/>
  <property name="ftp.serverLanguageCode" value="en"/>
</endpoint>

Apache Camel Components

Each of the different types of URI schemes will map to an Apache Camel component, where an Apache Camel component is essentially an endpoint factory. Therefore, to use a particular type of endpoint, you must also deploy the correct Apache Camel component into the runtime container. For example, to use JMS endpoints, you will need to deploy the JMS component into your container.

...

  • Bean

  • Browse

  • Dataset

  • Direct

  • File

  • Log

  • Mock

  • Properties

  • Ref

  • SEDA

  • Timer

  • VM

Consumer endpoints

This is an endpoint that appears at the start of a route (that is, in a from() DSL command). The consumer endpoint is responsible for initiating processing in a route: it will create a new exchange instance (based on a message received or obtained), and then provides a thread to process the exchange in the rest of the route.

Code Block
<camelContext id="CamelContextID"
              xmlns="http://camel.apache.org/schema/spring">
  <route>
    <from uri="jms:queue:payments"/>
    <process ref="someProcessorId"/>
    <to uri="TargetURI"/>
  </route>
</camelContext>

Producer endpoints

This is an endpoint that appears in the middle or at the end of a route (ie., in a to() DSL command). The producer endpoint receives an existing exchange object and then proceeds to send the contents of the exchange to the specified endpoint.

...