Interface McpSubscriptionHandle
- All Superinterfaces:
AutoCloseable,Closeable
Closeable handle for a live
McpClient.listen(org.apache.juneau.bean.mcp.v20260728.SubscriptionFilter, McpSubscriptionListener)
subscription.- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the subscription: signals the background pump to stop and closes the underlying stream.voidclose()id()The client-generated JSON-RPC request id this subscription's openingMcpClient.listen(org.apache.juneau.bean.mcp.v20260728.SubscriptionFilter, McpSubscriptionListener)call sent, and which the server echoes back as thesubscriptionIdon every frame of this stream (the acknowledged frame, each change notification, and the terminal frame).booleanisOpen()
-
Method Details
-
id
The client-generated JSON-RPC request id this subscription's openingMcpClient.listen(org.apache.juneau.bean.mcp.v20260728.SubscriptionFilter, McpSubscriptionListener)call sent, and which the server echoes back as thesubscriptionIdon every frame of this stream (the acknowledged frame, each change notification, and the terminal frame). Callers can use this to correlate this handle against server-side logs/traces for the same subscription.- Returns:
- The request id. Never
null or empty.
-
cancel
void cancel()Cancels the subscription: signals the background pump to stop and closes the underlying stream. Idempotent.Asynchronous: this method returns as soon as the stop signal is issued and the stream close is requested, without waiting for the background pump thread to actually finish running. A caller that needs to know the pump has fully stopped must poll
isOpen()or otherwise synchronize with it separately — this method does not join it. -
close
void close()Alias forcancel(), satisfyingCloseablefor try-with-resources use.Deliberately declares no checked
IOException(narrowsCloseable.close()'s throws clause) — the background pump owns the stream's lifecycle and closing it is always a local, non-throwing operation.Like
cancel(), this is asynchronous: it signals the pump to stop but does not wait for it to exit.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
isOpen
boolean isOpen()- Returns:
true if the subscription is still open (not cancelled, errored, or gracefully completed).
-