Module apalis_core::mq

source ·
Available on crate feature mq only.
Expand description

Message queuing utilities

Message queue

Message queueing for apalis via mq module and feature respectively The mq module provides an abstraction for representing a message queue that supports pushing and consuming messages. It defines the MessageQueue trait, which can be implemented by different types of message queues. Trait: MessageQueue<J> The MessageQueue trait represents a message queue that can be pushed and consumed. It provides methods for pushing messages and consuming a stream of messages.

Trait Methods

  • push(data: J) -> Result<(), JobError>. Pushes a new message onto the message queue. Parameters: data (J): The message to be pushed onto the queue. Returns: Result<(), JobError>: A result indicating the success or failure of the push operation. Returns Ok(()) if the push was successful, or an error of type JobError if an error occurred.
  • consume(worker: &WorkerId) -> JobStreamResult<J> Starts consuming a stream of messages from the message queue. Parameters: worker (&WorkerId): The identifier of the worker consuming the messages.

Returns: JobStreamResult: A result representing a stream of messages (J). The stream can be processed asynchronously, allowing the worker to consume messages from the queue.

Modules

Traits