1

Is this possible in a publish/subscribe pattern?

  1. A publisher publishes a message to a topic;
  2. Subscriber(s) receive(s) the message;
  3. The subscribers reply to publisher with a custom message.

Is step 3 possible? I'm designing a system that will use MQTT protocol (communication between smartphones and microcontrollers). However, the subscriber needs to send an answer to the publisher other than the Acknowledged message.

Andrei
  • 7,509
  • 7
  • 32
  • 63

1 Answers1

2

There is no way to directly reply to the a message in a MQTT system, but there is nothing to stop you using 2 topics (outboud/inbound) and including a message id in the payload of the message to identify the reply to the original published message

hardillb
  • 54,545
  • 11
  • 67
  • 105
  • I believe you can use the same topic. You don't need to create a separate one. But you will need to do the message handling manually. – Andrei Apr 30 '15 at 10:24
  • You can use the same topic, but the code is simpler if you split them, especially if your working on an embedded device – hardillb Apr 30 '15 at 10:25
  • You should be able to accomplish this if you incorporate a queue manager, the message could be sent back directly from the queue manager to the client using the ClientID. – ValerieLampkin Apr 30 '15 at 14:06