use super::*;
pub struct ProducerClient<'a> {
api: &'a MQClientAPIImpl,
}
impl ProducerClient<'_> {
pub async fn send_heartbeat(
&self,
addr: &CheetahString,
heartbeat_data: &HeartbeatData,
timeout_millis: u64,
) -> crate::ClientResult<(i32, Option<RemotingCommand>)> {
self.api.send_heartbeat(addr, heartbeat_data, timeout_millis).await
}
}
impl MQClientAPIImpl {
#[must_use]
pub fn producer_client(&self) -> ProducerClient<'_> {
ProducerClient { api: self }
}
pub async fn send_heartbeat_async(
&self,
addr: &CheetahString,
heartbeat_data: &HeartbeatData,
timeout_millis: u64,
) -> crate::ClientResult<i32> {
self.send_heartbeat(addr, heartbeat_data, timeout_millis)
.await
.map(|(version, _)| version)
}
}