Trait LitePullConsumer

Source
pub trait LitePullConsumer: Sync + Send {
Show 30 methods // Required methods fn start(&self) -> impl Future<Output = RocketMQResult<()>> + Send; fn shutdown(&self) -> impl Future<Output = ()> + Send; fn is_running(&self) -> impl Future<Output = bool> + Send; fn subscribe( &self, topic: &str, ) -> impl Future<Output = RocketMQResult<()>> + Send; fn subscribe_with_expression( &self, topic: &str, sub_expression: &str, ) -> impl Future<Output = RocketMQResult<()>> + Send; fn subscribe_with_listener<MQL>( &self, topic: &str, sub_expression: &str, listener: MQL, ) -> impl Future<Output = RocketMQResult<()>> + Send where MQL: MessageQueueListener; fn subscribe_with_selector( &self, topic: &str, selector: Option<MessageSelector>, ) -> impl Future<Output = RocketMQResult<()>> + Send; fn unsubscribe(&self, topic: &str) -> impl Future<Output = ()> + Send; fn assignment( &self, ) -> impl Future<Output = RocketMQResult<HashSet<MessageQueue>>> + Send; fn assign( &self, message_queues: Vec<MessageQueue>, ) -> impl Future<Output = ()> + Send; fn set_sub_expression_for_assign( &self, topic: &str, sub_expression: &str, ) -> impl Future<Output = ()> + Send; fn poll(&self) -> impl Future<Output = Vec<MessageExt>> + Send; fn poll_with_timeout( &self, timeout: u64, ) -> impl Future<Output = Vec<MessageExt>> + Send; fn seek( &self, message_queue: &MessageQueue, offset: i64, ) -> impl Future<Output = RocketMQResult<()>> + Send; fn pause( &self, message_queues: Vec<MessageQueue>, ) -> impl Future<Output = ()> + Send; fn resume( &self, message_queues: Vec<MessageQueue>, ) -> impl Future<Output = ()> + Send; fn is_auto_commit(&self) -> impl Future<Output = bool> + Send; fn set_auto_commit( &self, auto_commit: bool, ) -> impl Future<Output = ()> + Send; fn fetch_message_queues( &self, topic: &str, ) -> impl Future<Output = RocketMQResult<Vec<MessageQueue>>> + Send; fn offset_for_timestamp( &self, message_queue: &MessageQueue, timestamp: u64, ) -> impl Future<Output = RocketMQResult<i64>> + Send; fn commit_sync(&self) -> impl Future<Output = ()> + Send; fn commit_sync_with_map( &self, offset_map: HashMap<MessageQueue, i64>, persist: bool, ) -> impl Future<Output = ()> + Send; fn commit(&self) -> impl Future<Output = ()> + Send; fn commit_with_map( &self, offset_map: HashMap<MessageQueue, i64>, persist: bool, ) -> impl Future<Output = ()> + Send; fn commit_with_set( &self, message_queues: HashSet<MessageQueue>, persist: bool, ) -> impl Future<Output = ()> + Send; fn committed( &self, message_queue: &MessageQueue, ) -> impl Future<Output = RocketMQResult<i64>> + Send; fn register_topic_message_queue_change_listener<TL>( &self, topic: &str, listener: TL, ) -> impl Future<Output = RocketMQResult<()>> + Send where TL: TopicMessageQueueChangeListener; fn update_name_server_address( &self, name_server_address: &str, ) -> impl Future<Output = ()> + Send; fn seek_to_begin( &self, message_queue: &MessageQueue, ) -> impl Future<Output = RocketMQResult<()>> + Send; fn seek_to_end( &self, message_queue: &MessageQueue, ) -> impl Future<Output = RocketMQResult<()>> + Send;
}

Required Methods§

Source

fn start(&self) -> impl Future<Output = RocketMQResult<()>> + Send

Starts the LitePullConsumer.

§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.
Source

fn shutdown(&self) -> impl Future<Output = ()> + Send

Shuts down the LitePullConsumer.

Source

fn is_running(&self) -> impl Future<Output = bool> + Send

Checks if the LitePullConsumer is running.

§Returns
  • bool - true if the consumer is running, false otherwise.
Source

fn subscribe( &self, topic: &str, ) -> impl Future<Output = RocketMQResult<()>> + Send

Subscribes to a topic.

§Arguments
  • topic - The name of the topic to subscribe to.
§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.
Source

fn subscribe_with_expression( &self, topic: &str, sub_expression: &str, ) -> impl Future<Output = RocketMQResult<()>> + Send

Subscribes to a topic with a subscription expression.

§Arguments
  • topic - The name of the topic to subscribe to.
  • sub_expression - The subscription expression.
§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.
Source

fn subscribe_with_listener<MQL>( &self, topic: &str, sub_expression: &str, listener: MQL, ) -> impl Future<Output = RocketMQResult<()>> + Send

Subscribes to a topic with a subscription expression and a message queue listener.

§Arguments
  • topic - The name of the topic to subscribe to.
  • sub_expression - The subscription expression.
  • listener - The message queue listener.
§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.
Source

fn subscribe_with_selector( &self, topic: &str, selector: Option<MessageSelector>, ) -> impl Future<Output = RocketMQResult<()>> + Send

Subscribes to a topic with a message selector.

§Arguments
  • topic - The name of the topic to subscribe to.
  • selector - The message selector.
§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.
Source

fn unsubscribe(&self, topic: &str) -> impl Future<Output = ()> + Send

Unsubscribes from a topic.

§Arguments
  • topic - The name of the topic to unsubscribe from.
Source

fn assignment( &self, ) -> impl Future<Output = RocketMQResult<HashSet<MessageQueue>>> + Send

Retrieves the current assignment of message queues.

§Returns
  • rocketmq_error::RocketMQResult<HashSet<MessageQueue>> - A set of assigned message queues or an error.
Source

fn assign( &self, message_queues: Vec<MessageQueue>, ) -> impl Future<Output = ()> + Send

Assigns a list of message queues to the consumer.

§Arguments
  • message_queues - A vector of MessageQueue instances to assign.
Source

fn set_sub_expression_for_assign( &self, topic: &str, sub_expression: &str, ) -> impl Future<Output = ()> + Send

Sets the subscription expression for an assigned topic.

§Arguments
  • topic - The name of the topic.
  • sub_expression - The subscription expression.
Source

fn poll(&self) -> impl Future<Output = Vec<MessageExt>> + Send

Polls for messages.

§Returns
  • Vec<MessageExt> - A vector of polled messages.
Source

fn poll_with_timeout( &self, timeout: u64, ) -> impl Future<Output = Vec<MessageExt>> + Send

Polls for messages with a timeout.

§Arguments
  • timeout - The timeout duration in milliseconds.
§Returns
  • Vec<MessageExt> - A vector of polled messages.
Source

fn seek( &self, message_queue: &MessageQueue, offset: i64, ) -> impl Future<Output = RocketMQResult<()>> + Send

Seeks to a specific offset in a message queue.

§Arguments
  • message_queue - The message queue to seek.
  • offset - The offset to seek to.
§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.
Source

fn pause( &self, message_queues: Vec<MessageQueue>, ) -> impl Future<Output = ()> + Send

Pauses message consumption for the specified message queues.

§Arguments
  • message_queues - A vector of MessageQueue instances to pause.
Source

fn resume( &self, message_queues: Vec<MessageQueue>, ) -> impl Future<Output = ()> + Send

Resumes message consumption for the specified message queues.

§Arguments
  • message_queues - A vector of MessageQueue instances to resume.
Source

fn is_auto_commit(&self) -> impl Future<Output = bool> + Send

Checks if auto-commit is enabled.

§Returns
  • bool - true if auto-commit is enabled, false otherwise.
Source

fn set_auto_commit(&self, auto_commit: bool) -> impl Future<Output = ()> + Send

Sets the auto-commit mode.

§Arguments
  • auto_commit - true to enable auto-commit, false to disable it.
Source

fn fetch_message_queues( &self, topic: &str, ) -> impl Future<Output = RocketMQResult<Vec<MessageQueue>>> + Send

Fetches the message queues for a topic.

§Arguments
  • topic - The name of the topic.
§Returns
  • rocketmq_error::RocketMQResult<Vec<MessageQueue>> - A vector of message queues or an error.
Source

fn offset_for_timestamp( &self, message_queue: &MessageQueue, timestamp: u64, ) -> impl Future<Output = RocketMQResult<i64>> + Send

Retrieves the offset for a given timestamp in a message queue.

§Arguments
  • message_queue - The message queue to query.
  • timestamp - The timestamp to query the offset for.
§Returns
  • rocketmq_error::RocketMQResult<i64> - The offset corresponding to the given timestamp or an error.
Source

fn commit_sync(&self) -> impl Future<Output = ()> + Send

Commits the current offsets synchronously.

Source

fn commit_sync_with_map( &self, offset_map: HashMap<MessageQueue, i64>, persist: bool, ) -> impl Future<Output = ()> + Send

Commits the provided offsets synchronously.

§Arguments
  • offset_map - A map of message queues to offsets.
  • persist - Whether to persist the offsets.
Source

fn commit(&self) -> impl Future<Output = ()> + Send

Commits the current offsets.

Source

fn commit_with_map( &self, offset_map: HashMap<MessageQueue, i64>, persist: bool, ) -> impl Future<Output = ()> + Send

Commits the provided offsets.

§Arguments
  • offset_map - A map of message queues to offsets.
  • persist - Whether to persist the offsets.
Source

fn commit_with_set( &self, message_queues: HashSet<MessageQueue>, persist: bool, ) -> impl Future<Output = ()> + Send

Commits the offsets for the provided message queues.

§Arguments
  • message_queues - A set of message queues to commit offsets for.
  • persist - Whether to persist the offsets.
Source

fn committed( &self, message_queue: &MessageQueue, ) -> impl Future<Output = RocketMQResult<i64>> + Send

Retrieves the committed offset for a message queue.

§Arguments
  • message_queue - The message queue to query.
§Returns
  • rocketmq_error::RocketMQResult<i64> - The committed offset or an error.
Source

fn register_topic_message_queue_change_listener<TL>( &self, topic: &str, listener: TL, ) -> impl Future<Output = RocketMQResult<()>> + Send

Registers a listener for changes to the message queues of a topic.

§Arguments
  • topic - The name of the topic.
  • listener - The listener to register.
§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.
Source

fn update_name_server_address( &self, name_server_address: &str, ) -> impl Future<Output = ()> + Send

Updates the name server address.

§Arguments
  • name_server_address - The new name server address.
Source

fn seek_to_begin( &self, message_queue: &MessageQueue, ) -> impl Future<Output = RocketMQResult<()>> + Send

Seeks to the beginning of a message queue.

§Arguments
  • message_queue - The message queue to seek.
§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.
Source

fn seek_to_end( &self, message_queue: &MessageQueue, ) -> impl Future<Output = RocketMQResult<()>> + Send

Seeks to the end of a message queue.

§Arguments
  • message_queue - The message queue to seek.
§Returns
  • rocketmq_error::RocketMQResult<()> - An empty result indicating success or failure.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§