camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Arias Ramirez <dar...@koghi.com>
Subject send reply body after finishing complete route
Date Mon, 21 Nov 2016 15:29:25 GMT
Hi, I'm trying to make a synchronous call to an activemq sending a body
right after I process some rest service invocation. Here is my code:

some process here.. sent to this route.

private String velocitySetThirdPartyTemplate =
"velocity:file://url/velocity/file/SetThirdParty_Template.vm";

from("direct:QueueThirdParty")
                .process(new ProcessThirdPartyError())
                .marshal()
                .xstream("UTF-8")
// wait for the body when the response of the Web Service is 200 ok
                .to(ExchangePattern.InOut,"jms:queue:CreateThirdParty")
                .to("activemq:queue:somequeue");

from("jms:queue:CreateThirdParty")
                .transacted()
                .unmarshal()
                .xstream()
                .process(new SetBodyThirdParty())->this route define body
as an ArrayList of Pojo
                .split(body())
                .to(velocitySetThirdPartyTemplate)->this velocity make the
json required for the Web Service
                .process(new RestHeadersSetThirdParty())
                .to("restlet:<a href="http://ip:port
/Web/Service/url">http://ip:port/Web/Service/url"
                                        +
"?restletMethod=post&throwExceptionOnFailure")
                .process(new ResponseProcess())
                .log("response ${in.body.getStatus().getCode()}")
                .process(new SetExchangeInOutBody()); -> this final process
set the body that I want to                                            send
to the activemq in that is waiting for the reply.

the problem is that the body that is sending to the end point
"activemq:queue:somequeue" after waiting for a reply is the ArrayList of
POJO before the split.

Any Idea of how to send the body of the ".process(new
SetExchangeInOutBody());" that is the one I need.

Thanks in advance.

Daniel Felipe Arias.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message