Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] AsyncContentProvider under-documented

Hi,

On Sat, Jan 31, 2015 at 7:34 PM, John Gardiner Myers
<jgmyers@xxxxxxxxxxxxxx> wrote:
> On 1/31/15 9:26 AM, Simone Bordet wrote:
>>
>> Hi,
>>
>> On Thu, Jan 29, 2015 at 7:11 AM, John Gardiner Myers
>> <jgmyers@xxxxxxxxxxxxxx> wrote:
>>>
>>> I need to implement an AsyncContentProvider,
>>
>> Why ?
>
> Both existing implementations consume an arbitrary amount of memory if the
> destination is slower than the producer of content. I need to limit the
> production of content to not much more than what is being consumed.

This is not true.
DeferredContentProvider (an AsyncContentProvider implementation) is
used by the ProxyServlet, and it applies backpressure correctly.

> I would also like the producer to be optionally asynchronous, so when it is
> rate limited I would want it to later be notified when it should start
> producing content again.

I don't understand this.
If you are talking in the context of a client sending data, then the
production of data, the rate limitation, and the notification of more
production are all things the application must do, not an
implementation of an http client.
Can you detail ?

> For cases where the producer can only produce the data once, I want to be
> able to retry the request to a second server in case the connection to a
> first server fails. To do that, I need to delay the production of content
> until the ContentProvider.iterator() method is called. (I am presuming Jetty
> client doesn't call that method until the connection succeeds.)

I don't understand this.
Why is not DeferredContentProvider enough for this case ?

> The primary use case I have is to stream data in from Jetty server through
> Jersey 2 and out through Jetty client.

Can you detail how this setup work ?
It's not clear to me if you refer to the Jersey2 client or server, and
what has a HttpClient to do with all this ?

Thanks.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.


Back to the top