Skip to main content

StreamHandler

Trait StreamHandler 

Source
pub trait StreamHandler: Send + Sync {
    // Required method
    fn handle(&self, message: &StreamMessage);

    // Provided methods
    fn should_handle(&self, _message: &StreamMessage) -> bool { ... }
    fn flush(&self) { ... }
    fn on_start(&self, _job_id: &str) { ... }
    fn on_end(&self, _job_id: &str, _final_status: Option<&str>) { ... }
}
Expand description

Trait for handling stream messages.

Required Methods§

Source

fn handle(&self, message: &StreamMessage)

Process a stream message.

Provided Methods§

Source

fn should_handle(&self, _message: &StreamMessage) -> bool

Filter predicate - return false to skip handling this message.

Source

fn flush(&self)

Flush any buffered output.

Source

fn on_start(&self, _job_id: &str)

Called when streaming starts.

Source

fn on_end(&self, _job_id: &str, _final_status: Option<&str>)

Called when streaming ends.

Implementors§