Camel ComponentsThere now follows the documentation on each Camel component. ActiveMQ ComponentThe ActiveMQ component allows messages to be sent to a JMS URI formatactivemq:[topic:]destinationName So for example to send to queue FOO.BAR you would use activemq:FOO.BAR You can be completely specific if you wish via activemq:queue:FOO.BAR If you want to send to a topic called Stocks.Prices then you would use activemq:topic:Stocks.Prices Configuring the Connection FactoryThe following test case camelContext.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false")); See AlsoCXF ComponentThe cxf: component provides integration with Apache CXF URI formatcxf:address See AlsoDirect ComponentThe direct: component provides direct, synchronous invocation of any consumers when a producer sends a message exchange. URI formatdirect:someName Where someName can be any string to uniquely identify the endpoint Options
See AlsoFile ComponentThe *file:* URI formatfile:fileName Where fileName represents the underlying file name Options
See AlsoFTP/SFTP/WebDAV ComponentThis component provides access to remote file systems over the FTP, SFTP and WebDAV protocols URI formatftp://host[:port]/fileName[?options] sftp://host[:port]/fileName[?options] webdav://host[:port]/fileName[?options] Where fileName represents the underlying file name or directory Options
See AlsoHTTP ComponentThe http: component provides HTTP based endpoints for exposing HTTP resources or consuming external HTTP resources. URI formathttp:hostname[:port][/resourceUri] See AlsoJBI ComponentThe jbi: component provides integration with a JBI Service Bus such as provided by Apache ServiceMix URI formatjbi:service:serviceQName
jbi:interface:interfaceQName
jbi:endpoint:endpointName
See AlsoJMS ComponentThe JMS component allows messages to be sent to a JMS URI formatjms:[topic:]destinationName?properties So for example to send to queue FOO.BAR you would use jms:FOO.BAR You can be completely specific if you wish via jms:queue:FOO.BAR If you want to send to a topic called Stocks.Prices then you would use jms:topic:Stocks.Prices PropertiesYou can configure lots of different properties on the JMS endpoint which map to properties on the JMSConfiguration POJO
NotesIf you wish to use durable topic subscriptions, you need to specify both clientId and durableSubscriberName. Note that the value of the clientId must be unique and can only be used by a single JMS connection instance in your entire network. You may prefer to use Virtual Topics See AlsoJPA ComponentThe jpa: component allows you to work with databases using JPA (EJB 3 Persistence) such as for working with OpenJPA, Hibernate, TopLink to work with relational databases. Sending POJOs to the JPA endpoint inserts entities into the database. Consuming messages removes (or updates) entities in the database. URI formatjpa:entityClassName Options
See AlsoMail ComponentThe mail: component provides access to Email via Spring's Mail support and the underlying JavaMail system URI formatpop://[user-info@]host[:port][?password=somepwd] imap://[user-info@]host[:port][?password=somepwd] smtp://[user-info@]host[:port][?password=somepwd] which supports either POP, IMAP or SMTP underlying protocols.
See AlsoMINA ComponentThe mina: component is a transport for working with Apache MINA URI formatmina:tcp://hostname[:port] mina:udp://hostname[:port] mina:multicast://hostname[:port] Options
See Also|Mock ComponentThe mock: component provides a powerful declarative testing mechanism which is similar to jMock URI formatmock:someName Where someName can be any string to uniquely identify the endpoint ExamplesHere's quick example of MockEndpoint in use, asserting the number of messages which are expected during a test run MockEndpoint resultEndpoint = context.resolveEndpoint("mock:foo", MockEndpoint.class); resultEndpoint.expectedMessageCount(2); // send some messages ... // now lets assert that the mock:foo endpoint received 2 messages resultEndpoint.assertIsSatisfied(); You can see from the javadoc of MockEndpoint Here's another example resultEndpoint.expectedBodiesReceived("firstMessageBody", "secondMessageBody", "thirdMessageBody"); Or you could add an expectation on the headers or content of a specific message. For example resultEndpoint.message(0).header("foo").isEqualTo("bar"); There are some examples of the Mock endpoint in use in the camel-corecore processor tests See AlsoPojo ComponentThe pojo: component binds PojoExchanges to method invocations on Java Objects. URI formatpojo:someName Where someName can be any string to uniquely identify the endpoint UsingObject instance that can receive invocations, must be explicitly registered with the PojoComponent. PojoComponent component = (PojoComponent)camelContext.getComponent("pojo"); component.addService("bye", new SayService("Good Bye!")); Once an endpoint has been registered, you can build Camel routes that use it to process exchanges. // lets add simple route camelContext.addRoutes(new RouteBuilder() { public void configure() { from("direct:hello").to("pojo:bye"); } }); A pojo: endpoint cannot be defined as the input to the route. Consider using a direct: or queue: endpoint as the input for a PojoExchange. You can use the createProxy() methods on PojoComponent to create a proxy that will generate PojoExchanges and send them to any endpoint: Endpoint endpoint = camelContext.getEndpoint("direct:hello"); ISay proxy = PojoComponent.createProxy(endpoint, ISay.class); String rc = proxy.say(); assertEquals("Good Bye!", rc); See AlsoQuartz ComponentThe quartz: component provides a scheduled delivery of messages using the Quartz scheduler URI formatquartz://timerName?parameters quartz://groupName/timerName?parameters quartz://groupName/timerName/cronExpression You can configure the Trigger and JobDetail using the parameters
For example the following routing rule will fire 2 timer events to the endpoint mock:results from("quartz://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1").to("mock:result"); Using Cron TriggersQuartz supports Cron-like expressions For example the following will fire a message at 12pm (noon) every day from("quartz://myGroup/myTimerName/0/0/12/*/*/$").to("activemq:Totally.Rocks"); which is equivalent to using the cron expression 0 0 12 * * ? The following table shows the URI character encodings we use to preserve valid URI syntax
See AlsoQueue ComponentThe queue: component provides asynchronous SEDA URI formatqueue:someName Where someName can be any string to uniquely identify the endpoint See AlsoRMI ComponentThe rmi: component bind the PojoExchanges Since this binding is just using RMI, normal RMI rules still apply in regards to what the methods can be used over it. This component only supports PojoExchanges URI formatrmi://rmi-regisitry-host:rmi-registry-port/registry-path
For example: rmi://localhost:1099/path/to/service
UsingTo call out to an existing RMI service registered in an RMI registry, create a Route similar to: from("pojo:foo").to("rmi://localhost:1099/foo"); To bind an existing camel processor or service in an RMI registry, create a Route like: RmiEndpoint endpoint= (RmiEndpoint) endpoint("rmi://localhost:1099/bar"); endpoint.setRemoteInterfaces(ISay.class); from(endpoint).to("pojo:bar"); Notice that when binding an inbound RMI endpoint, the Remote interfaces exposed must be specified. See AlsoTimer ComponentThe timer: component derives from the POJO component to provide timed events. You can only consume events from this endpoint. It produces POJO exchanges that send a Runnable.run() method invocation. URI formattimer:name?options Where options is a query string that can specify any of the following parameters:
UsingTo setup a route that generates an event every 500 seconds: from("timer://foo?fixedRate=true&delay=0&period=500").to("pojo:bar");
Note that the "bar" pojo registered should implement Runnable. See AlsoXMPP ComponentThe xmpp: component implements an XMPP (Jabber) transport. URI formatxmpp:hostname[:port][/room] The component supports both room based and private person-person conversations See Also |