You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by David Shubert <da...@randstadusa.com> on 2021/05/13 15:21:08 UTC

Handling REST responses when you need to change the exchange body

I want to create a REST endpoint where my processor does some work, creates
a POJO with values I want to return, and puts some other values on a Google
pubsub using that component.

To return the POJO in REST I have to make it the body of the exchange.
However to send something to pubsub I have to convert it to a byte array
and put that into the body of the exchange. This overwrites my REST
response.

I had solved this by using wiretap so that a copy of the message would go
to a processor that would convert the message appropriately and send it to
pubsub while the original message was returned in the REST response.

But our tech lead notes that wiretap creates threads. In an Enterprise
application the worry is that all those threads would become unmanageable.

Does anyone have an idea how to deal with something like this?

-- 
This email message is for the sole use of the intended recipient(s) and may 
contain confidential and privileged information. Any unauthorized review, 
use, disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies 
of the original message.