Reputation: 41
rest("/getOptChoice").
get("/v1")
.consumes("application/json")
.to("direct:hello")
.produces("application/json");
from("direct:hello")
.split(header("emails"))
.to("seda:consumeGuestChoice")
.aggregate(constant(true),new OptAggregator())
.completionSize(2)
.marshal(jaxb)
.convertBodyTo(String.class);
After converting the body, if i do print the exchange body, i see the payload. But the HTTP response from the rest service is always empty.
Has someone faced this issue before? If so, is there a work-around?
Upvotes: 3
Views: 2349
Reputation: 3055
If you write :
from("direct:hello")
.split(header("emails"), new OptAggregator())
.to("seda:consumeGuestChoice")
.end()
.marshal(jaxb)
.convertBodyTo(String.class);
It may work. Is it ?
Upvotes: 0
Reputation: 814
You might need to enable stream caching in your route: http://camel.apache.org/stream-caching.html
It allows the body to be read multiple times for these stream-backed components.
from("direct:hello")
.streamCaching()
.split(header("emails"))
.to("seda:consumeGuestChoice")
.aggregate(constant(true),new OptAggregator())
.completionSize(2)
.marshal(jaxb)
.convertBodyTo(String.class);
Upvotes: 1