pub trait MessageTransport:
Send
+ Sync
+ 'static {
// Required methods
fn poll(
&self,
max: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<InboundMessage>, Box<dyn Error + Sync + Send>>> + Send + '_>>;
fn ack<'a>(
&'a self,
msg: &'a InboundMessage,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'a>>;
fn nack<'a>(
&'a self,
msg: &'a InboundMessage,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'a>>;
fn dead_letter<'a>(
&'a self,
msg: &'a InboundMessage,
reason: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'a>>;
}Expand description
App-provided broker adapter (Kafka / AMQP / NATS / in-process bridge).
Required Methods§
Sourcefn poll(
&self,
max: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<InboundMessage>, Box<dyn Error + Sync + Send>>> + Send + '_>>
fn poll( &self, max: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<InboundMessage>, Box<dyn Error + Sync + Send>>> + Send + '_>>
Pull up to max messages. An empty Vec means “nothing right now”.
Sourcefn ack<'a>(
&'a self,
msg: &'a InboundMessage,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'a>>
fn ack<'a>( &'a self, msg: &'a InboundMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Sync + Send>>> + Send + 'a>>
Acknowledge successful processing (message will not be redelivered).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".