Book Image

Mastering Apache Camel

By : Bilgin Ismet Ibryam, Jean Baptiste Onofre, Jean-Baptiste Onofré
5 (1)
Book Image

Mastering Apache Camel

5 (1)
By: Bilgin Ismet Ibryam, Jean Baptiste Onofre, Jean-Baptiste Onofré

Overview of this book

Table of Contents (15 chapters)
Mastering Apache Camel
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Bean and method bindings


During step 2, when the BeanProcessor selects the method to invoke, the message/method bindings can occur in different ways. Camel tries the following steps to resolve the bean method:

  1. If the incoming message (in message) contains the CamelBeanMethodName header, then this method is invoked, converting the in message body to the type of the method's argument.

  2. You can specify the method name directly in the route definition (on the bean endpoint).

  3. If the bean contains a method annotated with @Handler, then this method is invoked.

  4. If the bean can be converted to a processor (containing the process() method), we fall back to the regular processor usage as seen in the previous chapter.

  5. If the body of the in message can be converted to a org.apache.camel.component.bean.BeanInvocation component, then it's the result of the getMethod() method, which is used as the method name.

  6. Otherwise, the body type of the in message is used to find a matching method.

Several exceptions can occur...