You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Björn Bength <bj...@gmail.com> on 2013/09/16 10:45:36 UTC

jetty and disconnected clients

Hi,

We have got a use case where we need to mark a downloaded message as
"downloaded"
and right now our implementation logic is using camel to do essentially
this:


from("jetty:http://server/url")
.... lots of logic
   .to("direct:fetch");

from("direct:fetch")
   .onCompletion()
        .beanRef("messageLogService", "messageFetched(${property.entry})")
   .end()
.beanRef("messageLogService", "fetchMessage(${property.entry})")
.convertBodyTo(InputStream.class);


We're streaming the message to the client and we really need to
be able to catch when the client disconnects and won't be able to
receive the complete message.
Then our exception handler should kick in and mark the message dirty again.

It works perfectly when client reads all content,
but sadly it still is marked "fetched" when client is forcefully
disconnected.

Is it possible to know when jetty client connection disconnects?
And have the entire exchange, and it's sub-routes, cancelled?

Re: jetty and disconnected clients

Posted by Claus Ibsen <cl...@gmail.com>.
Can you give a try with Camel 2.12.0 as we have extended camel-jetty
and other HTTP related components to handle the UoW in their consumer
which then ought to trigger a UoW failure if jetty can't stream back
the reply correctly.

On Mon, Sep 16, 2013 at 10:45 AM, Björn Bength <bj...@gmail.com> wrote:
> Hi,
>
> We have got a use case where we need to mark a downloaded message as
> "downloaded"
> and right now our implementation logic is using camel to do essentially
> this:
>
>
> from("jetty:http://server/url")
> .... lots of logic
>    .to("direct:fetch");
>
> from("direct:fetch")
>    .onCompletion()
>         .beanRef("messageLogService", "messageFetched(${property.entry})")
>    .end()
> .beanRef("messageLogService", "fetchMessage(${property.entry})")
> .convertBodyTo(InputStream.class);
>
>
> We're streaming the message to the client and we really need to
> be able to catch when the client disconnects and won't be able to
> receive the complete message.
> Then our exception handler should kick in and mark the message dirty again.
>
> It works perfectly when client reads all content,
> but sadly it still is marked "fetched" when client is forcefully
> disconnected.
>
> Is it possible to know when jetty client connection disconnects?
> And have the entire exchange, and it's sub-routes, cancelled?



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen