You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2018/08/17 09:58:00 UTC

[jira] [Resolved] (HTTPCLIENT-1943) Add support for truly asynchronous request streaming

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1943?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1943.
-------------------------------------------
    Resolution: Information Provided

> Add support for truly asynchronous request streaming
> ----------------------------------------------------
>
>                 Key: HTTPCLIENT-1943
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1943
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient (async)
>    Affects Versions: 5.0 Beta1
>            Reporter: Ryan Schmitt
>            Priority: Major
>
> I've been trying to figure out how to send asynchronous streaming requests in a way that would be compatible with the reactive streams spec. In the reactive streaming model, the producer pushes data to the consumer; the consumer does not need to poll for it (although it does need to signal its capacity for more data so that the producer does not overwhelm it). I haven't been able to figure out how to do this.
> The closest I've come is by subclassing AbstractBinAsyncEntityProducer and implementing the produceData method. The problem with this approach is that the Apache client seems to poll this method constantly (essentially busy-waiting) until either channel.endStream() is called or an exception is thrown. In order for this to work, I need a way to either push data directly to the StreamChannel or signal to the client that more data is available without having it ask me.
> Another thing I noticed is that if I implement the available() method to return 0, the client stops polling and doesn't start again; it basically stalls the request. It's occurred to me that I might be able to capture the DataStreamChannel (via AsyncEntityProducer#produce) and push data into it from a producer. I'll keep investigating, but it's mostly guesswork at this point, since much of the 5.0 client is not yet documented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org