Apache Camel Converting JSON to JMS

Viewed 194

I am trying to convert information in a route that is in JSON format into JMS format so that I can send it to a topic.

Looking at the docs, I see:

from("activemq:My.Queue").
  marshal().json(JsonLibrary.Jackson).
  to("mqseries:Another.Queue");

Is it correct to interpret here that we have marshalled the message from the queue into JSON, then when sending it to the other queue, it has been converted back to a JMS message? If not, how can we achieve this conversion using the Java DSL? Further, is it possible to add key-value pairs to the JSON along the Camel route?

Thanks.

1 Answers

You can pass any kind of data to a JMS queue. The marshal().json suggests that the data in My.Queue was a java object, which was converted into json format. The Another.Queue queue is receiving a json object.

You can also transform your data anyway you want before passing the data to the consumer.

Related