abrams
abrams

Reputation: 19

How to modify camel Exchange and send it

I am using camel to get JSON data from REST API and then send it to ActiveMQ. Between these 2 steps I would like to modify the data - map it to different object to be clear. How can I achieve that ?

    @Override
    public void configure() {
        from("timer?period=2000")
                .to(sourceUrl)
//IS IT POSSIBLE TO MODIFY DATA HERE ?
                .inOnly("activemq:" + targetQueue + "?jmsMessageType=Text")
        .log("Sent!");
    }

Upvotes: 0

Views: 554

Answers (1)

Qwerky
Qwerky

Reputation: 18455

Sounds like a data transformation; have you looked at https://camel.apache.org/message-translator.html

The simplest way would be to use a processor;

.to(sourceUrl)
.process(processor)
.inOnly("activemq:" + targetQueue + "?jmsMessageType=Text")

Upvotes: 3

Related Questions