# Message acknowledegement

**URL:** <https://community.hivemq.com/t/message-acknowledegement/1157>\
**Category:** HiveMQ Community Edition\
**Created:** [April 21, 2022, 1:38pm UTC](https://community.hivemq.com/t/message-acknowledegement/1157 "2022-04-21T13:38:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![girishgsv](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@girishgsv](https://community.hivemq.com/u/girishgsv)\
**Post date:** [April 21, 2022, 1:38pm UTC](https://community.hivemq.com/t/message-acknowledegement/1157/1 "2022-04-21T13:38:41Z")

</div>

I need to get the acknowledgement from the receiver, How I can achieve this in HiveMQ.  
I am trying to get the acknowledgement using ReponseTopic and CorrelatioData properties but I am not getting this two property data. I am using mqttnet library to achieve this.  
Please asist.

---

<div class="post-metadata">

**Author:** ![michael\_w](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/michael_w/32/200_2.png) [@michael\_w](https://community.hivemq.com/u/michael_w)\
**Post date:** [April 22, 2022, 9:00am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/2 "2022-04-22T09:00:34Z")

</div>

Hi @girishgsv,

where do you need to get the acknowledgement exactly?  
Also which ack do you mean:  
a) when you publish a message from a client to HiveMQ  
b) when HiveMQ sends the message to the subscriber?

Greetings,  
Michael

---

<div class="post-metadata">

**Author:** ![girishgsv](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@girishgsv](https://community.hivemq.com/u/girishgsv)\
**Post date:** [April 22, 2022, 9:03am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/3 "2022-04-22T09:03:18Z")

</div>

I need acknowledgement from Subscriber to Publisher.

---

<div class="post-metadata">

**Author:** ![michael\_w](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/michael_w/32/200_2.png) [@michael\_w](https://community.hivemq.com/u/michael_w)\
**Post date:** [April 22, 2022, 9:47am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/4 "2022-04-22T09:47:46Z")

</div>

So does that mean:

- subscriber X gets a message from HiveMQ
- subscriber X sends acknowledgement to the publisher Y that sent the message to HiveMQ (that was sent so subscriber X)?

I fear this is not possible out of the box because the message flow from, Publisher → HiveMQ and HiveMQ → Subscriber are decoupled (see section “The publish/subscribe pattern” [here](https://www.hivemq.com/blog/mqtt-essentials-part2-publish-subscribe/)).

Before we try to find a way forward I need to understand your problem more clearly.

---

<div class="post-metadata">

**Author:** ![girishgsv](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@girishgsv](https://community.hivemq.com/u/girishgsv)\
**Post date:** [April 22, 2022, 11:12am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/5 "2022-04-22T11:12:50Z")

</div>

Publisher Y publishes the message and subscriber X receives the message.  
Once subscriber X receives the message successfully then subscriber X should send the acknowledgement to publisher Y (that is has received the message).  
I found there is article for End to End Acknowledgement, see below link,

> **[MQTT 5: How the Response Topic, Correlation Data, and Response Information...](https://www.hivemq.com/blog/mqtt5-essentials-part9-request-response-pattern/)**
>
> Response topics and correlation data enable request-response patterns in MQTT 5. That's important. Learn why.

---

<div class="post-metadata">

**Author:** ![michael\_w](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.hivemq.com/michael_w/32/200_2.png) [@michael\_w](https://community.hivemq.com/u/michael_w)\
**Post date:** [April 22, 2022, 11:32am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/6 "2022-04-22T11:32:41Z")

</div>

Well this is not possible out of the box.  
The publisher gets an acknowledgment from the broker the moment the broker stored the publish message in it’s system. At this time the message was most likely not sent to the subscriber yet.

The only thing you can do is to work, as you already mentioned, with the “ReponseTopic” (RT).  
The publisher adds the RT to his publish message, the broker forwards the RT with the publish message to the subscriber. Now the subscriber can extract the RT and send his own publish message, which acts as a ACK message, to the publisher.

As response topic is an MQTT 5 feature make sure you use the correct client from the mqttnet library, see: [The "ResponseTopic" property of MqttApplicationMessage is not transferred · Issue #808 · dotnet/MQTTnet · GitHub](https://github.com/dotnet/MQTTnet/issues/808)

EDIT: Yes, exactly like in the code snippet of the blog post you linked

---

<div class="post-metadata">

**Author:** ![girishgsv](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@girishgsv](https://community.hivemq.com/u/girishgsv)\
**Post date:** [April 22, 2022, 1:42pm UTC](https://community.hivemq.com/t/message-acknowledegement/1157/7 "2022-04-22T13:42:54Z")

</div>

I got your point. Thanks for clarification.

We have below requirement, If you can assist how to achieve this then it will be helpful,  
=\> Once subscriber receive the message, it does some processing on the message, once processing is done then publisher should know the message is processed at subscriber end. and it should be relayed to correct publisher.

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [April 22, 2022, 3:30pm UTC](https://community.hivemq.com/t/message-acknowledegement/1157/8 "2022-04-22T15:30:50Z")

</div>

Hey @girishgsv ,

In order for you to utilise ReponseTopic feature of MQTT v5, you need to make sure that your client library that you use supports MQTT v5 and / or this feature. For example, the HiveMQ MQTT Client library.  
Your client1 should implement the logic:  
once I receive a message on Topic1, I get the Response Topic from the message, then I do some processing, once processing is done, I publish my confirmation message to the Response Topic.  
You client2 should then subscribe itself to the Response Topic and then start publishing to the Topic1. Once the client1 responds the client2 will receive message on the Response Topic.

Please note that both clients should support MQTT v5 in order to utilise the Response Topic functionality.

For more info on MQTT v5 Response topic feature: [Request - Response Pattern - MQTT 5 Essentials Part 9](https://www.hivemq.com/blog/mqtt5-essentials-part9-request-response-pattern/)  
For a working example of Request-Response pattern: [hivemq-mqtt-client/RequestResponse.java at master · hivemq/hivemq-mqtt-client · GitHub](https://github.com/hivemq/hivemq-mqtt-client/blob/master/examples/src/main/java/com/hivemq/client/mqtt/examples/RequestResponse.java)

I hope this helps 🙂  
Regards,  
Dasha from HiveMQ team

---

<div class="post-metadata">

**Author:** ![girishgsv](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@girishgsv](https://community.hivemq.com/u/girishgsv)\
**Post date:** [April 25, 2022, 2:37pm UTC](https://community.hivemq.com/t/message-acknowledegement/1157/9 "2022-04-25T14:37:32Z")

</div>

Thanks for your reply, but client1 and client2 example is confusing. Could you please elaborate more.  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [April 25, 2022, 5:07pm UTC](https://community.hivemq.com/t/message-acknowledegement/1157/10 "2022-04-25T17:07:58Z")

</div>

> [@girishgsv](#):
>
> I am trying to get the acknowledgement using ReponseTopic and CorrelatioData properties but I am not getting this two property data. I am using mqttnet library to achieve this.

ReponseTopic and CorrelatioData are MQTT v5 features. In order to utilise ReponseTopic and CorrelatioData, you need to make sure that your client and broker support MQTT v5.

I quickly searched “[ResponseTopic](https://github.com/dotnet/MQTTnet/search?q=responsetopic)” in [this](https://github.com/dotnet/MQTTnet) MQTTnet library and found an example of a client sending a response to the responseTopic here: [https://github.com/dotnet/MQTTnet/blob/d98129481a0bb39572cb5f0a583655f828bb621c/Source/MQTTnet.Extensions.Rpc/SampleCCode.c](https://github.com/dotnet/MQTTnet/blob/d98129481a0bb39572cb5f0a583655f828bb621c/Source/MQTTnet.Extensions.Rpc/SampleCCode.c)

Your client should implement a similar callback function as in this example.

I hope this helps,  
Dasha from HiveMQ team

---

<div class="post-metadata">

**Author:** ![girishgsv](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@girishgsv](https://community.hivemq.com/u/girishgsv)\
**Post date:** [April 26, 2022, 11:22am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/11 "2022-04-26T11:22:52Z")

</div>

Thanks for your reply.  
Can we use MQTTnet library in .net framework? Do you have any documentation about how to use .MQTTnet library in .net framework

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [April 26, 2022, 6:21pm UTC](https://community.hivemq.com/t/message-acknowledegement/1157/12 "2022-04-26T18:21:28Z")

</div>

Yes @girishgsv , you can, please refer yourself to theses examples: [MQTTnet/Client\_Connection\_Samples.cs at master · dotnet/MQTTnet · GitHub](https://github.com/dotnet/MQTTnet/blob/master/Samples/Client/Client_Connection_Samples.cs)

I hope this helps  
Dasha from HiveMQ team

---

<div class="post-metadata">

**Author:** ![girishgsv](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@girishgsv](https://community.hivemq.com/u/girishgsv)\
**Post date:** [April 27, 2022, 11:54am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/13 "2022-04-27T11:54:41Z")

</div>

From your referenced link, I downloaded the project and it uses MQTTnet project.  
In your previous comment it is mentioned that RT is supported in MQTT v5 and you have given reference of “HiveMQ MQTT Client library”. I wanted to ask whether HIveMQ provide client library for .net that supports MQTT v5.  
We are using MQTTnet library available on nuget, but this library still have v3.1.1, 5.0 is still under pre-release.  
Please assist how to go ahead.

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [April 27, 2022, 11:58am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/14 "2022-04-27T11:58:46Z")

</div>

Hi @girishgsv

HiveMQ is providing Java library [GitHub - hivemq/hivemq-mqtt-client: HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support](https://github.com/hivemq/hivemq-mqtt-client)  
HiveMQ is not providing .net library.

I hope that answers your questions,  
Dasha from HiveMQ Team

---

<div class="post-metadata">

**Author:** ![girishgsv](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@girishgsv](https://community.hivemq.com/u/girishgsv)\
**Post date:** [April 27, 2022, 2:58pm UTC](https://community.hivemq.com/t/message-acknowledegement/1157/15 "2022-04-27T14:58:44Z")

</div>

Thanks for information. can I use the Java library in .net?

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [April 28, 2022, 8:38am UTC](https://community.hivemq.com/t/message-acknowledegement/1157/16 "2022-04-28T08:38:35Z")

</div>

> [@girishgsv](#):
>
> can I use the Java library in .net?

No, you can’t.

> [@girishgsv](#):
>
> We are using MQTTnet library available on nuget, but this library still have v3.1.1, 5.0 is still under pre-release.

In case if you are referring to [this](https://www.nuget.org/packages/MQTTnet/4.0.0-preview5) lib, a [quick search](https://github.com/dotnet/MQTTnet/search?q=responsetopic) in its code indicates that this lib supports ResponseTopic feature.

If you have further questions about HiveMQ or MQTT please let us know,  
Dasha from HiveMQ team
