[undertow-dev] asynchronous cassandra queries

Stuart Douglas sdouglas at redhat.com
Fri May 23 14:34:51 EDT 2014


You need to call the version with no arguments, or the one that dispatches to a Runnable (which is not well named, I think I will change it to detach() or suspend(), its current name came about just because internally it works the same as the other dispatch method calls).

When Undertow is running a handler chain then it will always end the exchange when the call stack completes unless dispatch() has been called, in your case you immediately dispatched another handler chain, so when that handler returned the exchange will be ended.

Stuart

----- Original Message -----
> From: "Adrian" <agbauer at gmail.com>
> To: "Stuart Douglas" <sdouglas at redhat.com>
> Cc: undertow-dev at lists.jboss.org
> Sent: Friday, 23 May, 2014 1:19:10 PM
> Subject: Re: [undertow-dev] asynchronous cassandra queries
> 
> Really? I tried dispatch(this) and dispatching to a separate thread pool I
> created. In both cases exchange.isComplete() returned true in my Cassandra
> listener and writing response data resulted in an exception.
> On May 23, 2014 11:10 AM, "Stuart Douglas" <sdouglas at redhat.com> wrote:
> 
> > You need to call the HttpServerExchange#dispatch() method, this will stop
> > the exchange from ending when the call stack returns.
> >
> > Stuart
> >
> > ----- Original Message -----
> > > From: "Adrian" <agbauer at gmail.com>
> > > To: undertow-dev at lists.jboss.org
> > > Sent: Friday, 23 May, 2014 12:21:53 PM
> > > Subject: [undertow-dev] asynchronous cassandra queries
> > >
> > > Hi
> > >
> > > I'm trying to query Cassandra asynchronously from inside an HttpHandler,
> > but
> > > by the time the listener is run, Undertow has closed the response
> > channel.
> > > Is there some way to keep it open? Can you suggest another approach?
> > >
> > > Thanks
> > > Adrian
> > >
> > > _______________________________________________
> > > undertow-dev mailing list
> > > undertow-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/undertow-dev
> >
> 


More information about the undertow-dev mailing list