You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kent Närling <ke...@seamless.se> on 2009/10/23 16:29:46 UTC

Re: Is there any way to get a callback when the response has been sent all the way to the client? ie "commit after response"?

2009/10/22 Daniel Kulp <dk...@apache.org>

> On Thu October 22 2009 3:31:15 am Kent Närling wrote:
> > In a CXF webservice implementation on the server, is there any way of
> being
> > able to log/track wether the client received the response?
> >
> > eg. to only do a final commit on a transaction after the response has
> been
> > sent in full to the client?
> >
> > I know this would never be perfect, but it should be at least
> theoretically
> > possible to detect if the client closed the connection before sending the
> > response?
>
> Most likely, the best option is to write an interceptor that would live
> PRE_STREAM phase that would take the OutputStream and wrapper it with a new
> one that would override close() to do the commit.      Catch all the
> IOExceptions and such in the writes to rollback and such. That's probably
> the
> best option.
>

Thanks, good ideas!

But do you imagine that this is even robust to do like this for transaction
integrity?
For instance, if we rollback the transactions when getting an exception in
the stream, I feel that we might rollback transactions even though the
client actually got the response etc? eg if it terminates the connection
before reading the last byte or so etc
Is there any realistic/robust way for this interceptor to know wether the
exception occurred before the full SOAP body was sent?

In a way, my gut feeling tells me that we should not do this and instead
delegate part of the responsibility to the client to solve this problem.
Would you agree to this feeling?

The reason for this desire is that the client side wants give up waiting for
the response after a timeout (and then close the connection)...


> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>



-- 
Kent Närling

Solutions Manager
SEAMLESS
Dalagatan 100, 8 tr, 113 43 Stockholm, Sweden
Phone: +46 8 5648 7800, fax: +46 8 5648 7823
Mobile: +46 70 836 9925
Mail: kent.narling@seamless.se
www.seamless.se