0
votes

I' m using a MQTT publisher, RabbitMQ and a Mqtt subscriber. I have installed on RabbitMQ the plugin for to label the messages with timestamp (rabbitmq_message_timestamp). I have built an AMQP Publisher, an AMQP Subscriber and a MQTT Subscriber using node.js and a MQTT Publisher using Node-Red (and the MQTT out block) setting the topic to test the server url, username and password of RabbitMQ user, retain=true and no QoS.

1st PROBLEM) When I use an AMQP Publisher and an AMQP Subscriber, i can retrieve (side Subscriber) the RabbitMQ's timestamp by reading the field with path: msg.properties.timestamp. But when I use a MQTT Publiher and a MQTT subscriber, if I try to retrieve the value of msg.properties.timestamp, the nodejs windows says that field "properties" is undefined.

2nd PROBLEM) When I public message with my Node-Red MQTT Publisher (with topic "test") if a MQTT Subscriber is running on test queue, it downloads the messages, but if there isn't any Subribers on test queue, the RabbitMQ console says that test queue is empty. After stopping the MQTT pUblisher, if I try to connect the MQTT Subscriber to test queue, it will receive only the last message.

Can anyone help me to solve these problems?

1
What Quality of Service (QoS) are you using for the publisher? Have you configured RabbitMQ to persist the exchange (topic) you are publishing to?balmy
I didn' t bind the queue with topic exchange (amq.topic). Now it accumulates message.Salva

1 Answers

1
votes

There is no where in a MQTT message to store the additional meta data properties (such as the timestamp you mention).

MQTT message headers pretty much just hold the topic, QOS and a retained flag.

So if you subscribe with the Node-RED MQTT client node that is the only meta data that will be available.