Well using queues is typically used for asynchronous (or non-blocking) conversations. The route doing the persistence would have to publish an event that signifies "persistence has completed" ... and your first route block until you've received that (a sort of "request-reply" of sorts).
On Wed, Oct 30, 2013 at 3:29 AM, geoffreydv <geoffre...@gmail.com> wrote: > Hello, > > I was wondering if something I have in mind is possible using Camel. > > Our projects needs a route to listen for jms messages, then persist > something to the database in a custom bean using another route and only > continue the first route once the item has been successfully persisted. > > I was hoping something like this would work: > > <route id="handle-requests"> > <from uri="activemq:incoming-request"/> > <bean ref="randomBean" method="doSomething"/> > <to uri="activemq:persist-request"/> > <bean ref="itemPersistedActivator" method="doSomething"/> > </route> > > <route id="persist-request"> > <from uri="activemq:persist-request"/> > <bean ref="requestPersister" method="persistRequest"/> > </route> > > What I need is the itemPersistedActivator bean's method to only be called > when the request has been persisted to the database. I have simulated a > waiting time in the requestPersister (5 seconds). Currently the route > continues as the message has been dispatched. > > Any ideas on this? > Thanks > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Waiting-for-a-bean-to-finish-before-continuing-route-tp5742398.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- *Christian Posta* http://www.christianposta.com/blog twitter: @christianposta