combine JSON service responses using Camel -
i have 2 resource based services returning data in json format.
the first 1 order service returns order details.this contains orderid , list of products including product id , quantity.
the other product service returns product details(description,unit price) of product productid passed input it.
i want combine these 2 services using camel route, route response order details along product details (description,unitprice,quantity,quantity * unitprice) of each product in order.
since both services separately return json not sure how can combine them both return final result.
i think have convert each of services's json response java objects , compute details required , using pojo , convert response json , return result.
but, not sure if right approach camel or there way use indivdual json responses directly , combine them , return responses .
can me on this.
you should use content-enrich pattern claus suggested , aggregate response product service body of response order service.
from("direct:in") .to("http://order.service:8080") .enrich(simple("http:product.service/?productids=${header.productids}"), new orderproductaggregationstrategy());
Comments
Post a Comment