Hey,
I bumped into this one today and not sure if this is a bug or a feature :).
The example is in SpringBoot application, if that makes any difference
Given this route:
from("direct:bugOrFeature")
.to("bean:mybean?method=transform");
and the bean method:
public String transform(@Body String in)
{
return "I want to change the body!";
}
if I call it like this:
String result =
template.request("direct:bugOrFeature",
e -> e.getIn().setBody("Some input"))
.getIn()
.getBody(String.class);
logger.info("result: {}", result);
Then it prints out the old value:
> result: Some input
However if I stick a dummy processor at the end of the route
from("direct:bugOrFeature")
.to("bean:camelMaintenanceRoutes?method=transform")
.process(e -> {});
then suddenly the same call gives me the new value
> result: I want to change the body!
Is this a bug or am I missing something?
Note that if I request for a body like this:
template
.requestBody("direct:bugOrFeature", "some input", String.class)
then it get's the 'new' value without the dummy processor.
The thing is that I need to get out some headers from response, so I need
Exchange object and not just the body.
Best,
Artur