pub struct TableRouterBuilder<S> { /* private fields */ }Expand description
Ergonomic builder for TableRouter.
Obtain an instance via TableRouter::builder.
Implementations§
Source§impl<S: SinkAdapter> TableRouterBuilder<S>
impl<S: SinkAdapter> TableRouterBuilder<S>
Sourcepub fn route(self, pattern: impl Into<String>, sink: S) -> Self
pub fn route(self, pattern: impl Into<String>, sink: S) -> Self
Append a route: events whose schema.table matches pattern are sent to sink.
Routes are evaluated in the order they are added; the first matching pattern wins.
Sourcepub fn default(self, sink: S) -> Self
pub fn default(self, sink: S) -> Self
Set a fallback sink for events that match no explicit pattern.
When no default is provided, unmatched events are silently dropped (or return an
error depending on drop_unrouted).
Sourcepub fn drop_unrouted(self, drop: bool) -> Self
pub fn drop_unrouted(self, drop: bool) -> Self
When true (the default), events that match no route and have no default sink are
silently dropped. When false, such events return a Error::StateError.
Silently dropping unmatched events is the right default for fan-out pipelines where
you only care about a subset of tables. Set this to false when you want strict
auditability guarantees (every event must land somewhere).
Sourcepub fn build(self) -> Result<TableRouter<S>>
pub fn build(self) -> Result<TableRouter<S>>
Build the TableRouter, validating all route patterns.
Returns Error::ConfigError when:
- any pattern is empty,
- two routes share the same pattern (likely a misconfiguration),
- a dotted pattern has an empty schema or table segment (e.g.
".orders","public.").
Use build_unchecked when patterns are compile-time
constants and you prefer a panicking shorthand.
Sourcepub fn build_unchecked(self) -> TableRouter<S>
pub fn build_unchecked(self) -> TableRouter<S>
Build the TableRouter without pattern validation.
Prefer build unless patterns are guaranteed valid at compile time.