CONNECTION
- the resource serving the streampublic class DefaultMcpTransportStream<CONNECTION> extends java.lang.Object implements McpTransportStream<CONNECTION>
McpTransportStream
using Project Reactor types.构造器和说明 |
---|
DefaultMcpTransportStream(boolean resumable,
java.util.function.Function<McpTransportStream<CONNECTION>,org.reactivestreams.Publisher<CONNECTION>> reconnect)
Constructs a new instance representing a particular stream that can resume using
the provided reconnect mechanism.
|
限定符和类型 | 方法和说明 |
---|---|
org.reactivestreams.Publisher<McpSchema.JSONRPCMessage> |
consumeSseStream(org.reactivestreams.Publisher<reactor.util.function.Tuple2<java.util.Optional<java.lang.String>,java.lang.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.
|
java.util.Optional<java.lang.String> |
lastId()
The last observed event identifier.
|
long |
streamId()
An internal stream identifier used to distinguish streams while debugging.
|
public DefaultMcpTransportStream(boolean resumable, java.util.function.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 java.util.Optional<java.lang.String> lastId()
McpTransportStream
lastId
在接口中 McpTransportStream<CONNECTION>
public long streamId()
McpTransportStream
streamId
在接口中 McpTransportStream<CONNECTION>
long
stream identifier valuepublic org.reactivestreams.Publisher<McpSchema.JSONRPCMessage> consumeSseStream(org.reactivestreams.Publisher<reactor.util.function.Tuple2<java.util.Optional<java.lang.String>,java.lang.Iterable<McpSchema.JSONRPCMessage>>> eventStream)
McpTransportStream
consumeSseStream
在接口中 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 away