Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT transport in HA produces duplicate notifications #151

Closed
dmoranj opened this issue Sep 23, 2016 · 2 comments
Closed

MQTT transport in HA produces duplicate notifications #151

dmoranj opened this issue Sep 23, 2016 · 2 comments
Labels

Comments

@dmoranj
Copy link
Contributor

dmoranj commented Sep 23, 2016

We have found a bug concerning the use of Mosquito and IoTAgents in a High Availability architecture. In such a deployment, when a new measurement arrives to the MQTT Broker, the MQTT Broker redirects the message to all its subscribers. Being in active-active configuration, both IoTAgents are subscribed to all measurements, so both receive a copy of the message and both agents send updates to the Context Broker. Here, two things can happen, depending on the information sent and how the IoTAgent is configured:

  • If the IoTAgent is configured not to use a TimeInstant attribute, both messages will be identical, and even though two updates will be sent, one of them will be discarded by the Context Broker, as nothing changed in the entity. Subscribers to the entity would only receive one notification.
  • If the IoTAgent is configured to use the TimeInstant attribute, and a mapping is stablished from a timestamp in the measurement to the TimeInstant attribute, all the fields would be assigned the same timestamp, so the messages will be the same and just one notification will arrive to the client.
  • In any other cases, where the IoTAgent has the TimeInstant attribute configured and there is no mapping for timestamps (and that's currently the case, as there is a bug that prevents that mapping from working), two slightly different messages would arrive from the IoTA to the Context Broker, so two notifications would be sent for each measurement. This will cause the duplication of every measure in each NGSI sink subscribed to the device information.

The solution to this problem will involve analysis of the current architecture, not only development from the IoTA team, concerning how the MQTT Broker is being used right now.

@AlvaroVega
Copy link
Member

AlvaroVega commented Aug 17, 2018

According with https://github.com/telefonicaid/iotagent-ul/blob/3b53b8ac2135aa203fd48e0a6d1f554f23714636/docs/usermanual.md#amqp-binding

in need of an scalable MQTT Broker, RabbitMQ with the MQTT plugin will be used, connecting the IoT Agent to RabbitMQ through AMQP and the clients to RabbitMQ through MQTT.

So a possible solution could be use rabbitMQ broker (and plugin https://github.com/telefonicaid/rabbit-topic-acl). An example or inspiration on that rabbitMQ brocker could be https://github.com/telefonicaid/rabbit-topic-acl/blob/master/docker/Dockerfile

@AlvaroVega
Copy link
Member

This was fixed by #287

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants