Package dev.tachyonmcp.core.server
Class OutboundSseStreamMessageRouter
java.lang.Object
dev.tachyonmcp.core.server.OutboundSseStreamMessageRouter
- All Implemented Interfaces:
OutboundStreamResolver
@InternalApi
public final class OutboundSseStreamMessageRouter
extends Object
implements OutboundStreamResolver
Default
OutboundStreamResolver that diverts events through an OutboundSseStream bound in
the current dispatch context when the dispatch session matches the target session. Otherwise, lets
the caller fall through to the normal GET-SSE path.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable OutboundSseStreamstatic @Nullable String@Nullable OutboundSseStreamResolves theOutboundSseStreambound in the current dispatch context for the given session, if any.static <T> TwithDispatchContext(@Nullable String sessionId, @Nullable OutboundSseStream outboundSseStream, Callable<T> action)
-
Constructor Details
-
OutboundSseStreamMessageRouter
public OutboundSseStreamMessageRouter()
-
-
Method Details
-
withDispatchContext
public static <T> T withDispatchContext(@Nullable String sessionId, @Nullable OutboundSseStream outboundSseStream, Callable<T> action) throws Exception - Throws:
Exception
-
currentOutboundSseStream
-
currentSessionId
-
resolve
Description copied from interface:OutboundStreamResolverResolves theOutboundSseStreambound in the current dispatch context for the given session, if any. The caller needs the stream before building the event (itsOutboundSseStream.streamKey()goes into the SSE event id and the event log), so resolution and delivery are separate steps.- Specified by:
resolvein interfaceOutboundStreamResolver- Parameters:
session- the target session for the event- Returns:
- the bound stream to deliver on, or
nullto fall through to the session's GET-SSE connection
-