Ryan Schmitt created HTTPCLIENT-1943:
----------------------------------------
Summary: 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
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]