CONNECTION - the resource serving the streampublic class DefaultMcpTransportStream<CONNECTION> extends Object implements McpTransportStream<CONNECTION>
McpTransportStream using Project Reactor types.| Constructor and Description |
|---|
DefaultMcpTransportStream(boolean resumable,
Function<McpTransportStream<CONNECTION>,org.reactivestreams.Publisher<CONNECTION>> reconnect)
Constructs a new instance representing a particular stream that can resume using
the provided reconnect mechanism.
|
| Modifier and Type | Method and Description |
|---|---|
org.reactivestreams.Publisher<McpSchema.JSONRPCMessage> |
consumeSseStream(org.reactivestreams.Publisher<reactor.util.function.Tuple2<Optional<String>,Iterable<McpSchema.JSONRPCMessage>>> eventStream)
Allows keeping track of the transport stream of events (currently an SSE stream
from Streamable HTTP specification) and enable resumability and reconnects in case
of stream errors.
|
Optional<String> |
lastId()
The last observed event identifier.
|
long |
streamId()
An internal stream identifier used to distinguish streams while debugging.
|
public DefaultMcpTransportStream(boolean resumable,
Function<McpTransportStream<CONNECTION>,org.reactivestreams.Publisher<CONNECTION>> reconnect)
resumable - whether the stream is resumable and should try to reconnectreconnect - the mechanism to use in case an error is observed on the current
event stream to asynchronously kick off a resumed stream consumption, potentially
using the stored lastId().public Optional<String> lastId()
McpTransportStreamlastId in interface McpTransportStream<CONNECTION>public long streamId()
McpTransportStreamstreamId in interface McpTransportStream<CONNECTION>long stream identifier valuepublic org.reactivestreams.Publisher<McpSchema.JSONRPCMessage> consumeSseStream(org.reactivestreams.Publisher<reactor.util.function.Tuple2<Optional<String>,Iterable<McpSchema.JSONRPCMessage>>> eventStream)
McpTransportStreamconsumeSseStream in interface McpTransportStream<CONNECTION>eventStream - a Publisher of tuples (pairs) of an optional identifier
associated with a collection of messagesPublisher of
JSON-RPC messages
with the identifier stripped awayCopyright © 2025. All rights reserved.