Skip to content

Instantly share code, notes, and snippets.

@olegchir
Created July 9, 2018 15:50
Show Gist options
  • Save olegchir/951aa59305e158f019017be9316b8eba to your computer and use it in GitHub Desktop.
Save olegchir/951aa59305e158f019017be9316b8eba to your computer and use it in GitHub Desktop.
rest("/api/")
.id("api-route")
.consumes("application/json")
.post("/bean")
.bindingMode(RestBindingMode.json_xml)
.type(MyBean.class)
.to("direct:remoteService");
//...
from("direct:remoteService")
.routeId("direct-route")
.tracing()
.log(">>> ${body.id}")
.log(">>> ${body.name}")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
MyBean bodyIn = (MyBean) exchange.getIn().getBody();
ExampleServices.example(bodyIn);
exchange.getIn().setBody(bodyIn);
}
})
.setHeader(Exchange.HTTP_RESPONSE_CODE, constant(200));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment