Skip to content

Commit

Permalink
[ISSUE #1380]💫Add QueryConsumeQueueResponseBody (#2121)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm authored Jan 6, 2025
1 parent 00ca74c commit c6cd91f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions rocketmq-remoting/src/protocol/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub mod process_queue_info;
pub mod producer_connection;
pub mod query_assignment_request_body;
pub mod query_assignment_response_body;
pub mod query_consume_queue_response_body;
pub mod queue_time_span;
pub mod request;
pub mod response;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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 cheetah_string::CheetahString;
use serde::Deserialize;
use serde::Serialize;

use crate::protocol::body::consume_queue_data::ConsumeQueueData;
use crate::protocol::heartbeat::subscription_data::SubscriptionData;

#[derive(Serialize, Deserialize, Debug, Clone, Default)]
#[serde(rename_all = "camelCase")]
pub struct QueryConsumeQueueResponseBody {
subscription_data: SubscriptionData,
filter_data: CheetahString,
queue_data: Vec<ConsumeQueueData>,
max_queue_index: i64,
min_queue_index: i64,
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn query_consume_queue_response_body_default_values() {
let response_body: QueryConsumeQueueResponseBody = Default::default();
assert_eq!(response_body.subscription_data, SubscriptionData::default());
assert_eq!(response_body.filter_data, "");
assert!(response_body.queue_data.is_empty());
assert_eq!(response_body.max_queue_index, 0);
assert_eq!(response_body.min_queue_index, 0);
}
}

0 comments on commit c6cd91f

Please # to comment.