Class BusPolicy
ServerBus will carry, in which direction, to whom. Everything not allowed here is denied.
Downstream entries are topic patterns: a custom topic (ns.name), a keyed custom topic or key pattern
(ns.name:key, ns.name:*), a job topic or pattern (job:<id>, job:*), or a card command
topic (cmd:<cardId>). Upstream entries are exact custom topics, each with its UpstreamHandler.
Example:
BusPolicy
- Since:
- 10.0.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowsUpstream(String topic) Returns whether a topic may flow upstream (exact match only).BiPredicate<jakarta.servlet.http.HttpServletRequest,String> boundary()voidChecks that this policy grants every topic that a page contract'sbridgesrequest (E-55).static BusPolicy.Buildercreate()Creates a new builder.downstreamRetain(String topic) Returns whether a topic (or a requested pattern) may flow downstream, and if so whether it is retained.intintintint
-
Method Details
-
create
Creates a new builder. An unmodified builder builds a policy that grants nothing.- Returns:
- A new builder.
-
downstreamRetain
Returns whether a topic (or a requested pattern) may flow downstream, and if so whether it is retained.A policy entry covers a topic when it is equal to it, or when the entry is
family:*and the topic isfamily:<anything>.- Parameters:
topic- A concrete topic or a requested pattern. Can benull .- Returns:
- The retain flag, or empty when the topic is denied.
-
allowsUpstream
Returns whether a topic may flow upstream (exact match only).- Parameters:
topic- The topic. Can benull .- Returns:
true if the policy has a handler for it.
-
check
Checks that this policy grants every topic that a page contract'sbridgesrequest (E-55).Adopter page tests call this next to
PageContractAssert.hasNoWiringErrors(). The request-dependentauthorizer()is not consulted: it can only narrow a grant at session time.- Parameters:
contract- The page contract (for examplePageCapture.of(html).contract()).- Throws:
IllegalStateException- Listing every denied topic, oneE-55line each.
-
authorizer
- Returns:
- The per-request, per-topic authorizer applied at session open. Defaults to allow-all.
-
boundary
- Returns:
- The request boundary, or
null when the application has its own guard.
-
allowedOrigins
- Returns:
- The exact origins allowed on a WebSocket handshake when no
boundary()is set.
-
sessionGrace
- Returns:
- How long a session survives after its last connection closes. Default 60 s.
-
maxSessionAge
- Returns:
- The absolute session lifetime. Default 12 h.
-
heartbeat
- Returns:
- The idle interval after which a
pingframe is sent. Default 15 s.
-
maxSessions
- Returns:
- The maximum number of live sessions. Default 256.
-
maxQueuedFrames
- Returns:
- The per-connection outbound queue bound. Default 1024.
-
maxFrameBytes
- Returns:
- The maximum encoded frame size in UTF-8 bytes, both directions. Default 65536.
-
maxUpstreamPerSecond
- Returns:
- The per-session upstream frame rate limit. Default 20.
-
sessionAttributes
- Returns:
- The function that captures session attributes at session open. Defaults to an empty map.
-