Skip to main content

Source

Trait Source 

Source
pub trait Source {
Show 16 methods // Required method fn name(&self) -> &'static str; // Provided methods fn validate(&mut self) -> SourceResult<()> { ... } fn setup(&mut self) -> SourceResult<()> { ... } fn shutdown(&mut self) -> SourceResult<()> { ... } fn connect(&mut self) -> SourceResult<()> { ... } fn healthy(&mut self) -> bool { ... } fn poll(&mut self) -> SourcePollResult { ... } fn monitor(&mut self) -> SourceResult<()> { ... } fn ack(&mut self, _msg_id: MsgId) -> SourceResult<(i32, i32)> { ... } fn batch_ack(&mut self, msgs: Vec<MsgId>) -> SourceResult<(i32, i32)> { ... } fn max_backoff(&self) -> SourceResult<&u64> { ... } fn poll_interval(&self) -> SourceResult<&SourceInterval> { ... } fn monitor_interval(&self) -> SourceResult<&SourceInterval> { ... } fn ack_policy(&self) -> SourceResult<&SourceAckPolicy> { ... } fn ack_interval(&self) -> SourceResult<&SourceInterval> { ... } fn flush_metrics(&mut self) { ... }
}
Expand description

Source trait is used define actions

Required Methods§

Source

fn name(&self) -> &'static str

return the name of this source

Provided Methods§

Source

fn validate(&mut self) -> SourceResult<()>

Validation logic for determining if a source is properly configured at runtime.

Source

fn setup(&mut self) -> SourceResult<()>

Source setup logic should go here

Source

fn shutdown(&mut self) -> SourceResult<()>

Source shutdown logic for closing connections, performing cleanup logic, etc.

Source

fn connect(&mut self) -> SourceResult<()>

Source connection logic for creating client connections

Source

fn healthy(&mut self) -> bool

Source health check. Should be used to determine if clients are still able to reach upstream brokers

Source

fn poll(&mut self) -> SourcePollResult

Poll for new message from the source

Source

fn monitor(&mut self) -> SourceResult<()>

Monitor is a special method which is the callback for the monitor interval It’s intended to ack as a special hook for keeping track of your source structure or performing other actions.

Source

fn ack(&mut self, _msg_id: MsgId) -> SourceResult<(i32, i32)>

Ack a single method with the upstream source

Source

fn batch_ack(&mut self, msgs: Vec<MsgId>) -> SourceResult<(i32, i32)>

Batch ack a vector of messages with an upstream source

Source

fn max_backoff(&self) -> SourceResult<&u64>

The configured maximum amount of time in milliseconds a source should backoff. This value is read by the TopologyActor when scheduling the next source.poll call

Source

fn poll_interval(&self) -> SourceResult<&SourceInterval>

Poll interval controls how often a Topology should ask for new messages

Source

fn monitor_interval(&self) -> SourceResult<&SourceInterval>

Monitor interval controls how often the source monitor is called

Source

fn ack_policy(&self) -> SourceResult<&SourceAckPolicy>

Ack policy configuration

Source

fn ack_interval(&self) -> SourceResult<&SourceInterval>

Configures how often the source should check for new messages to ack

Source

fn flush_metrics(&mut self)

Sources can implement Metrics. This method is called by TopologyActor to internal source flush metrics to configured backend targets.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§