rocketmq_remoting/protocol/body/
check_client_request_body.rs

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18use serde::Deserialize;
19use serde::Serialize;
20
21use crate::protocol::heartbeat::subscription_data::SubscriptionData;
22
23#[derive(Serialize, Deserialize, Debug)]
24#[serde(rename_all = "camelCase")]
25pub struct CheckClientRequestBody {
26    pub client_id: String,
27    pub group: String,
28    pub subscription_data: SubscriptionData,
29    pub namespace: Option<String>,
30}
31
32impl CheckClientRequestBody {
33    pub fn new(client_id: String, group: String, subscription_data: SubscriptionData) -> Self {
34        Self {
35            client_id,
36            group,
37            subscription_data,
38            namespace: None,
39        }
40    }
41
42    pub fn get_client_id(&self) -> &String {
43        &self.client_id
44    }
45
46    pub fn set_client_id(&mut self, client_id: String) {
47        self.client_id = client_id;
48    }
49
50    pub fn get_group(&self) -> &String {
51        &self.group
52    }
53
54    pub fn set_group(&mut self, group: String) {
55        self.group = group;
56    }
57
58    pub fn get_subscription_data(&self) -> &SubscriptionData {
59        &self.subscription_data
60    }
61
62    pub fn set_subscription_data(&mut self, subscription_data: SubscriptionData) {
63        self.subscription_data = subscription_data;
64    }
65}