Skip to content

Duplicated Devices when burst MQTT measures and non provisoned Device #865

Open
telefonicaid/iotagent-node-lib
#1705
@AlvaroVega

Description

@AlvaroVega

Component

WIth dev1 and APIKEY non provisoned device:

Sending MQTT measures:

$ mosquitto_pub -h localhost -t /json/APIKEY/dev1/attrs -m '[{"v": 55}]'  && mosquitto_pub -h localhost -t /json/APIKEY/dev1/attrs -m '[{"v": 45}]' 

This duplicates device.

But not when (with a small delay):

$ mosquitto_pub -h localhost -t /json/APIKEY/dev1/attrs -m '[{"v": 55}]'  && sleep 0.05 && mosquitto_pub -h localhost -t /json/APIKEY/dev1/attrs -m '[{"v": 45}]' 

Sending HTTP measures:

$ curl -i -X POST 'http://localhost:7897/iot/json?i=disp2&k=APIKEY' -d '{ "level": "33"}' -H 'content-type: application/json' & curl -i -X POST 'http://localhost:7897/iot/json?i=disp2&k=APIKEY' -d '{ "level": "44"}' -H 'content-type: application/json'

This duplicates device.

Possible solutions:

  • Ensure unique mongo index: willl result in measures reject
  • Check findAndCreate to ensure Store device as soon as possible
  • A throttle queue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions