Class McpSubscriptionsConfig
subscriptions/listen (SEP-2575) configuration for a v2 McpRevision.
Mirrors McpMrtrConfig/McpCacheConfig's exact placement precedent: subscriptions/listen
is a 2026-07-28-only feature, so its configuration lives here, on the v2 adapter, never on the
revision-neutral org.apache.juneau.rest.server.mcp.McpServerConfig.
Mutable during setup, effectively immutable once published. Builder-less mutable-setup bean,
following the same contract as McpMrtrConfig: configure fully before handing to a binding, never
mutate afterward.
Unlike the org.apache.juneau.rest.server.mcp.McpSubscriptionBroker singleton (which holds live
per-connection state), this type is knobs-only — every field is a tunable numeric limit with no embedded
broker reference. It is one of McpOptions's nested configs (see McpOptions.getSubscriptions()),
memoized once per binding along with the rest of McpOptions; the broker itself is derived and
memoized separately, sized from this config's queueSize (see
McpOptions.resolveSubscriptionBroker()).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longDefault heartbeat/keepalive interval in milliseconds.static final longDefault idle timeout in milliseconds;0disables idle-timeout reaping.static final intDefault cap on concurrently opensubscriptions/listenstreams per broker.static final intDefault per-subscription drop-oldest queue bound; matchesSseBroadcaster.DEFAULT_QUEUE_SIZE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongThe heartbeat/keepalive interval in milliseconds.longThe idle timeout in milliseconds.intThe cap on concurrently opensubscriptions/listenstreams per broker.intThe per-subscription drop-oldest queue bound.setHeartbeatIntervalMs(long value) Sets the heartbeat/keepalive interval.setIdleTimeoutMs(long value) Sets the idle timeout.setMaxConcurrentSubscriptions(int value) Sets the cap on concurrently opensubscriptions/listenstreams per broker.setQueueSize(int value) Sets the per-subscription drop-oldest queue bound.
-
Field Details
-
DEFAULT_MAX_CONCURRENT_SUBSCRIPTIONS
Default cap on concurrently opensubscriptions/listenstreams per broker.- See Also:
-
DEFAULT_QUEUE_SIZE
Default per-subscription drop-oldest queue bound; matchesSseBroadcaster.DEFAULT_QUEUE_SIZE.- See Also:
-
DEFAULT_HEARTBEAT_INTERVAL_MS
Default heartbeat/keepalive interval in milliseconds.- See Also:
-
DEFAULT_IDLE_TIMEOUT_MS
Default idle timeout in milliseconds;0disables idle-timeout reaping.- See Also:
-
-
Constructor Details
-
McpSubscriptionsConfig
public McpSubscriptionsConfig()
-
-
Method Details
-
getMaxConcurrentSubscriptions
The cap on concurrently opensubscriptions/listenstreams per broker.- Returns:
- The cap. Always
> 0.
-
setMaxConcurrentSubscriptions
Sets the cap on concurrently opensubscriptions/listenstreams per broker.- Parameters:
value- The new value. Must be> 0.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueis not> 0.
-
getQueueSize
The per-subscription drop-oldest queue bound.- Returns:
- The bound. Always
> 0.
-
setQueueSize
Sets the per-subscription drop-oldest queue bound.- Parameters:
value- The new value. Must be> 0.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueis not> 0.
-
getHeartbeatIntervalMs
The heartbeat/keepalive interval in milliseconds.- Returns:
- The interval. Always
> 0.
-
setHeartbeatIntervalMs
Sets the heartbeat/keepalive interval.- Parameters:
value- The new value. Must be> 0.- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueis not> 0.
-
getIdleTimeoutMs
The idle timeout in milliseconds.- Returns:
- The timeout. Always
>= 0(0means disabled).
-
setIdleTimeoutMs
Sets the idle timeout.Keep this greater than
heartbeatIntervalMs. A heartbeat counts as activity, so as long asheartbeatIntervalMs < idleTimeoutMs, heartbeats alone keep an otherwise-quiet stream alive indefinitely. ConfiguringidleTimeoutMsat or belowheartbeatIntervalMsdefeats that: the watchdog can fire between two heartbeats and silently reap a perfectly healthy connection. This setter accepts any non-negative value without checking against the currently-configured heartbeat interval (the two may be set in either order), so this is a configuration contract, not one this class enforces for you.- Parameters:
value- The new value. Must be>= 0(0disables idle-timeout reaping).- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifvalueis negative.
-