pub trait MessageConsumer: Send + Sync {
// Required methods
fn connector_name(&self) -> &'static str;
fn receive<'life0, 'life1, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
max: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<InboundMessage>, FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
tokens: Vec<AckToken>,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn decode(&self, message: &InboundMessage) -> Result<Value, FaucetError>;
// Provided methods
fn config_schema(&self) -> Value { ... }
fn dataset_uri(&self) -> String { ... }
fn call_context(&self) -> CallContext { ... }
fn max_messages(&self) -> Option<usize> { ... }
fn idle_receives_to_stop(&self) -> u32 { ... }
fn check<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
ctx: &'life2 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<Option<CheckReport>, FaucetError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
A consumer’s primitives (RFC 0014). Wrap it in a MessageSourceDriver,
then a DriverSource.
Required Methods§
Sourcefn connector_name(&self) -> &'static str
fn connector_name(&self) -> &'static str
The connector’s name.
Sourcefn receive<'life0, 'life1, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
max: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<InboundMessage>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn receive<'life0, 'life1, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
max: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<InboundMessage>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Receive up to max messages, waiting at most the consumer’s own idle
wait. An empty result means nothing arrived in that wait.
Sourcefn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
tokens: Vec<AckToken>,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ack<'life0, 'life1, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
tokens: Vec<AckToken>,
) -> Pin<Box<dyn Future<Output = Result<(), FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Acknowledge messages so the broker does not redeliver them.
Sourcefn decode(&self, message: &InboundMessage) -> Result<Value, FaucetError>
fn decode(&self, message: &InboundMessage) -> Result<Value, FaucetError>
The record for a received message.
Provided Methods§
Sourcefn config_schema(&self) -> Value
fn config_schema(&self) -> Value
The JSON Schema of the connector’s config.
Sourcefn dataset_uri(&self) -> String
fn dataset_uri(&self) -> String
The source, for lineage (credential-free).
Sourcefn call_context(&self) -> CallContext
fn call_context(&self) -> CallContext
The connector’s own call defaults.
Sourcefn max_messages(&self) -> Option<usize>
fn max_messages(&self) -> Option<usize>
Stop after this many messages; None: only idleness stops the read.
Sourcefn idle_receives_to_stop(&self) -> u32
fn idle_receives_to_stop(&self) -> u32
Consecutive empty receives that end the read.
Sourcefn check<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
ctx: &'life2 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<Option<CheckReport>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn check<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
calls: &'life1 CallSlot,
ctx: &'life2 CheckContext,
) -> Pin<Box<dyn Future<Output = Result<Option<CheckReport>, FaucetError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
A preflight probe that consumes nothing (connect, look up the queue).
None (the default): the probe is skipped, because reading a page
would take messages off the queue.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".