|
Page Edited :
CAMEL :
Bean Binding
Bean Binding has been edited by James Strachan (Oct 01, 2008). Content:Bean BindingThe Bean Binding in Camel defines both which methods are invoked and also how the Message is converted into the parameters of the method when it is invoked. Choosing the method to invokeThe binding of a Camel Message to a bean method call can occur in different ways
By default the return value is set on the outbound message body. Binding AnnotationsYou can use the Binding Annotations to customize how paramter values are created from the Message ExamplesFor example a POJO such as: public class Bar { public String doSomething(String body) { // process the in body and return whatever you want return "Bye World"; }
public class Foo { @MessageDriven(uri = "activemq:my.queue") public void doSomething(String body) { // process the inbound message here } } Here Camel with subscribe to an ActiveMQ queue, then convert the message payload to a String (so dealing with TextMessage, ObjectMessage and BytesMessage in JMS), then process this method. |
Unsubscribe or edit your notifications preferences
