pub struct MockSource {
pub queue: VecDeque<SourceMsg>,
/* private fields */
}
Expand description
A mock source which should be used for testing purposes. This source mocks pushing & polling messages from a queue.
Fields§
§queue: VecDeque<SourceMsg>
Trait Implementations§
Source§impl Default for MockSource
impl Default for MockSource
Source§impl Source for MockSource
impl Source for MockSource
Source§fn setup(&mut self) -> SourceResult<()>
fn setup(&mut self) -> SourceResult<()>
Source setup logic should go here
Source§fn 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
Source§fn 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
Source§fn 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
callSource§fn ack_policy(&self) -> SourceResult<&SourceAckPolicy>
fn ack_policy(&self) -> SourceResult<&SourceAckPolicy>
Ack policy configuration
Source§fn ack_interval(&self) -> SourceResult<&SourceInterval>
fn ack_interval(&self) -> SourceResult<&SourceInterval>
Configures how often the source should check for new messages to ack
Source§fn poll_interval(&self) -> SourceResult<&SourceInterval>
fn poll_interval(&self) -> SourceResult<&SourceInterval>
Poll interval controls how often a Topology should ask for new messages
Source§fn poll(&mut self) -> SourcePollResult
fn poll(&mut self) -> SourcePollResult
Poll for new message from the source
Source§fn validate(&mut self) -> Result<(), SourceError>
fn validate(&mut self) -> Result<(), SourceError>
Validation logic for determining if a source is properly configured
at runtime.
Source§fn shutdown(&mut self) -> Result<(), SourceError>
fn shutdown(&mut self) -> Result<(), SourceError>
Source shutdown logic for closing connections, performing cleanup logic, etc.
Source§fn connect(&mut self) -> Result<(), SourceError>
fn connect(&mut self) -> Result<(), SourceError>
Source connection logic for creating client connections
Source§fn 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
Source§fn monitor(&mut self) -> Result<(), SourceError>
fn monitor(&mut self) -> Result<(), SourceError>
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 monitor_interval(&self) -> Result<&SourceInterval, SourceError>
fn monitor_interval(&self) -> Result<&SourceInterval, SourceError>
Monitor interval controls how often the source
monitor
is calledSource§fn 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.
Auto Trait Implementations§
impl Freeze for MockSource
impl RefUnwindSafe for MockSource
impl Send for MockSource
impl Sync for MockSource
impl Unpin for MockSource
impl UnwindSafe for MockSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more