You could do this via the CXF continuations and not really consume any 
resources assuming the servlet/jetty you are using supports the continuations.  
 (Servlet 3 based or Jetty)

The client could just make a "get" request as normal.   On the server side, it 
would get the continuation, store it someplace, and suspend the request.  When 
the data is available, it would resume the continuation at which point the data 
can be returned.   

Using CXF 2.6.x, the above is even easier as we can use the Async methods on 
the server side to accomplish it all.  See the jaxws_async example in the kit 
and how it uses the @UseAsyncMethod annotation. 

However, the client side will definitely need to be careful to handle any 
IOExceptions and make another call.   Various timeouts, etc… could happen.

Dan



On Sep 10, 2012, at 9:29 AM, David Mansfield <[email protected]> wrote:

> Hi All,
> 
> Just wondering what the best practice is for having a web service client 
> "wait" for some event that happens server side.
> 
> In my particular case, I need to have a web service along the lines of "get 
> pending transactions" and a new transaction is submitted via a form submit in 
> the web application (servlet), hopefully in the same VM.
> 
> I realize polling is an option of course, but I despise polling and would 
> prefer some kind of blocking-queue type implementation with a blocking "take" 
> in the web service method and a "put" in the servlet during the POST or 
> whatever.
> 
> Some other considerations: it will only ever be _one_ client calling the "get 
> pending transactions" so issues of resource consumption by a blocking call 
> are not relevant.
> 
> Can I simply implement some blocking java code inside my web service method 
> and everything will just work neatly?
> 
> I have read about multiple asynchronous replies to a web-service method and 
> was wondering what that really means and if there are a any references in CXF 
> documentation?
> 
> TIA,
> David Mansfield
> Cobite, INC.

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to