Skip to main content

StreamBuilder

Struct StreamBuilder 

Source
pub struct StreamBuilder { /* private fields */ }
Expand description

Fluent builder for a Pulse streaming pipeline.

Chain operator methods, then call build (or pass to StreamsResource::deploy).

All operator methods take &mut self and return Self so calls chain naturally. Methods that validate their inputs panic on obviously-bad arguments (blank required fields, non-positive counts, unknown enum values) so bugs are caught at call site, not after a 400 round-trip.

Implementations§

Source§

impl StreamBuilder

Source

pub fn new(name: impl Into<String>) -> Self

Builder with the given pipeline name preset.

Source

pub fn anonymous() -> Self

Builder with no preset name. Use named or pass the name to build_with_name.

Source

pub fn from_topic(self, topic: impl Into<String>) -> Self

Sets the input topic. Source engine defaults to "kafka".

Source

pub fn from_topic_with_engine( self, topic: impl Into<String>, engine: impl Into<String>, ) -> Self

Sets the input topic + source engine.

Source

pub fn with_source_config(self, key: impl Into<String>, value: Value) -> Self

Merges extra config into the source node’s config map.

Source

pub fn with_source_label(self, label: impl Into<String>) -> Self

Sets the display label for the source node.

Source

pub fn filter(self, condition: impl Into<String>) -> Self

Filter operator. condition is a CEL-like expression string.

Source

pub fn map(self, options: MapOptions) -> Self

Map operator. At least one of options.fields / options.target_type is required.

Source

pub fn flat_map(self, split_field: impl Into<String>) -> Self

Flat-map: explode an array-valued field into one event per element.

Source

pub fn key_by(self, field: impl Into<String>) -> Self

Group the stream by a top-level field value. Required before stateful ops.

Source

pub fn window(self, spec: WindowSpec) -> Self

Window operator with no extra options.

Source

pub fn window_with_aggs( self, spec: WindowSpec, aggregations: BTreeMap<String, String>, ) -> Self

Window operator with aggregations only.

Source

pub fn window_full(self, spec: WindowSpec, options: WindowOptions) -> Self

Window operator with the full option set.

Source

pub fn window_from_str(self, spec: &str, options: WindowOptions) -> Self

Window operator with a raw spec string. Useful when you’ve already validated the spec against WindowEngine.parseSpec.

Source

pub fn branch(self, branches: Vec<BranchSpec>) -> Self

Branch operator: route events to different topics by condition.

Source

pub fn enrich( self, lookup_topic: impl Into<String>, key_field: impl Into<String>, ) -> Self

Synchronous enrichment: join the stream against a state-store topic.

Source

pub fn enrich_async(self, options: EnrichAsyncOptions) -> Self

Asynchronous HTTP enrichment. url supports {field} placeholders.

Source

pub fn cep(self, sequence: Vec<Value>, options: CepOptions) -> Self

Complex Event Processing: match a sequence of conditions.

Source

pub fn broadcast_join(self, options: BroadcastJoinOptions) -> Self

Broadcast join: enrich the stream against a fully-replicated table.

Source

pub fn cdc_join(self, options: CdcJoinOptions) -> Self

CDC join: stream-table join against a CDC-fed state table.

Source

pub fn to_topic(self, topic: impl Into<String>) -> Self

Sets the output topic only. No sink node is emitted.

Source

pub fn to_topic_with_channel( self, topic: impl Into<String>, channel: impl Into<String>, ) -> Self

Sets the output topic + sink channel (emits a sink node).

Source

pub fn with_sink_config(self, key: impl Into<String>, value: Value) -> Self

Merges extra config into the sink node’s config map.

Source

pub fn with_sink_label(self, label: impl Into<String>) -> Self

Sets the display label for the sink node.

Source

pub fn to_state(self) -> Self

Terminate the stream in the agent’s state store (queryable via B-106 IQ).

Source

pub fn named(self, name: impl Into<String>) -> Self

Sets / overrides the pipeline name.

Source

pub fn described_as(self, description: impl Into<String>) -> Self

Sets the pipeline description.

Source

pub fn with_agent_label(self, label: impl Into<String>) -> Self

Sets the display label for the streaming agent node.

Source

pub fn operators(&self) -> &[Map<String, Value>]

Returns a read-only view of the recorded operator chain.

Source

pub fn build(&self) -> Result<Value, PulseError>

Compile the chain into a Pulse pipeline dict ready for POST.

Source

pub fn build_with_name(&self, name: &str) -> Result<Value, PulseError>

Same as build but overrides the pipeline name.

Trait Implementations§

Source§

impl Clone for StreamBuilder

Source§

fn clone(&self) -> StreamBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StreamBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StreamBuilder

Source§

fn default() -> StreamBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more