How to develop a REST api to send response received from subscribed topic

I Want to develop a SpringBoot application that will provide me with a REST endpoint. eg: GET /status, to get the online status of a device.

The HiveMQ client publishes a message with the topic name called device/get_status. And subscribed to a topic called device/response_status to listen to the device online status. Once the response is received to the subscribed topic the application will send the HTTP response of the device status.

Here I am facing difficulty to send the response received in the callback method. Any suggestions…

Hi @ANJ ,

Thanks for your interest in MQTT and HiveMQ. Please be welcome in our community!

For us to understand the issue better, could you perhaps share your source code here and point out the problematic point in the callback method? If you are seeing an error please share with us what the error says.

Thank you,
Kind regards,
Dasha from HiveMQ Team

Hi @ANJ ,

We have a nice example for implementation of the Request - Respons pattern that comes with our Open-source HiveMQ client library:

I hope this helps improve your code,
Kind regards,
Dasha