pub struct SseRouteDef {
pub subject: String,
pub reducer: Option<String>,
pub anonymous: bool,
}Expand description
The NATS subject an event-stream route bridges, and the handler that turns each message into events.
Fields§
§subject: StringDot-separated tokens starting dw.{tenant}.; a {name} token is the
route’s path parameter of that name. * and > wildcards are allowed.
reducer: Option<String>Exported handler reducing each message; without one every message is forwarded as a data-only event.
anonymous: boolStreams to callers the route does not authenticate: required on a public or undeclared posture.
Implementations§
Source§impl SseRouteDef
impl SseRouteDef
Sourcepub const SUBJECT_PREFIX: &'static str = "dw.{tenant}."
pub const SUBJECT_PREFIX: &'static str = "dw.{tenant}."
Every subject starts with this: an event stream reads only its own tenant’s subjects.
Sourcepub const REDUCER_METHOD: &'static str = "SSE_EVENT"
pub const REDUCER_METHOD: &'static str = "SSE_EVENT"
The method of the request a reducer receives.
Sourcepub const RESERVED_TOKENS: &'static [&'static str]
pub const RESERVED_TOKENS: &'static [&'static str]
Tokens after the prefix the platform itself publishes under (the tenant’s audit log), never bridged.
Sourcepub fn subject_violation(&self, params: Option<&[String]>) -> Option<String>
pub fn subject_violation(&self, params: Option<&[String]>) -> Option<String>
Why the subject cannot be bridged for a route whose path parameters
are params (None on a legacy route, which has none): it must be
dot-separated tokens under the prefix, name its events with a literal
token that is not reserved, and bind every {name} but {tenant}
to a path parameter.
Sourcepub fn anonymous_violation(
&self,
anonymous_posture: bool,
) -> Option<&'static str>
pub fn anonymous_violation( &self, anonymous_posture: bool, ) -> Option<&'static str>
Why the stream cannot be served on a posture that admits anonymous callers (public or undeclared) unless it opts in.
Sourcepub fn placeholders(&self) -> impl Iterator<Item = &str>
pub fn placeholders(&self) -> impl Iterator<Item = &str>
The names of the template’s {name} tokens, tenant included.