pub trait ReceivedEvent<E>: Deref<Target = E>where
E: Event,{
// Required methods
fn ack(&self) -> impl Future<Output = Result<(), Error>> + Send;
fn context(&self) -> &Context;
// Provided method
fn event(&self) -> &E { ... }
}Expand description
Re-exported so services only need to depend on arminius-lib-nats.
The message-bus Subscriber trait
is intentionally not re-exported here to avoid clashing with the
async_nats::Subscriber re-export above; reach it via
arminius_lib_message_bus::Subscriber.
An event received from the message bus that can be acknowledged.
Implements Deref to give direct access to the inner event data.
Required Methods§
Sourcefn ack(&self) -> impl Future<Output = Result<(), Error>> + Send
fn ack(&self) -> impl Future<Output = Result<(), Error>> + Send
Acknowledge processing of this event.
Tells the message broker that the event was processed successfully and should not be redelivered. If acknowledgment fails, the event may be reprocessed by this or another service instance.
§Errors
Returns Error::AckFailed if the acknowledgment could not be sent.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".