4 Using beans with Camel

 

This chapter covers

  • Calling Java beans with Camel
  • Understanding the Service Activator EIP
  • How Camel looks up beans using registries
  • How Camel selects bean methods to invoke
  • Using bean parameter bindings
  • Using Java beans as predicates or expressions in routes

If you’ve been developing software for many years, you’ve likely worked with various component models, such as CORBA, EJB, JBI, SCA, and lately OSGi. Some of these, especially the earlier ones, imposed a great deal on the programming model, dictating what you could and couldn’t do, and they often required complex packaging and deployment procedures. This left the everyday programmer with a lot of concepts to learn and master. In some cases, much more time was spent working around the restrictive programming and deployment models than on the business application itself.

4.1 Using beans the hard way and the easy way

4.1.1 Invoking a bean from pure Java

4.1.2 Invoking a bean defined in XML DSL

4.1.3 Using beans the easy way

4.2 Understanding the Service Activator pattern

4.3 Using Camel’s bean registries

4.3.1 JndiRegistry

4.3.2 SimpleRegistry

4.3.3 ApplicationContextRegistry

4.3.4 OsgiServiceRegistry and BlueprintContainerRegistry

4.3.5 CdiBeanRegistry

4.4 Selecting bean methods

4.4.1 How Camel selects bean methods

4.4.2 Camel’s method-selection algorithm

4.4.3 Some method-selection examples

4.4.4 Potential method-selection problems

4.4.5 Method selection using type matching

4.5 Performing bean parameter binding

4.5.1 Binding with multiple parameters

4.5.2 Binding using built-in types

4.5.3 Binding using Camel annotations

4.5.4 Binding using Camel language annotations

4.5.5 Parameter binding using method name with signature

4.6 Using beans as predicates and expressions

4.6.1 Using beans as predicates in routes

4.6.2 Using beans as expressions in routes

4.7 Summary and best practices