I've been thinking more along these lines:

class ReadMail {

    public Response read(...) {

       MailBean bean = new MailBean();
       new Thread().run(new MyRouteWrapper(bean));
       // block on the current thread
       bean.waitTillDone();



    }

    private MyRouteWrapper implements Runnable {
        // here goes your mail route
// the last part of this route will call a MailBean method which will unblock a waiting readMail thread

    }
}

Something like that...

Cheers, Sergey

On 22/07/13 13:00, traviskds wrote:
Thanks for responding Sergey.

I assume you mean adding the "to" part of the route.

I did this

                        camelContext.addRoutes(new RouteBuilder() {
                                public void configure() throws Exception {
                                        
from(MAIL_ENDPOINT_URI).routeId("myRoute")
                                        .bean(mailBean, "processMail")
                                        .to("log:mail");
                                }
                        });

and no impact. Then I did this

                        camelContext.addRoutes(new RouteBuilder() {
                                public void configure() throws Exception {
                                        
from(MAIL_ENDPOINT_URI).routeId("myRoute")
                                        .to("bean:mailBean?method=processMail");
                                }
                        });

and no impact. Note I registered the bean using SimpleRegistry before adding
it to the route in the 2nd set of code.

But in both instances, and even in my original code when I have
Thread.sleep(10000); it works.

I am really stuck at this point as what I plan to do is provide JAX-RS
services as an API Gateway and use Camel for various backend integration and
if I cannot have Synchronous calls in JAX-RS, it is a show stopper for my
use cases.

In the Camel In Action book, in page 97-98, Service Activator Pattern, I was
under the impression when the BeanProcessor is used, then it will make a
Synchronous call.

I think maybe I am not understanding this correctly.

Any help is appreciated.






--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Consumer-in-JAX-RS-Web-Service-tp5735968p5736023.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to