Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Annotation

Meaning

Parameter

@Body

To bind to an inbound message body

 

@ExchangeException

To bind to an Exception set on the exchange (Camel 2.0)

 

@Header

To bind to an inbound message header

String name of the header

@Headers

To bind to the Map of the inbound message headers

 

@OutHeaders

To bind to the Map of the outbound message headers

 

@Property

To bind to a named property on the exchange

String name of the property

@Properties

To bind to the property map on the exchange

 

@Handler

Camel 2.0: Not part as a type parameter but stated in this table anyway to spread the good word that we have this annotation in Camel now. See more at Bean Binding.

 

The follow annotations @Headers, @OutHeaders and @Properties binds to the backing java.util.Map so you can alter the content of these maps directly, for instance using the put method to add a new entry. See the OrderService class at Exception Clause for such an example. Since Camel 2.0, you You can use @Header("myHeader") and @Property("myProperty") instead of @Header(name="myHeader") and @Property(name="myProperty") as Camel 1.x does to access the backing java.util.Map.

Example

In this example below we have a @Consume consumer (like message driven) that consumes JMS messages from the activemq queue. We use the @Header and @Body parameter binding annotations to bind from the JMSMessage to the method parameters.

...

Code Block
    public void doSomething(@Header("user") String user, @Body String body, Exchange exchange) {
        exchange.getIn().setBody(body + "MyBean");
    }
Include Page
CAMEL:Annotation Based Expression LanguageCAMEL:
Annotation Based Expression Language