[
https://issues.apache.org/jira/browse/HTTPCLIENT-1943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16583714#comment-16583714
]
Oleg Kalnichevski commented on HTTPCLIENT-1943:
-----------------------------------------------
[~rschmitt] Ryan, this looks correct to me.
There is a server side request handler that demonstrates fully asynchronous
response streaming but client side works exactly the sameway
[https://github.com/apache/httpcomponents-core/blob/master/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/nio/EchoHandler.java]
I am currently working on javadocs for core classes. Please feel free to have a
look and help me improve it
[https://github.com/ok2c/httpcore/tree/api_javadocs]
Oleg
> 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: [email protected]
For additional commands, e-mail: [email protected]