...
Annotation | Meaning | Parameter |
---|---|---|
To bind to an inbound message body |
| |
To bind to an inbound message header | String name of the header | |
To bind to the Map of the inbound message headers |
| |
To bind to the Map of the outbound message headers |
| |
To bind to a named property on the exchange | String name of the property | |
To bind to the property map on the exchange |
|
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.
Example
In this example below we have a @MessageDriven consumer 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.For example:
Code Block |
---|
public class Foo { @MessageDriven(uri = "activemq:my.queue") public void doSomething(@Header('JMSCorrelationID') String correlationID, @Body String body) { // process the inbound message here } } |
...