Trait AllocateMessageQueueStrategy

Source
pub trait AllocateMessageQueueStrategy: Send + Sync {
    // Required methods
    fn allocate(
        &self,
        consumer_group: &CheetahString,
        current_cid: &CheetahString,
        mq_all: &[MessageQueue],
        cid_all: &[CheetahString],
    ) -> RocketMQResult<Vec<MessageQueue>>;
    fn get_name(&self) -> &'static str;
}
Expand description

Trait for allocating message queues to consumers in a consumer group. This trait is implemented by different strategies for message queue allocation.

Required Methods§

Source

fn allocate( &self, consumer_group: &CheetahString, current_cid: &CheetahString, mq_all: &[MessageQueue], cid_all: &[CheetahString], ) -> RocketMQResult<Vec<MessageQueue>>

Allocates message queues to a consumer in a consumer group.

§Arguments
  • consumer_group - The name of the consumer group.
  • current_cid - The ID of the current consumer.
  • mq_all - A slice of all available message queues.
  • cid_all - A slice of all consumer IDs in the consumer group.
§Returns

A Result containing a vector of allocated message queues or an error.

Source

fn get_name(&self) -> &'static str

Returns the name of the allocation strategy.

§Returns

A static string slice representing the name of the strategy.

Implementors§