Hi David, I think you can resolve the issue by having streamcaching.
https://camel.apache.org/manual/stream-caching.html public class MongoDBInsertRouteBuilder extends RouteBuilder { @Override public void configure() { from("jetty:http://0.0.0.0:8081/hello")*.streamCaching()* .log("${body}") .to("mongodb:myDb?database=test&collection=test&operation=insert") .setBody(simple("${body}")); } } Thanks and Regards, Chio Chuan On Thu, Apr 14, 2022 at 1:04 AM David Yang <david.y...@csueastbay.edu> wrote: > [I tried searching for "mongodb" in the archives and didn't see this. > Apologies if > I missed something.] > The insert option of the example at > https://github.com/apache/camel-examples/tree/main/examples/mongodb fails > as is. The problem appears to be that the log() call consumes the body from > the input stream, leaving an empty body for the to(). > The problem is fixed if you move the log() call in > MongoDBInsertRouteBuilder.java to after the to() so the code looks like: > public class MongoDBInsertRouteBuilder extends RouteBuilder { > @Override > public void configure() { > from("jetty:http://0.0.0.0:8081/hello") > > .to("mongodb:myDb?database=test&collection=test&operation=insert") > .log("${body}") > .setBody(simple("${body}")) > ; > } > } > > David Yang > Computer Science >