Reputation: 4004
In my camel project, i need to send some message to a gateway (which will receive it as a JMS message).
For gateway, besides the message text, there will be some other string properties using jmsMessage.getStringProperty("xxx");
In my camel project, my code is something like below:
@Produce(uri = "xxx")
private ProducerTemplate template;
@Override
public void sendToQueue(String textMessage, Map<String, String> properties) {
template.sendBody(textMessage);
}
I know if I just send a string text message I will invoke the sendBody method which receive one argument. I just wondering how should I sent the properties using camel and on the other side they can receive the properties as JMS TextMessage string properties.
Also what's the meaning for camel headers, it's also a map.
Upvotes: 1
Views: 3548
Reputation: 55540
You can use
template.sendBodyAndHeaders(textMessage, properties);
As JMS properties is mapped to Camel Message headers. And hence why you can use the sendBodyAndHeaders
method to include the JMS properties.
Upvotes: 2