On Thu, Apr 5, 2012 at 11:57 AM, Sameer Apte <aptesam...@gmail.com> wrote: > Any one answering this question please??? > I have run into exactly same problem. What I am trying to do is expose a > jetty endpoint which will receive post requests from client and push the > message on queue after converting body to string. And obviously it works > fine. > > Route definition looks like below: > > /*from(jettyUrl) > .transacted() > .inOnly() > .to(activemq) > .end()*/ > > The problem is when broker is down I want to return 500 straight away. > However, what happens is if broker is down then http client keeps on waiting > for outcome rather than getting 500. > So obviously at some stage client will kill the connection thinking that it > is not working and when broker is up again, message appears on queue again. >
ActiveMQ uses failover and async sending. You need to configure this with AMQ to let it fail if it cannot send the message right away. See the AMQ documentation. And it does not make sense to use transaction if JMS is the only resource involved and you send to a single queue only. Transactions is really only supported when the component supports transaction by nature, such as JDBC and JMS. Any other components dont really support transactions. > I believe problem is with the way I have used inOnly() above . > Probably it should be inOut() in this case which obviously I have tried. > What happens with inOut() is, camel sends a message to queue and expects > reply back on some in-memory temporary queue. It times out eventually > because there is no one to send ack on that queue and fails eventually. > On failure, message gets moved to dead letter queue as per the handler > registered and client receives 200. > > Any suggestions/comments? > [I am fighting the battle to prove camel is a good choice so please be > quick. :-) ] > > -Sameer > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Jetty-as-consumer-in-synchronous-mode-tp5614463p5619967.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/