public final class AwsCrtResponseBodyPublisher extends Object implements org.reactivestreams.Publisher<ByteBuffer>
| Constructor and Description |
|---|
AwsCrtResponseBodyPublisher(software.amazon.awssdk.crt.http.HttpClientConnection connection,
software.amazon.awssdk.crt.http.HttpStream stream,
CompletableFuture<Void> responseComplete,
int windowSize)
Adapts a streaming AWS CRT Http Response Body to a Publisher
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
completeSubscriptionExactlyOnce()
Completes the Subscription by calling either the .onError() or .onComplete() callbacks exactly once.
|
protected void |
publishToSubscribers()
Publishes any queued data to any Subscribers if there is data queued and there is an outstanding Subscriber
request for more data.
|
void |
queueBuffer(byte[] buffer)
Adds a Buffer to the Queue to be published to any Subscribers
|
protected void |
request(long n)
Function called by Response Body Subscribers to request more Response Body buffers.
|
protected void |
setCancelled() |
void |
setError(Throwable t) |
void |
setQueueComplete()
Called when the final Buffer has been queued and no more data is expected.
|
void |
subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber)
Method for the users consuming the Http Response Body to register a subscriber.
|
public AwsCrtResponseBodyPublisher(software.amazon.awssdk.crt.http.HttpClientConnection connection,
software.amazon.awssdk.crt.http.HttpStream stream,
CompletableFuture<Void> responseComplete,
int windowSize)
stream - The AWS CRT Http Stream for this ResponsewindowSize - The max allowed bytes to be queued. The sum of the sizes of all queued ByteBuffers should
never exceed this value.public void subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber)
subscribe in interface org.reactivestreams.Publisher<ByteBuffer>subscriber - The Subscriber to register.public void queueBuffer(byte[] buffer)
buffer - The Buffer to be queued.protected void request(long n)
n - The number of buffers requested.public void setError(Throwable t)
protected void setCancelled()
public void setQueueComplete()
protected void completeSubscriptionExactlyOnce()
protected void publishToSubscribers()
Copyright © 2022. All rights reserved.