1

I'm requesting to https://xx.xx.x.xxx/consumers/ domain and I'm getting some response data as JSON format, and I'm passing it another endpoint direct:consumer, but in direct:consumer endpoint if print body I'm getting empty, could anyone help me how to transfer the data from one endpoint to another endpoint.

from("timer://runOnce?repeatCount=1")
.process(consumerCreate)
.to("https://xx.xx.x.xxx/consumers/").log("response data from create:: ${body}")
.to("direct:consumer");

In the below endpoint, if print the body getting an empty response, not getting JSON data

from("direct:consumer").log("the body is ${body} ");

Can anyone please help me is it expected behaviour or am I missing something?

1 Answers1

0

Take a look at enabling steam caching:

https://camel.apache.org/manual/latest/stream-caching.html

Without it, the stream returned by http producer can only be read once, e.g in the first log message. Hence why nothing is printed in the second direct:consumer route when it comes to log the message body.

James Netherton
  • 1,092
  • 1
  • 7
  • 9