Interface SseClient
- All Known Implementing Classes:
DefaultHttpClient
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Method Summary
Modifier and TypeMethodDescriptionstatic SseClient
Create a newSseClient
.static SseClient
create
(@Nullable URL url, @NonNull HttpClientConfiguration configuration) Create a newSseClient
with the specified configuration.<I> Publisher<Event<ByteBuffer<?>>>
eventStream
(@NonNull HttpRequest<I> request) Perform an HTTP request and receive data as a stream of SSEEvent
objects as they become available without blocking.eventStream
(@NonNull HttpRequest<I> request, @NonNull Argument<B> eventType) Perform an HTTP request and receive data as a stream of SSEEvent
objects as they become available without blocking.eventStream
(@NonNull HttpRequest<I> request, @NonNull Argument<B> eventType, @NonNull Argument<?> errorType) Perform an HTTP request and receive data as a stream of SSEEvent
objects as they become available without blocking.eventStream
(@NonNull HttpRequest<I> request, @NonNull Class<B> eventType) Perform an HTTP request and receive data as a stream of SSEEvent
objects as they become available without blocking.eventStream
(@NonNull String uri, @NonNull Argument<B> eventType) Perform an HTTP GET request and receive data as a stream of SSEEvent
objects as they become available without blocking.eventStream
(@NonNull String uri, @NonNull Class<B> eventType) Perform an HTTP GET request and receive data as a stream of SSEEvent
objects as they become available without blocking.
-
Method Details
-
eventStream
Perform an HTTP request and receive data as a stream of SSE
Event
objects as they become available without blocking.The downstream
Subscriber
can regulate demand via the subscription- Type Parameters:
I
- The request body type- Parameters:
request
- TheHttpRequest
to execute- Returns:
- A
Publisher
that emits anEvent
with the data represented as aByteBuffer
-
eventStream
<I,B> Publisher<Event<B>> eventStream(@NonNull @NonNull HttpRequest<I> request, @NonNull @NonNull Argument<B> eventType) Perform an HTTP request and receive data as a stream of SSE
Event
objects as they become available without blocking.The downstream
Subscriber
can regulate demand via the subscription- Type Parameters:
I
- The request body typeB
- The event body type- Parameters:
request
- TheHttpRequest
to executeeventType
- The event data type- Returns:
- A
Publisher
that emits anEvent
with the data represented by the eventType argument
-
eventStream
<I,B> Publisher<Event<B>> eventStream(@NonNull @NonNull HttpRequest<I> request, @NonNull @NonNull Argument<B> eventType, @NonNull @NonNull Argument<?> errorType) Perform an HTTP request and receive data as a stream of SSE
Event
objects as they become available without blocking.The downstream
Subscriber
can regulate demand via the subscription- Type Parameters:
I
- The request body typeB
- The event body type- Parameters:
request
- TheHttpRequest
to executeeventType
- The event data typeerrorType
- The type that the response body should be coerced into if the server responds with an error- Returns:
- A
Publisher
that emits anEvent
with the data represented by the eventType argument - Since:
- 3.1.0
-
eventStream
default <I,B> Publisher<Event<B>> eventStream(@NonNull @NonNull HttpRequest<I> request, @NonNull @NonNull Class<B> eventType) Perform an HTTP request and receive data as a stream of SSE
Event
objects as they become available without blocking.The downstream
Subscriber
can regulate demand via the subscription- Type Parameters:
I
- The request body typeB
- The event body type- Parameters:
request
- TheHttpRequest
to executeeventType
- The event data type- Returns:
- A
Publisher
that emits anEvent
with the data represented by the eventType argument
-
eventStream
default <B> Publisher<Event<B>> eventStream(@NonNull @NonNull String uri, @NonNull @NonNull Class<B> eventType) Perform an HTTP GET request and receive data as a stream of SSE
Event
objects as they become available without blocking.The downstream
Subscriber
can regulate demand via the subscription -
eventStream
default <B> Publisher<Event<B>> eventStream(@NonNull @NonNull String uri, @NonNull @NonNull Argument<B> eventType) Perform an HTTP GET request and receive data as a stream of SSE
Event
objects as they become available without blocking.The downstream
Subscriber
can regulate demand via the subscription -
create
Create a newSseClient
. Note that this method should only be used outside of the context of a Micronaut application. The returnedSseClient
is not subject to dependency injection. The creator is responsible for closing the client to avoid leaking connections. Within a Micronaut application useInject
to inject a client instead.- Parameters:
url
- The base URL- Returns:
- The client
-
create
static SseClient create(@Nullable @Nullable URL url, @NonNull @NonNull HttpClientConfiguration configuration) Create a newSseClient
with the specified configuration. Note that this method should only be used outside of the context of an application. Within Micronaut useInject
to inject a client instead- Parameters:
url
- The base URLconfiguration
- the client configuration- Returns:
- The client
- Since:
- 2.2.0
-