Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[ISSUE #1430] Add TopicMessageQueueChangeListener trait for client #1431

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rocketmq-client/src/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ pub mod pull_result;
pub mod pull_status;
pub mod rebalance_strategy;
pub(crate) mod store;
pub mod topic_message_queue_change_listener;
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
use std::collections::HashSet;

use rocketmq_common::common::message::message_queue::MessageQueue;

/// A trait for listening to changes in the message queues of a specific topic.
pub trait TopicMessageQueueChangeListener: Send + Sync {
/// Called when the message queues for a topic have changed.
///
/// # Arguments
///
/// * `topic` - The name of the topic whose message queues have changed.
/// * `message_queues` - A set of `MessageQueue` instances representing the new state of the
/// message queues.
fn on_changed(&self, topic: &str, message_queues: HashSet<MessageQueue>);
}
Loading