My new website on Artificial Intelligence and Machine Learning www.aimlfront.com

Apache Camel Components

Camel includes the following Component implementations via URIs..

Bean/camel-core: (bean:beanName[?options])Uses the Bean Binding to bind message exchanges to beans in the Registry. Is also used for exposing and invoking POJO (Plain Old Java Objects).

  from("direct:start")
    .bean(MyBean.class, "hello(*,*)")
    .to("mock:result");


Bean Validator/camel-bean-validator: (bean-validator:label[?options])Validates the payload of a message using the Java Validation API (JSR 303 and JAXP Validation) and its reference implementation Hibernate Validator.

interface definition for our custom validation group

   public interface OptionalChecks {
   }


If you want to check the constraints from the group OptionalChecks, you have to define the route like this

  from("direct:start")
 .to("bean-validator://x?group=OptionalChecks")
 .to("mock:end")


Browse / camel-core: (browse:someName)Provides a simple BrowsableEndpoint which can be useful for testing, visualisation tools or debugging. The exchanges sent to the endpoint are all available to be browsed..

Cache/camel-cache: (cache://cacheName[?options])The cache component facilitates creation of caching endpoints and processors using EHCache as the cache implementation..

Direct / camel-core: (direct:someName[?options])Synchronous call to another endpoint from same CamelContext..

 from("direct:processOrder")
    .to("bean:orderService?method=process")
    .to("activemq:queue:order.out");


File / camel-core: (file://nameOfFileOrDirectory[?options])Sending messages to a file or polling a file or directory..

 from("file://inbox?preMove=inprogress&move=.done").to("bean:handleOrder");


FreeMarker / camel-freemarker: (freemarker:templateName[?options])Generates a response using a FreeMarker template.

  from("activemq:My.Queue").
  to("freemarker:com/acme/MyResponse.ftl");


FTP / camel-ftp: (ftp:contextPath[?options])Sending and receiving files over FTP...

 ftp://[username@]hostname[:port]/directoryname[?options]
 sftp://[username@]hostname[:port]/directoryname[?options]
 ftps://[username@]hostname[:port]/directoryname[?options]


GMail / camel-gae: (gmail://user@g[oogle]mail.com[?options])Supports sending of emails via the mail service of Google App Engine. See also Camel Components for Google App Engine..

HTTP / camel-http: (http:hostName[:port][/resourceUri][?options])For calling out to external HTTP servers using Apache HTTP Client 3.x.

   from("direct:start")
  .setHeader(Exchange.HTTP_METHOD, constant("POST"))
  .to("http://www.google.com");


IMAP / camel-mail: (imap://[username@]hostName[:port][?options])Receiving email using IMAP.

 smtp://[username@]host[:port][?options]
 pop3://[username@]host[:port][?options]
 imap://[username@]host[:port][?options]


JDBC / camel-jdbc: (jdbc:dataSourceName[?options])For performing JDBC queries and operations.

  from("direct:projects")
   .setHeader("lic", constant("ASF"))
   .setHeader("min", constant(123))
   .setBody("select * from projects where license = :?lic and id > :?min order by id")
   .to("jdbc:myDataSource?useHeadersAsParameters=true")


JMS / camel-jms: (jms:[queue:|topic:]destinationName[?options]])Working with JMS providers.

 from("file://inbox/order").to("jms:queue:order?messageConverter=#myMessageConverter");


JPA / camel-jpa: (jpa://entityName[?options]])For using a database as a queue via the JPA specification for working with OpenJPA, Hibernate or TopLink.

 from("jpa://org.apache.camel.examples.MultiSteps?consumer.namedQuery=step1")
.to("bean:myBusinessLogic");


Language / camel-core: (language://languageName[:script][?options])Executes Languages scripts.For example you can use the Simple language to Message Translator a message:

 String script = URLEncoder.encode("Hello ${body}", "UTF-8");
from("direct:start").to("language:simple:" + script).to("mock:result");


Log / camel-core: (log:loggingCategory[?options])Uses Jakarta Commons Logging to log the message exchange to some underlying logging system like log4j.

  from("activemq:orders").
    to("log:com.mycompany.order?level=DEBUG&groupSize=10").to("bean:processOrder");


Mock / camel-core: (mock:name[?options]) For testing routes and mediation rules using mocks.


Quartz / camel-quartz (quartz://groupName/timerName[?options])Provides a scheduled delivery of messages using the Quartz 1.x scheduler.

 from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").to("activemq:Totally.Rocks");


SERVLET / camel-servlet: (servlet:relativePath[?options])For exposing services over HTTP through the servlet which is deployed into the Web container..

  servlet://relative_path[?options]


Splunk / camel-splunk: (splunk://[endpoint]?[options])For working with Splunk..

  from("splunk://normal?delay=5s&username=user&password=123&initEarliestTime=-10s&search=search
  index=myindex sourcetype=someSourcetype").to("direct:search-result");


SpringBatch / camel-spring-batch: (spring-batch:jobName[?options])To bridge Camel and Spring Batch.

  from("direct:startBatch").to("spring-batch:myJob");


SpringIntegration / camel-spring-integration: (spring-integration:defaultChannelName[?options])The bridge component of Camel and Spring Integration.

  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="direct:twowayMessage"/>
            <to uri="spring-integration:inputChannel?inOut=true&inputChannel=outputChannel"/>
        </route>
        <route>
            <from uri="direct:onewayMessage"/>
            <to uri="spring-integration:onewayChannel?inOut=false"/>
        </route>
    </camelContext>


StringTemplate / camel-stringtemplate: (string-template:templateName[?options])Generates a response using a String Template.

  from("activemq:My.Queue").
  to("string-template:com/acme/MyResponse.tm");


Test / camel-spring: (test:expectedMessagesEndpointUri[?options])Creates a Mock endpoint which expects to receive all the message bodies that could be polled from the given underlying endpoint.

 from("seda:someEndpoint").
  to("test:file://data/expectedOutput?noop=true");


Timer / camel-core: (timer:timerName[?options])Used to generate message exchanges when a timer fires You can only consume events from this endpoint..

 <route>
  <from uri="timer://foo?repeatCount=1"/>
  <to uri="bean:myBean?method=someMethodName"/>
</route>


Validation / camel-core (camel-spring for Camel 2.8 or older): (validation:someLocalOrRemoteResource[?options])Validates the payload of a message using XML Schema and JAXP Validation.

 <route>
    <from uri="direct:start"/>
    <doTry>
        <to uri="validator:org/apache/camel/component/validator/schema.xsd"/>
        <to uri="mock:valid"/>
        <doCatch>
            <exception>org.apache.camel.ValidationException</exception>
            <to uri="mock:invalid"/>
        </doCatch>
        <doFinally>
            <to uri="mock:finally"/>
        </doFinally>
    </doTry>
</route>


VM / camel-core: (vm:queueName[?options])Asynchronous call to another endpoint in the same JVM.

 from("direct:foo").to("vm:bar");
 from("vm:bar?concurrentConsumers=5").to("file://output");


XQuery / camel-saxon: (xquery:someXQueryResource)Generates a response using an XQuery template.

  from("activemq:My.Queue").
  to("xquery:com/acme/mytransform.xquery");


XSLT / camel-core (camel-spring for Camel 2.8 or older): (xslt:templateName[?options])Generates a response using an XSLT template.

  from("activemq:My.Queue").
  to("xslt:com/acme/mytransform.xsl").
  to("activemq:Another.Queue");


Note: To know more Apache Camel components: see http://camel.apache.org/components.html