...
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 } } |
In the above you can now pass the Camel will extract the value of Message.getJMSCorrelationID() as a parameter to the method (, then using the Type Converter to adapt the value to the type of the parameter if required - it will inject the parameter value for the correlationID parameter. Then the payload of the message will be converted to a String and injected into the body parameter).
Finally you You don't need to use the @MessageDriven annotation; as you could use the Camel route could describe which method to invoke. DSL to route to the beans method
e.g. a route could look like
...