Trait MQAdmin

Source
pub trait MQAdmin {
    // Required methods
    fn create_topic(
        &self,
        key: &str,
        new_topic: &str,
        queue_num: i32,
        attributes: HashMap<String, String>,
    ) -> RocketMQResult<()>;
    fn create_topic_with_flag(
        &self,
        key: &str,
        new_topic: &str,
        queue_num: i32,
        topic_sys_flag: i32,
        attributes: HashMap<String, String>,
    ) -> RocketMQResult<()>;
    fn search_offset(
        &self,
        mq: &MessageQueue,
        timestamp: u64,
    ) -> RocketMQResult<i64>;
    fn max_offset(&self, mq: &MessageQueue) -> RocketMQResult<i64>;
    fn min_offset(&self, mq: &MessageQueue) -> RocketMQResult<i64>;
    fn earliest_msg_store_time(&self, mq: &MessageQueue) -> RocketMQResult<u64>;
    fn query_message(
        &self,
        topic: &str,
        key: &str,
        max_num: i32,
        begin: u64,
        end: u64,
    ) -> RocketMQResult<QueryResult>;
    fn view_message(
        &self,
        topic: &str,
        msg_id: &str,
    ) -> RocketMQResult<MessageExt>;
}
Expand description

Trait defining administrative operations for a Message Queue (MQ).

Required Methods§

Source

fn create_topic( &self, key: &str, new_topic: &str, queue_num: i32, attributes: HashMap<String, String>, ) -> RocketMQResult<()>

Creates a new topic.

§Arguments
  • key - A key used for topic creation.
  • new_topic - The name of the new topic.
  • queue_num - The number of queues for the new topic.
  • attributes - A map of attributes for the new topic.
§Returns

A Result indicating success or failure.

Source

fn create_topic_with_flag( &self, key: &str, new_topic: &str, queue_num: i32, topic_sys_flag: i32, attributes: HashMap<String, String>, ) -> RocketMQResult<()>

Creates a new topic with a system flag.

§Arguments
  • key - A key used for topic creation.
  • new_topic - The name of the new topic.
  • queue_num - The number of queues for the new topic.
  • topic_sys_flag - The system flag for the new topic.
  • attributes - A map of attributes for the new topic.
§Returns

A Result indicating success or failure.

Source

fn search_offset( &self, mq: &MessageQueue, timestamp: u64, ) -> RocketMQResult<i64>

Searches for the offset of a message in a queue at a given timestamp.

§Arguments
  • mq - The message queue to search.
  • timestamp - The timestamp to search for.
§Returns

A Result containing the offset if found, or an error.

Source

fn max_offset(&self, mq: &MessageQueue) -> RocketMQResult<i64>

Retrieves the maximum offset of a message in a queue.

§Arguments
  • mq - The message queue to query.
§Returns

A Result containing the maximum offset, or an error.

Source

fn min_offset(&self, mq: &MessageQueue) -> RocketMQResult<i64>

Retrieves the minimum offset of a message in a queue.

§Arguments
  • mq - The message queue to query.
§Returns

A Result containing the minimum offset, or an error.

Source

fn earliest_msg_store_time(&self, mq: &MessageQueue) -> RocketMQResult<u64>

Retrieves the earliest message store time in a queue.

§Arguments
  • mq - The message queue to query.
§Returns

A Result containing the earliest message store time, or an error.

Source

fn query_message( &self, topic: &str, key: &str, max_num: i32, begin: u64, end: u64, ) -> RocketMQResult<QueryResult>

Queries messages in a topic by key within a time range.

§Arguments
  • topic - The topic to query.
  • key - The key to search for.
  • max_num - The maximum number of messages to return.
  • begin - The start of the time range.
  • end - The end of the time range.
§Returns

A Result containing a QueryResult with the messages, or an error.

Source

fn view_message(&self, topic: &str, msg_id: &str) -> RocketMQResult<MessageExt>

Views a message by its ID in a topic.

§Arguments
  • topic - The topic containing the message.
  • msg_id - The ID of the message to view.
§Returns

A Result containing the MessageExt if found, or an error.

Implementors§