Thanks Claus. For anyone else interested I just added: public void process(Exchange exchange) { camelContext.getInflightRepository().remove(exchange); etc etc
And all works well. On Mon, Dec 13, 2010 at 5:39 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > When you stop a route from within the same route you have to deal with > this. > > You need to unregister the current exchange from the inflight registry > so Camel knows there are no inflight exchanges while it performs > graceful shutdown. > Camel in Action chapter 13 shows how to do this. > > > On Fri, Dec 10, 2010 at 6:01 PM, jburkhardt <jburkha...@gmail.com> wrote: > > > > I have a route setup that looks like this: > > <route id="requestor"> > > <from uri="bean:generateRequest"/> > > <to uri="jms:topic:request_topic"/> > > <to uri="stream:out"/> > > <to uri="bean:shutdownRequestor"/> > > </route> > > > > It's purpose is to run once at startup to get an intial value (in this > > example I just have sending to out instead of doing anything with the > reply) > > and never run again. > > > > The shutdownRequestor bean has a handler that looks like this: > > public void process() { > > List<RouteDefinition> routes = camelContext.getRouteDefinitions(); > > for(RouteDefinition tRoute: routes) { > > if (tRoute.getId().equals(routeToShutdown)) { > > try { > > camelContext.stopRoute(tRoute); > > } catch (Exception e) {} > > } > > } > > } > > > > routeToShutdown and camelContext are injected prior to it running. > > > > This worked fine in 2.4.0. > > In 2.5.0, I send the request and receive the reply as expected, but when > > calling the shutdownRequestor bean the callback.done(false) call in > > ReplyManagerSupport.processReply hangs until the timeout is hit on the > > correlation map. Once the timeout is hit onTimeout in the reply handler > > gets called and it goes back to processReply and removes the id from the > > correlation map. Then as expected camel tries to redeliver the exchange > and > > it spins complaining the correlation id isn't in the correlation map. > > If I remove the shutdownRequestor bean from the route then as expected it > > happily continues requesting/receiving responses forever. > > > > Perhaps the whole way I was going about implementing a "run once" route > is > > wrong to begin with. Is there a suitable way to do this that will work > with > > the new 2.5.0 async request/reply? > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/issue-stopping-a-jms-request-reply-route-after-upgrading-to-2-5-0-tp3300620p3300620.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ >