Skip to main content

DefaultLitePullConsumer

Struct DefaultLitePullConsumer 

Source
pub struct DefaultLitePullConsumer { /* private fields */ }
Expand description

Default implementation of a lite pull consumer.

This is the main entry point for creating and using a lite pull consumer. It acts as a facade over the internal implementation (DefaultLitePullConsumerImpl) and provides:

  • Configuration management via DefaultLitePullConsumerBuilder
  • Namespace handling (automatic topic name wrapping/unwrapping)
  • Optional message trace integration
  • A clean public API that delegates to the internal implementation

§Architecture

┌────────────────────────────────────┐
│   DefaultLitePullConsumer          │  ← Public Facade
│  (config, trace, namespace)        │
└──────────────┬─────────────────────┘
               │ delegates
               ↓
┌────────────────────────────────────┐
│ DefaultLitePullConsumerImpl        │  ← Core Logic
│  (lifecycle, pull, commit, etc.)   │
└────────────────────────────────────┘

§Examples

§Basic usage with auto-commit

ⓘ
use rocketmq_client::DefaultLitePullConsumer;

let consumer = DefaultLitePullConsumer::builder(client_runtime.clone())
    .consumer_group("my_consumer_group")
    .name_server_addr("127.0.0.1:9876")
    .auto_commit(true)
    .build()?;

consumer.start().await?;
consumer.subscribe("my_topic").await?;

loop {
    let messages = consumer.poll_with_timeout(1000).await;
    for msg in messages {
        println!("Received: {:?}", msg);
    }
    // Offsets are auto-committed
}

§Manual offset control

ⓘ
let consumer = DefaultLitePullConsumer::builder(client_runtime.clone())
    .consumer_group("my_consumer_group")
    .name_server_addr("127.0.0.1:9876")
    .auto_commit(false)  // Disable auto-commit
    .build()?;

consumer.start().await?;
consumer.subscribe("my_topic").await?;

loop {
    let messages = consumer.poll_with_timeout(1000).await;
    for msg in messages {
        // Process message
    }
     
    // Manually commit after processing
    consumer.commit_all().await?;
}

§Manual queue assignment (no rebalance)

ⓘ
use rocketmq_model::common::message::message_queue::MessageQueue;

let mq1 = MessageQueue::from_parts("my_topic", "broker-a", 0);
let mq2 = MessageQueue::from_parts("my_topic", "broker-a", 1);

consumer.start().await?;
consumer.assign(vec![mq1, mq2]).await?;

let messages = consumer.poll().await;

Implementations§

Source§

impl DefaultLitePullConsumer

Source

pub fn new( client_runtime: Arc<ClientRuntime>, client_config: ClientConfig, consumer_config: LitePullConsumerConfig, rpc_hook: Option<Arc<dyn RPCHook>>, trace_dispatcher: Option<Arc<dyn TraceDispatcher + Send + Sync>>, enable_msg_trace: bool, custom_trace_topic: Option<CheetahString>, ) -> Self

Creates a new consumer with the specified configuration.

Most users should use builder() instead.

Source

pub fn builder( client_runtime: Arc<ClientRuntime>, ) -> DefaultLitePullConsumerBuilder

Returns a builder for creating a consumer with custom configuration.

§Examples
ⓘ
let consumer = DefaultLitePullConsumer::builder(client_runtime.clone())
    .consumer_group("my_group")
    .name_server_addr("127.0.0.1:9876")
    .pull_batch_size(32)
    .build()?;
Source

pub async fn start(&self) -> ClientResult<()>

Starts the consumer.

Source

pub async fn shutdown(&self)

Shuts down the consumer.

Source

pub async fn is_running(&self) -> bool

Returns whether the consumer is currently running.

Source

pub async fn consumer_running_info(&self) -> ClientResult<ConsumerRunningInfo>

Returns a Java-compatible running snapshot for broker admin diagnostics.

Source

pub async fn subscribe(&self, topic: &str) -> ClientResult<()>

Subscribes to a topic using the default subscription expression.

Source

pub async fn subscribe_with_expression( &self, topic: &str, sub_expression: &str, ) -> ClientResult<()>

Subscribes to a topic using a tag or SQL expression.

Source

pub async fn subscribe_with_listener<MQL>( &self, topic: &str, sub_expression: &str, listener: MQL, ) -> ClientResult<()>
where MQL: MessageQueueListener + 'static,

Subscribes with a queue-change listener.

Source

pub async fn subscribe_with_selector( &self, topic: &str, selector: Option<MessageSelector>, ) -> ClientResult<()>

Subscribes using a server-side selector.

Source

pub async fn unsubscribe(&self, topic: &str)

Removes the subscription for a topic.

Source

pub async fn assignment(&self) -> ClientResult<HashSet<MessageQueue>>

Returns the currently assigned queues.

Source

pub async fn assign( &self, message_queues: Vec<MessageQueue>, ) -> ClientResult<()>

Assigns queues manually, bypassing broker rebalance.

Source

pub async fn set_sub_expression_for_assign( &self, topic: &str, sub_expression: &str, ) -> ClientResult<()>

Sets the subscription expression used for manually assigned queues.

Source

pub async fn build_subscriptions_for_heartbeat( &self, sub_expression_map: &mut HashMap<String, MessageSelector>, ) -> ClientResult<()>

Builds subscription metadata for heartbeat payloads.

Source

pub async fn subscriptions_for_heartbeat(&self) -> HashSet<SubscriptionData>

Returns heartbeat subscriptions.

Source

pub async fn get_subscriptions_for_heartbeat(&self) -> HashSet<SubscriptionData>

Java-compatible getter alias for heartbeat subscriptions.

Source

pub async fn poll_zero_copy(&self) -> Vec<Arc<MessageExt>>

Polls messages without cloning message payloads.

Source

pub async fn poll_with_timeout_zero_copy( &self, timeout: u64, ) -> Vec<Arc<MessageExt>>

Polls messages without cloning message payloads with a custom timeout.

Source

pub async fn poll(&self) -> Vec<MessageExt>

Polls messages and returns owned copies.

Source

pub async fn poll_with_timeout(&self, timeout: u64) -> Vec<MessageExt>

Polls messages with a custom timeout and returns owned copies.

Source

pub async fn message_model(&self) -> MessageModel

Returns the configured message model.

Source

pub async fn get_message_model(&self) -> MessageModel

Java-compatible getter alias for the configured message model.

Source

pub async fn set_message_model(&self, message_model: MessageModel)

Sets the configured message model.

Source

pub async fn consume_from_where(&self) -> ConsumeFromWhere

Returns where consumption starts when no offset exists.

Source

pub async fn get_consume_from_where(&self) -> ConsumeFromWhere

Java-compatible getter alias for where consumption starts when no offset exists.

Source

pub async fn set_consume_from_where( &self, consume_from_where: ConsumeFromWhere, ) -> ClientResult<()>

Sets where consumption starts when no offset exists.

Source

pub async fn consume_timestamp(&self) -> Option<CheetahString>

Returns the consume timestamp.

Source

pub async fn get_consume_timestamp(&self) -> Option<CheetahString>

Java-compatible getter alias for the consume timestamp.

Source

pub async fn set_consume_timestamp( &self, consume_timestamp: Option<CheetahString>, )

Sets the consume timestamp.

Source

pub async fn allocate_message_queue_strategy( &self, ) -> Arc<dyn AllocateMessageQueueStrategy + Send + Sync> ⓘ

Returns the queue allocation strategy.

Source

pub async fn get_allocate_message_queue_strategy( &self, ) -> Arc<dyn AllocateMessageQueueStrategy + Send + Sync> ⓘ

Java-compatible getter alias for the queue allocation strategy.

Source

pub async fn set_allocate_message_queue_strategy( &self, allocate_message_queue_strategy: Arc<dyn AllocateMessageQueueStrategy + Send + Sync>, )

Sets the queue allocation strategy.

Source

pub async fn message_queue_listener(&self) -> Option<ArcMessageQueueListener>

Returns the message queue listener.

Source

pub async fn get_message_queue_listener( &self, ) -> Option<ArcMessageQueueListener>

Java-compatible getter alias for the message queue listener.

Source

pub async fn set_message_queue_listener( &self, message_queue_listener: Option<ArcMessageQueueListener>, )

Sets the message queue listener.

Source

pub async fn offset_store(&self) -> Option<Arc<OffsetStore>>

Returns the configured offset store.

Source

pub async fn get_offset_store(&self) -> Option<Arc<OffsetStore>>

Java-compatible getter alias for the configured offset store.

Source

pub async fn set_offset_store( &self, offset_store: Option<Arc<OffsetStore>>, ) -> ClientResult<()>

Sets the configured offset store.

Source

pub async fn topic_metadata_check_interval_millis(&self) -> u64

Returns the topic metadata check interval in milliseconds.

Source

pub async fn get_topic_metadata_check_interval_millis(&self) -> u64

Java-compatible getter alias for the topic metadata check interval.

Source

pub async fn set_topic_metadata_check_interval_millis( &self, interval_millis: u64, )

Sets the topic metadata check interval in milliseconds.

Source

pub async fn poll_timeout_millis(&self) -> u64

Returns the default poll timeout in milliseconds.

Source

pub async fn get_poll_timeout_millis(&self) -> u64

Java-compatible getter alias for the default poll timeout.

Source

pub async fn set_poll_timeout_millis(&self, timeout_millis: u64)

Sets the default poll timeout in milliseconds.

Source

pub async fn broker_suspend_max_time_millis(&self) -> u64

Returns the broker suspend max time in milliseconds.

Source

pub async fn get_broker_suspend_max_time_millis(&self) -> u64

Java-compatible getter alias for the broker suspend max time.

Source

pub async fn set_broker_suspend_max_time_millis(&self, timeout_millis: u64)

Sets the broker suspend max time in milliseconds.

Source

pub async fn consumer_timeout_millis_when_suspend(&self) -> u64

Returns the consumer timeout while suspended.

Source

pub async fn get_consumer_timeout_millis_when_suspend(&self) -> u64

Java-compatible getter alias for the consumer timeout while suspended.

Source

pub async fn set_consumer_timeout_millis_when_suspend( &self, timeout_millis: u64, )

Sets the consumer timeout while suspended.

Source

pub async fn consumer_pull_timeout_millis(&self) -> u64

Returns the pull RPC timeout in milliseconds.

Source

pub async fn get_consumer_pull_timeout_millis(&self) -> u64

Java-compatible getter alias for the pull RPC timeout.

Source

pub async fn set_consumer_pull_timeout_millis(&self, timeout_millis: u64)

Sets the pull RPC timeout in milliseconds.

Source

pub async fn pull_batch_size(&self) -> i32

Returns the pull batch size.

Source

pub async fn get_pull_batch_size(&self) -> i32

Java-compatible getter alias for the pull batch size.

Source

pub async fn set_pull_batch_size(&self, pull_batch_size: i32)

Sets the pull batch size.

Source

pub async fn pull_thread_nums(&self) -> usize

Returns the configured pull thread count.

Source

pub async fn get_pull_thread_nums(&self) -> usize

Java-compatible getter alias for the configured pull thread count.

Source

pub async fn set_pull_thread_nums(&self, pull_thread_nums: usize)

Sets the configured pull thread count.

Source

pub async fn try_set_pull_thread_nums( &self, pull_thread_nums: usize, ) -> ClientResult<()>

Sets the maximum number of concurrent broker pull RPCs before startup.

§Errors

Returns an error when pull_thread_nums is zero or the consumer has already started.

Source

pub async fn pull_threshold_for_all(&self) -> i64

Returns the all-queue pull threshold.

Source

pub async fn get_pull_threshold_for_all(&self) -> i64

Java-compatible getter alias for the all-queue pull threshold.

Source

pub async fn set_pull_threshold_for_all(&self, pull_threshold_for_all: i64)

Sets the all-queue pull threshold.

Source

pub async fn pull_threshold_for_queue(&self) -> i64

Returns the per-queue pull threshold.

Source

pub async fn get_pull_threshold_for_queue(&self) -> i64

Java-compatible getter alias for the per-queue pull threshold.

Source

pub async fn set_pull_threshold_for_queue(&self, pull_threshold_for_queue: i64)

Sets the per-queue pull threshold.

Source

pub async fn pull_threshold_size_for_queue(&self) -> i32

Returns the per-queue pull size threshold.

Source

pub async fn get_pull_threshold_size_for_queue(&self) -> i32

Java-compatible getter alias for the per-queue pull size threshold.

Source

pub async fn set_pull_threshold_size_for_queue( &self, pull_threshold_size_for_queue: i32, )

Sets the per-queue pull size threshold.

Source

pub async fn consume_max_span(&self) -> i64

Returns the max consume span.

Source

pub async fn get_consume_max_span(&self) -> i64

Java-compatible getter alias for the max consume span.

Source

pub async fn set_consume_max_span(&self, consume_max_span: i64)

Sets the max consume span.

Source

pub async fn is_connect_broker_by_user(&self) -> bool

Returns whether pulls use the configured broker id.

Source

pub async fn set_connect_broker_by_user(&self, connect_broker_by_user: bool)

Sets whether pulls use the configured broker id.

Source

pub async fn default_broker_id(&self) -> u64

Returns the configured default broker id.

Source

pub async fn get_default_broker_id(&self) -> u64

Java-compatible getter alias for the configured default broker id.

Source

pub async fn set_default_broker_id(&self, broker_id: u64)

Sets the configured default broker id.

Source

pub async fn fetch_message_queues( &self, topic: &str, ) -> ClientResult<Vec<MessageQueue>>

Fetches message queues for a topic.

Source

pub async fn committed(&self, message_queue: &MessageQueue) -> ClientResult<i64>

Returns the committed offset for a queue.

Source

pub async fn commit_all(&self) -> ClientResult<()>

Commits all offsets to the configured offset store.

Source

pub async fn commit_with_map( &self, offset_map: HashMap<MessageQueue, i64>, persist: bool, )

Commits explicit offsets.

Source

pub async fn commit(&self)

Commits all offsets.

Source

pub async fn commit_with_set( &self, message_queues: HashSet<MessageQueue>, persist: bool, )

Commits offsets for selected queues.

Source

pub async fn commit_sync(&self)

Java-compatible alias for committing all offsets.

Source

pub async fn commit_sync_with_map( &self, offset_map: HashMap<MessageQueue, i64>, persist: bool, )

Java-compatible alias for committing explicit offsets.

Source

pub async fn is_auto_commit(&self) -> bool

Returns whether auto commit is enabled.

Source

pub async fn set_auto_commit(&self, auto_commit: bool)

Sets whether auto commit is enabled.

Source

pub async fn is_unit_mode(&self) -> bool

Returns whether unit mode is enabled.

Source

pub async fn set_unit_mode(&self, unit_mode: bool)

Sets whether unit mode is enabled.

Source

pub async fn auto_commit_interval_millis(&self) -> u64

Returns the auto commit interval in milliseconds.

Source

pub async fn get_auto_commit_interval_millis(&self) -> u64

Java-compatible getter alias for the auto commit interval.

Source

pub async fn set_auto_commit_interval_millis(&self, interval_millis: u64)

Sets the auto commit interval in milliseconds.

Source

pub async fn offset_for_timestamp( &self, message_queue: &MessageQueue, timestamp: u64, ) -> ClientResult<i64>

Queries the offset for a timestamp.

Source

pub async fn earliest_msg_store_time( &self, message_queue: &MessageQueue, ) -> ClientResult<i64>

Queries the earliest store time for a queue.

Source

pub async fn max_offset( &self, message_queue: &MessageQueue, ) -> ClientResult<i64>

Queries the broker max offset for a queue.

Source

pub async fn min_offset( &self, message_queue: &MessageQueue, ) -> ClientResult<i64>

Queries the broker min offset for a queue.

Source

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

Creates a topic through the Java-compatible MQAdmin facade.

Source

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

Creates a topic with an explicit topic system flag.

Source

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

Queries messages by key in a time range.

Source

pub async fn view_message( &self, topic: &str, msg_id: &str, ) -> ClientResult<MessageExt>

Views a message by offset message id or Java-compatible unique message id.

Source

pub async fn pause(&self, message_queues: Vec<MessageQueue>)

Pauses fetching from selected queues.

Source

pub async fn resume(&self, message_queues: Vec<MessageQueue>)

Resumes fetching from selected queues.

Source

pub async fn is_paused(&self, message_queue: &MessageQueue) -> bool

Returns whether a queue is paused.

Source

pub async fn seek( &self, message_queue: &MessageQueue, offset: i64, ) -> ClientResult<()>

Seeks a queue to an offset.

Source

pub async fn seek_to_begin( &self, message_queue: &MessageQueue, ) -> ClientResult<()>

Seeks a queue to the beginning.

Source

pub async fn seek_to_end( &self, message_queue: &MessageQueue, ) -> ClientResult<()>

Seeks a queue to the end.

Source

pub async fn update_name_server_address(&self, name_server_address: &str)

Updates the name server address.

Source

pub async fn register_topic_message_queue_change_listener<TL>( &self, topic: &str, listener: TL, ) -> ClientResult<()>
where TL: TopicMessageQueueChangeListener + 'static,

Registers a topic queue-change listener.

Source

pub fn consumer_group(&self) -> CheetahString

Returns the consumer group name from the current immutable configuration snapshot.

Source

pub fn get_consumer_group(&self) -> CheetahString

Java-compatible getter alias for the consumer group name.

Source

pub fn set_consumer_group( &self, consumer_group: impl Into<CheetahString>, ) -> ClientResult<()>

Sets the consumer group name before the consumer starts.

Like Java DefaultLitePullConsumer.setConsumerGroup, this updates the facade configuration. If the internal implementation has already been initialized, the value is synchronized into the impl and rebalance configuration while it is still in the create state.

Source

pub fn namespace(&self) -> Option<CheetahString>

Returns the namespace (if configured).

Source

pub fn customized_trace_topic(&self) -> Option<CheetahString>

Returns the custom trace topic, if configured.

Source

pub fn get_customized_trace_topic(&self) -> Option<CheetahString>

Java-compatible getter alias for the custom trace topic.

Source

pub fn set_customized_trace_topic( &mut self, customized_trace_topic: impl Into<CheetahString>, )

Sets the custom trace topic used when message tracing is enabled.

Source

pub fn clear_customized_trace_topic(&mut self)

Clears the custom trace topic so the default system trace topic is used.

Source

pub fn is_enable_msg_trace(&self) -> bool

Returns whether message trace is enabled.

Source

pub fn set_enable_msg_trace(&mut self, enable_msg_trace: bool)

Enables or disables message trace for subsequent startup.

Source

pub fn is_use_tls(&self) -> bool

Returns whether outbound remoting connections should use TLS.

Source

pub async fn set_use_tls(&self, use_tls: bool)

Enables or disables TLS on the published client configuration and trace dispatcher.

Source

pub async fn trace_dispatcher( &self, ) -> Option<Arc<dyn TraceDispatcher + Send + Sync>>

Returns the trace dispatcher, if tracing has been configured or initialized.

Source

pub async fn get_trace_dispatcher( &self, ) -> Option<Arc<dyn TraceDispatcher + Send + Sync>>

Java-compatible getter alias for the trace dispatcher.

Source

pub fn client_config(&self) -> Arc<ClientConfig> ⓘ

Returns the current immutable client configuration snapshot.

Source

pub fn consumer_config(&self) -> Arc<LitePullConsumerConfig> ⓘ

Returns the current immutable consumer configuration snapshot.

Trait Implementations§

Source§

impl AssignmentControl for DefaultLitePullConsumer

Source§

async fn assignment(&self) -> ClientResult<HashSet<MessageQueue>>

Returns the set of MessageQueues currently assigned to this consumer. Read more
Source§

async fn assign(&self, message_queues: Vec<MessageQueue>) -> ClientResult<()>

Manually assigns the given MessageQueues to this consumer, bypassing broker rebalance. Read more
Source§

async fn set_sub_expression_for_assign( &self, topic: &str, sub_expression: &str, ) -> ClientResult<()>

Sets the subscription filter expression applied when fetching from manually assigned queues. Read more
Source§

async fn pause(&self, message_queues: Vec<MessageQueue>)

Suspends message fetching for the specified MessageQueues. Read more
Source§

async fn resume(&self, message_queues: Vec<MessageQueue>)

Resumes message fetching for the specified MessageQueues. Read more
Source§

async fn is_paused(&self, message_queue: &MessageQueue) -> bool

Checks whether a specific MessageQueue is currently paused. Read more
Source§

async fn seek( &self, message_queue: &MessageQueue, offset: i64, ) -> ClientResult<()>

Seeks the fetch position of the specified MessageQueue to the given offset. Read more
Source§

async fn seek_to_begin(&self, message_queue: &MessageQueue) -> ClientResult<()>

Seeks the fetch position of the specified MessageQueue to its earliest available offset. Read more
Source§

async fn seek_to_end(&self, message_queue: &MessageQueue) -> ClientResult<()>

Seeks the fetch position of the specified MessageQueue to its latest available offset. Read more
Source§

impl ClientSessionProvider for DefaultLitePullConsumer

Source§

impl Clone for DefaultLitePullConsumer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ConsumerLifecycle for DefaultLitePullConsumer

Source§

async fn start(&self) -> ClientResult<()>

Starts the consumer and establishes connections to the broker and name server. Read more
Source§

async fn shutdown(&self)

Shuts down the consumer and releases all associated resources. Read more
Source§

async fn is_running(&self) -> bool

Returns whether the consumer is currently in the running state. Read more
Source§

impl ConsumerOffsetControl for DefaultLitePullConsumer

Source§

async fn offset_store(&self) -> Option<Arc<OffsetStore>>

Returns the configured offset store, if one has been set or initialized.
Source§

async fn set_offset_store( &self, offset_store: Option<Arc<OffsetStore>>, ) -> ClientResult<()>

Sets the offset store used by the consumer. Read more
Source§

async fn fetch_message_queues( &self, topic: &str, ) -> ClientResult<Vec<MessageQueue>>

Queries the broker for all MessageQueues belonging to the specified topic. Read more
Source§

async fn committed(&self, message_queue: &MessageQueue) -> ClientResult<i64>

Returns the last committed offset for the specified MessageQueue. Read more
Source§

async fn commit_all(&self) -> ClientResult<()>

Commits all consumed offsets for all assigned queues to the local offset store. Read more
Source§

async fn commit_with_map( &self, offset_map: HashMap<MessageQueue, i64>, persist: bool, )

Commits the provided offsets asynchronously, optionally persisting them to the broker. Read more
Source§

async fn commit(&self)

Commits all consumed offsets to the consumer offset store. Read more
Source§

async fn commit_with_set( &self, message_queues: HashSet<MessageQueue>, persist: bool, )

Commits the offsets for the specified subset of assigned queues. Read more
Source§

async fn commit_sync(&self)

Commits all consumed offsets to the consumer offset store. Read more
Source§

async fn commit_sync_with_map( &self, offset_map: HashMap<MessageQueue, i64>, persist: bool, )

Commits the provided offsets and optionally persists them to the broker. Read more
Source§

async fn is_auto_commit(&self) -> bool

Returns whether automatic offset commit is enabled. Read more
Source§

async fn set_auto_commit(&self, auto_commit: bool)

Enables or disables automatic offset commit. Read more
Source§

async fn auto_commit_interval_millis(&self) -> u64

Returns the interval between automatic offset commits in milliseconds. Read more
Source§

async fn set_auto_commit_interval_millis(&self, interval_millis: u64)

Sets the interval between automatic offset commits in milliseconds. Read more
Source§

async fn offset_for_timestamp( &self, message_queue: &MessageQueue, timestamp: u64, ) -> ClientResult<i64>

Queries the broker for the offset corresponding to the given timestamp in a queue. Read more
Source§

async fn earliest_msg_store_time( &self, message_queue: &MessageQueue, ) -> ClientResult<i64>

Queries the broker for the earliest message store time of the specified queue. Read more
Source§

async fn max_offset(&self, message_queue: &MessageQueue) -> ClientResult<i64>

Queries the broker for the current maximum offset of the specified queue. Read more
Source§

async fn min_offset(&self, message_queue: &MessageQueue) -> ClientResult<i64>

Queries the broker for the current minimum offset of the specified queue. Read more
Source§

impl MQConsumer for DefaultLitePullConsumer

Source§

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

Creates a topic through the consumer’s admin facade. Read more
Source§

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

Creates a topic with an explicit topic system flag.
Source§

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

Queries messages by key in a time range.
Source§

async fn view_message( &mut self, topic: &str, msg_id: &str, ) -> ClientResult<MessageExt>

Views a message by message id.
Source§

async fn send_message_back( &mut self, _msg: MessageExt, _delay_level: i32, _broker_name: &str, ) -> ClientResult<()>

Source§

async fn fetch_subscribe_message_queues( &mut self, topic: &str, ) -> ClientResult<Vec<MessageQueue>>

Source§

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

Searches the offset in a queue by store timestamp.
Source§

async fn max_offset(&mut self, mq: &MessageQueue) -> ClientResult<i64>

Returns the broker max offset for a queue.
Source§

async fn min_offset(&mut self, mq: &MessageQueue) -> ClientResult<i64>

Returns the broker min offset for a queue.
Source§

async fn earliest_msg_store_time( &mut self, mq: &MessageQueue, ) -> ClientResult<i64>

Returns the earliest store time for messages in a queue.
Source§

async fn send_message_back_to_origin_broker( &mut self, msg: MessageExt, delay_level: i32, ) -> ClientResult<()>

Sends a message back using the broker name carried by the message. Read more
Source§

impl MessagePoll for DefaultLitePullConsumer

Source§

async fn poll_zero_copy(&self) -> Vec<Arc<MessageExt>>

Zero-copy implementation.

Source§

async fn poll_with_timeout_zero_copy( &self, timeout: u64, ) -> Vec<Arc<MessageExt>>

Zero-copy implementation with custom timeout.

Source§

async fn poll(&self) -> Vec<MessageExt>

Delegates to zero-copy implementation and creates owned message copies.

Source§

async fn poll_with_timeout(&self, timeout: u64) -> Vec<MessageExt>

Delegates to zero-copy implementation with timeout and creates owned message copies.

Source§

async fn poll_timeout_millis(&self) -> u64

Returns the default timeout used by poll in milliseconds. Read more
Source§

async fn set_poll_timeout_millis(&self, timeout_millis: u64)

Sets the default timeout used by poll in milliseconds. Read more
Source§

async fn broker_suspend_max_time_millis(&self) -> u64

Returns the maximum time that the broker may suspend a long-poll pull request.
Source§

async fn set_broker_suspend_max_time_millis(&self, timeout_millis: u64)

Sets the maximum time that the broker may suspend a long-poll pull request. Read more
Source§

async fn consumer_timeout_millis_when_suspend(&self) -> u64

Returns the consumer-side timeout for suspended long-poll pull requests.
Source§

async fn set_consumer_timeout_millis_when_suspend(&self, timeout_millis: u64)

Sets the consumer-side timeout for suspended long-poll pull requests. Read more
Source§

async fn consumer_pull_timeout_millis(&self) -> u64

Returns the RPC timeout used by lite pull requests in milliseconds.
Source§

async fn set_consumer_pull_timeout_millis(&self, timeout_millis: u64)

Sets the RPC timeout used by lite pull requests in milliseconds. Read more
Source§

async fn pull_batch_size(&self) -> i32

Returns the maximum number of messages requested in a single pull.
Source§

async fn set_pull_batch_size(&self, pull_batch_size: i32)

Sets the maximum number of messages requested in a single pull. Read more
Source§

async fn pull_thread_nums(&self) -> usize

Returns the configured number of pull worker threads.
Source§

async fn set_pull_thread_nums(&self, pull_thread_nums: usize)

Sets the configured number of pull worker threads. Read more
Source§

async fn pull_threshold_for_all(&self) -> i64

Returns the maximum total number of cached messages across all queues.
Source§

async fn set_pull_threshold_for_all(&self, pull_threshold_for_all: i64)

Sets the maximum total number of cached messages across all queues. Read more
Source§

async fn pull_threshold_for_queue(&self) -> i64

Returns the maximum cached message count for each queue.
Source§

async fn set_pull_threshold_for_queue(&self, pull_threshold_for_queue: i64)

Sets the maximum cached message count for each queue. Read more
Source§

async fn pull_threshold_size_for_queue(&self) -> i32

Returns the maximum cached message size in MiB for each queue.
Source§

async fn set_pull_threshold_size_for_queue( &self, pull_threshold_size_for_queue: i32, )

Sets the maximum cached message size in MiB for each queue. Read more
Source§

async fn consume_max_span(&self) -> i64

Returns the maximum allowed offset span in a cached process queue.
Source§

async fn set_consume_max_span(&self, consume_max_span: i64)

Sets the maximum allowed offset span in a cached process queue. Read more
Source§

impl SubscriptionControl for DefaultLitePullConsumer

Source§

async fn subscribe(&self, topic: &str) -> ClientResult<()>

Subscribes to the specified topic using the default subscription expression. Read more
Source§

async fn subscribe_with_expression( &self, topic: &str, sub_expression: &str, ) -> ClientResult<()>

Subscribes to the specified topic with a tag-based or SQL-based filter expression. Read more
Source§

async fn subscribe_with_listener<MQL>( &self, topic: &str, sub_expression: &str, listener: MQL, ) -> ClientResult<()>
where MQL: MessageQueueListener + 'static,

Subscribes to the specified topic with a filter expression and a queue-change listener. Read more
Source§

async fn subscribe_with_selector( &self, topic: &str, selector: Option<MessageSelector>, ) -> ClientResult<()>

Subscribes to the specified topic using a MessageSelector for server-side filtering. Read more
Source§

async fn unsubscribe(&self, topic: &str)

Removes the subscription for the specified topic. Read more
Source§

async fn build_subscriptions_for_heartbeat( &self, sub_expression_map: &mut HashMap<String, MessageSelector>, ) -> ClientResult<()>

Populates sub_expression_map with the filter selector for each subscribed topic, providing the subscription metadata required for heartbeat payloads. Read more
Source§

async fn subscriptions_for_heartbeat(&self) -> HashSet<SubscriptionData>

Returns the subscriptions currently advertised in heartbeat payloads.
Source§

async fn message_model(&self) -> MessageModel

Returns the configured message model.
Source§

async fn set_message_model(&self, message_model: MessageModel)

Sets the message model. Read more
Source§

async fn consume_from_where(&self) -> ConsumeFromWhere

Returns where consumption starts when no offset exists.
Source§

async fn set_consume_from_where( &self, consume_from_where: ConsumeFromWhere, ) -> ClientResult<()>

Sets where consumption starts when no offset exists. Read more
Source§

async fn consume_timestamp(&self) -> Option<CheetahString>

Returns the timestamp used by ConsumeFromWhere::ConsumeFromTimestamp.
Source§

async fn set_consume_timestamp(&self, consume_timestamp: Option<CheetahString>)

Sets the timestamp used by ConsumeFromWhere::ConsumeFromTimestamp.
Source§

async fn allocate_message_queue_strategy( &self, ) -> Arc<dyn AllocateMessageQueueStrategy + Send + Sync> ⓘ

Returns the message queue allocation strategy used during rebalance.
Source§

async fn set_allocate_message_queue_strategy( &self, allocate_message_queue_strategy: Arc<dyn AllocateMessageQueueStrategy + Send + Sync>, )

Sets the message queue allocation strategy used during rebalance. Read more
Source§

async fn message_queue_listener(&self) -> Option<ArcMessageQueueListener>

Returns the listener notified when rebalance changes assigned message queues.
Source§

async fn set_message_queue_listener( &self, message_queue_listener: Option<ArcMessageQueueListener>, )

Sets the listener notified when rebalance changes assigned message queues. Read more
Source§

async fn topic_metadata_check_interval_millis(&self) -> u64

Returns the topic metadata check interval in milliseconds.
Source§

async fn set_topic_metadata_check_interval_millis(&self, interval_millis: u64)

Sets the topic metadata check interval in milliseconds. Read more
Source§

async fn is_connect_broker_by_user(&self) -> bool

Returns whether pulls always use the configured default broker ID.
Source§

async fn set_connect_broker_by_user(&self, connect_broker_by_user: bool)

Sets whether pulls always use the configured default broker ID. Read more
Source§

async fn default_broker_id(&self) -> u64

Returns the broker ID used when user-controlled broker selection is enabled.
Source§

async fn set_default_broker_id(&self, broker_id: u64)

Sets the broker ID used when user-controlled broker selection is enabled. Read more
Source§

async fn is_unit_mode(&self) -> bool

Returns whether the subscription group runs in unit mode.
Source§

async fn set_unit_mode(&self, unit_mode: bool)

Sets whether the subscription group runs in unit mode. Read more
Source§

async fn update_name_server_address(&self, name_server_address: &str)

Updates the name server address used for topic route discovery. Read more
Source§

async fn register_topic_message_queue_change_listener<TL>( &self, topic: &str, listener: TL, ) -> ClientResult<()>
where TL: TopicMessageQueueChangeListener + 'static,

Registers a listener that is notified when the set of MessageQueues for a topic changes. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more