public class DefaultMcpTransportSession extends java.lang.Object implements McpTransportSession<reactor.core.Disposable>
McpTransportSession
which manages the open
connections using tye Disposable
type and allows to perform clean up using the
Disposable.dispose()
method.构造器和说明 |
---|
DefaultMcpTransportSession(java.util.function.Function<java.lang.String,org.reactivestreams.Publisher<java.lang.Void>> onClose) |
限定符和类型 | 方法和说明 |
---|---|
void |
addConnection(reactor.core.Disposable connection)
Adds a resource that this transport session can monitor and dismiss when needed.
|
void |
close()
Close and clear the monitored resources.
|
reactor.core.publisher.Mono<java.lang.Void> |
closeGracefully()
Close and clear the monitored resources in a graceful manner.
|
boolean |
markInitialized(java.lang.String sessionId)
Stateful operation that flips the un-initialized state to initialized if this is
the first call.
|
void |
removeConnection(reactor.core.Disposable connection)
Called when the resource is terminating by itself and the transport session does
not need to track it anymore.
|
java.util.Optional<java.lang.String> |
sessionId()
In case of stateful MCP servers, the value is present and contains the String
identifier for the transport-level session.
|
public DefaultMcpTransportSession(java.util.function.Function<java.lang.String,org.reactivestreams.Publisher<java.lang.Void>> onClose)
public java.util.Optional<java.lang.String> sessionId()
McpTransportSession
sessionId
在接口中 McpTransportSession<reactor.core.Disposable>
public boolean markInitialized(java.lang.String sessionId)
McpTransportSession
markInitialized
在接口中 McpTransportSession<reactor.core.Disposable>
sessionId
- session identifier as provided by the servertrue
and means that a
post-initialization step can be performedpublic void addConnection(reactor.core.Disposable connection)
McpTransportSession
addConnection
在接口中 McpTransportSession<reactor.core.Disposable>
connection
- the managed resourcepublic void removeConnection(reactor.core.Disposable connection)
McpTransportSession
removeConnection
在接口中 McpTransportSession<reactor.core.Disposable>
connection
- the resource to remove from the monitored collectionpublic void close()
McpTransportSession
close
在接口中 McpTransportSession<reactor.core.Disposable>
public reactor.core.publisher.Mono<java.lang.Void> closeGracefully()
McpTransportSession
closeGracefully
在接口中 McpTransportSession<reactor.core.Disposable>