Apache Camel REST DSL - Validating Request Payload and return error response
I am exposing a rest service using "CamelHttpTransportServlet" that receive orders and place in jms queue. The code works fine on happy path and returns 200 response. I have written Processor to validate the input JSON, and set http_response_code based on the input. The issue is - for invalid requests though failure response code - 400 is set, the flow continues to the next route and pushes the data to the queue instead of sending the 400 response back to the calling app. rest("/ordermanagement") .post("/order").to("direct:checkInput"); from("direct:checkInput") .process(new Processor() {