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§
Provided Methods§
Sourcefn validate(&mut self) -> SourceResult<()>
fn validate(&mut self) -> SourceResult<()>
Validation logic for determining if a source is properly configured at runtime.
Sourcefn setup(&mut self) -> SourceResult<()>
fn setup(&mut self) -> SourceResult<()>
Source setup logic should go here
Sourcefn shutdown(&mut self) -> SourceResult<()>
fn shutdown(&mut self) -> SourceResult<()>
Source shutdown logic for closing connections, performing cleanup logic, etc.
Sourcefn connect(&mut self) -> SourceResult<()>
fn connect(&mut self) -> SourceResult<()>
Source connection logic for creating client connections
Sourcefn healthy(&mut self) -> bool
fn healthy(&mut self) -> bool
Source health check. Should be used to determine if clients are still able to reach upstream brokers
Sourcefn poll(&mut self) -> SourcePollResult
fn poll(&mut self) -> SourcePollResult
Poll for new message from the source
Sourcefn monitor(&mut self) -> SourceResult<()>
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.
Sourcefn ack(&mut self, _msg_id: MsgId) -> SourceResult<(i32, i32)>
fn ack(&mut self, _msg_id: MsgId) -> SourceResult<(i32, i32)>
Ack a single method with the upstream source
Sourcefn batch_ack(&mut self, msgs: Vec<MsgId>) -> SourceResult<(i32, i32)>
fn batch_ack(&mut self, msgs: Vec<MsgId>) -> SourceResult<(i32, i32)>
Batch ack a vector of messages with an upstream source
Sourcefn max_backoff(&self) -> SourceResult<&u64>
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
Sourcefn poll_interval(&self) -> SourceResult<&SourceInterval>
fn poll_interval(&self) -> SourceResult<&SourceInterval>
Poll interval controls how often a Topology should ask for new messages
Sourcefn monitor_interval(&self) -> SourceResult<&SourceInterval>
fn monitor_interval(&self) -> SourceResult<&SourceInterval>
Monitor interval controls how often the source monitor is called
Sourcefn ack_policy(&self) -> SourceResult<&SourceAckPolicy>
fn ack_policy(&self) -> SourceResult<&SourceAckPolicy>
Ack policy configuration
Sourcefn ack_interval(&self) -> SourceResult<&SourceInterval>
fn ack_interval(&self) -> SourceResult<&SourceInterval>
Configures how often the source should check for new messages to ack
Sourcefn flush_metrics(&mut self)
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".