public interface StreamingHttpClient extends HttpClient
HttpClient
that supports streaming responses.DEFAULT_ERROR_TYPE
Modifier and Type | Method and Description |
---|---|
static StreamingHttpClient |
create(URL url)
Create a new
StreamingHttpClient . |
static StreamingHttpClient |
create(URL url,
HttpClientConfiguration configuration)
Create a new
StreamingHttpClient with the specified configuration. |
<I> Publisher<ByteBuffer<?>> |
dataStream(HttpRequest<I> request)
Request a stream of data where each emitted item is a
ByteBuffer instance. |
<I> Publisher<ByteBuffer<?>> |
dataStream(HttpRequest<I> request,
Argument<?> errorType)
Request a stream of data where each emitted item is a
ByteBuffer instance. |
<I> Publisher<HttpResponse<ByteBuffer<?>>> |
exchangeStream(HttpRequest<I> request)
Requests a stream data where each emitted item is a
ByteBuffer wrapped in the HttpResponse object
(which remains the same for each emitted item). |
<I> Publisher<HttpResponse<ByteBuffer<?>>> |
exchangeStream(HttpRequest<I> request,
Argument<?> errorType)
Requests a stream data where each emitted item is a
ByteBuffer wrapped in the HttpResponse object
(which remains the same for each emitted item). |
<I> Publisher<Map<String,Object>> |
jsonStream(HttpRequest<I> request)
Perform an HTTP request and receive data as a stream of JSON objects as they become available without blocking.
|
<I,O> Publisher<O> |
jsonStream(HttpRequest<I> request,
Argument<O> type)
Perform an HTTP request and receive data as a stream of JSON objects as they become available without blocking.
|
<I,O> Publisher<O> |
jsonStream(HttpRequest<I> request,
Argument<O> type,
Argument<?> errorType)
Perform an HTTP request and receive data as a stream of JSON objects as they become available without blocking.
|
default <I,O> Publisher<O> |
jsonStream(HttpRequest<I> request,
Class<O> type)
Perform an HTTP request and receive data as a stream of JSON objects as they become available without blocking.
|
<I> Publisher<ByteBuffer<?>> dataStream(@NonNull HttpRequest<I> request)
ByteBuffer
instance.I
- The request body typerequest
- The requestPublisher
that emits a stream of ByteBuffer
instances<I> Publisher<ByteBuffer<?>> dataStream(@NonNull HttpRequest<I> request, @NonNull Argument<?> errorType)
ByteBuffer
instance.I
- The request body typerequest
- The requesterrorType
- The type that the response body should be coerced into if the server responds with an errorPublisher
that emits a stream of ByteBuffer
instances<I> Publisher<HttpResponse<ByteBuffer<?>>> exchangeStream(@NonNull HttpRequest<I> request)
ByteBuffer
wrapped in the HttpResponse
object
(which remains the same for each emitted item).I
- The request body typerequest
- The HttpRequest
Publisher
that emits a stream of ByteBuffer
instances wrapped by a HttpResponse
<I> Publisher<HttpResponse<ByteBuffer<?>>> exchangeStream(@NonNull HttpRequest<I> request, @NonNull Argument<?> errorType)
ByteBuffer
wrapped in the HttpResponse
object
(which remains the same for each emitted item).I
- The request body typerequest
- The HttpRequest
errorType
- The type that the response body should be coerced into if the server responds with an errorPublisher
that emits a stream of ByteBuffer
instances wrapped by a HttpResponse
<I> Publisher<Map<String,Object>> jsonStream(@NonNull HttpRequest<I> request)
Perform an HTTP request and receive data as a stream of JSON objects as they become available without blocking.
The downstream Subscriber
can regulate demand via the subscription
I
- The request body typerequest
- The HttpRequest
to executePublisher
that emits the full HttpResponse
object<I,O> Publisher<O> jsonStream(@NonNull HttpRequest<I> request, @NonNull Argument<O> type)
Perform an HTTP request and receive data as a stream of JSON objects as they become available without blocking.
The downstream Subscriber
can regulate demand via the subscription. Incoming data
is buffered.
I
- The request body typeO
- The response typerequest
- The HttpRequest
to executetype
- The type of object to convert the JSON intoPublisher
that emits the full HttpResponse
object<I,O> Publisher<O> jsonStream(@NonNull HttpRequest<I> request, @NonNull Argument<O> type, @NonNull Argument<?> errorType)
Perform an HTTP request and receive data as a stream of JSON objects as they become available without blocking.
The downstream Subscriber
can regulate demand via the subscription. Incoming data
is buffered.
I
- The request body typeO
- The response typerequest
- The HttpRequest
to executetype
- The type of object to convert the JSON intoerrorType
- The type that the response body should be coerced into if the server responds with an errorPublisher
that emits the full HttpResponse
objectdefault <I,O> Publisher<O> jsonStream(@NonNull HttpRequest<I> request, @NonNull Class<O> type)
Perform an HTTP request and receive data as a stream of JSON objects as they become available without blocking.
The downstream Subscriber
can regulate demand via the subscription
I
- The request body typeO
- The response typerequest
- The HttpRequest
to executetype
- The type of object to convert the JSON intoPublisher
that emits the full HttpResponse
objectstatic StreamingHttpClient create(@Nullable URL url)
StreamingHttpClient
.
Note that this method should only be used outside of the context of a Micronaut application.
The returned StreamingHttpClient
is not subject to dependency injection.
The creator is responsible for closing the client to avoid leaking connections.
Within a Micronaut application use Inject
to inject a client instead.create
in interface HttpClient
url
- The base URLstatic StreamingHttpClient create(@Nullable URL url, @NonNull HttpClientConfiguration configuration)
StreamingHttpClient
with the specified configuration. Note that this method should only be used
outside of the context of an application. Within Micronaut use Inject
to inject a client insteadcreate
in interface HttpClient
url
- The base URLconfiguration
- the client configuration