I'm looking for options for achieving this using Camel. 

1. HTTP Client sends a request to my server. 
2. HTTP Controller gets the request, extracts the parameters,  send a
request to "direct:start" using a producer template. 

handleHTTPRequest()
{
.....
                ProducerTemplate template =
ctxAware.getCamelContext().createProducerTemplate();
                template.request("direct:start", new MyCustomProcessor()); 
......
}

My route- 
        from("direct:start")
                                .to("https://some_external_url";)
                                .unmarshal()
                                .json(JsonLibrary.Jackson, ResponseObject.class)
                                .bean(Splitter.class, "splitResponse")
                                .bean(EmbeddedDroolsRuleEngine.class,
"callRuleEngine");

*ASSUMPTION 1: The controller blocks till the route is finished. Is this
assumption correct ? 
*

3. EmbeddedDroolsRuleEngine#callRuleEngine method does some processing (in
this case filtering based on some rules) on the messages. I need to send
these filtered messages back to the HTTP client. 

My question is - 
once the route is over the control returns back to  the controller if my
ASSUMPTION 1 is correct. 

At this point I want to wait for my results of callRuleEngine method and
somehow get those objects so that I can use it to send a response back to
the client. 



My current idea is to have a EmbeddedDroolsRuleEngine#callRuleEngine write
the results to a queue and then I can have a ConsumerTemplate read from this
queue. But I'm not sure how good a solution this is. 

Any ideas about how to get this done would be appreciated? 


Thanks. 

--
View this message in context: 
http://camel.465427.n5.nabble.com/Options-for-achieving-this-in-Camel-running-inside-Tomcat-or-Jetty-tp5700775.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to