rocketmq_client_rust/implementation/mq_client_api_impl/
producer_client.rs1use super::*;
16
17pub struct ProducerClient<'a> {
18 api: &'a MQClientAPIImpl,
19}
20
21impl ProducerClient<'_> {
22 pub async fn send_heartbeat(
23 &self,
24 addr: &CheetahString,
25 heartbeat_data: &HeartbeatData,
26 timeout_millis: u64,
27 ) -> crate::ClientResult<(i32, Option<RemotingCommand>)> {
28 self.api.send_heartbeat(addr, heartbeat_data, timeout_millis).await
29 }
30}
31
32impl MQClientAPIImpl {
33 #[must_use]
34 pub fn producer_client(&self) -> ProducerClient<'_> {
35 ProducerClient { api: self }
36 }
37
38 pub async fn send_heartbeat_async(
39 &self,
40 addr: &CheetahString,
41 heartbeat_data: &HeartbeatData,
42 timeout_millis: u64,
43 ) -> crate::ClientResult<i32> {
44 self.send_heartbeat(addr, heartbeat_data, timeout_millis)
45 .await
46 .map(|(version, _)| version)
47 }
48}