Skip to main content

Processor

Trait Processor 

Source
pub trait Processor<KIn: Send, VIn: Send, KOut: Send, VOut: Send>: Send + 'static {
    // Required method
    fn process<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        ctx: &'life1 mut ProcessorContext<'life2, 'life3, KOut, VOut>,
        record: Record<KIn, VIn>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided methods
    fn init<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        _ctx: &'life1 mut ProcessorContext<'life2, 'life3, KOut, VOut>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A stateless record processor. ProcessorSupplier::get creates one instance per task. This mirrors org.apache.kafka.streams.processor.api.Processor.

§Lifecycle

The runtime calls init once before the first record and close once at task shutdown. TopologyTestDriver calls init when it instantiates a topology for tests.

Required Methods§

Source

fn process<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ProcessorContext<'life2, 'life3, KOut, VOut>, record: Record<KIn, VIn>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Provided Methods§

Source

fn init<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, _ctx: &'life1 mut ProcessorContext<'life2, 'life3, KOut, VOut>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Trait Implementations§

Source§

impl<KIn, VIn, KOut, VOut> Processor<KIn, VIn, KOut, VOut> for Box<dyn Processor<KIn, VIn, KOut, VOut>>
where KIn: Send + 'static, VIn: Send + 'static, KOut: Send + 'static, VOut: Send + 'static,

A boxed processor is itself a Processor and delegates to the inner value.

This lets a ProcessorSupplier closure return Box<dyn Processor<…>> when the code chooses the concrete type at runtime. The boxed value still satisfies the supplier blanket impl, which needs only some Processor as the closure’s return type. In the common case, return the concrete processor directly with || MyProc and skip the box.

Source§

fn init<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ProcessorContext<'life2, 'life3, KOut, VOut>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn process<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ProcessorContext<'life2, 'life3, KOut, VOut>, record: Record<KIn, VIn>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<KIn, VIn, KOut, VOut> Processor<KIn, VIn, KOut, VOut> for Box<dyn Processor<KIn, VIn, KOut, VOut>>
where KIn: Send + 'static, VIn: Send + 'static, KOut: Send + 'static, VOut: Send + 'static,

A boxed processor is itself a Processor and delegates to the inner value.

This lets a ProcessorSupplier closure return Box<dyn Processor<…>> when the code chooses the concrete type at runtime. The boxed value still satisfies the supplier blanket impl, which needs only some Processor as the closure’s return type. In the common case, return the concrete processor directly with || MyProc and skip the box.

Source§

fn init<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ProcessorContext<'life2, 'life3, KOut, VOut>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn process<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, ctx: &'life1 mut ProcessorContext<'life2, 'life3, KOut, VOut>, record: Record<KIn, VIn>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Source§

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§