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

feat: support actions on new topics #306

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

feat: support actions on new topics #306

wants to merge 8 commits into from

Conversation

de-sh
Copy link
Contributor

@de-sh de-sh commented Nov 17, 2023

Closes #

Changes

Why?

Broker will soon send action on specifically named topics of the format:
/tenants/{tenant_id}/devices/{device_id}/actions/{action_name}
Uplink is expected to respond to these actions on special topics of the format:
/tenants/{tenant_id}/devices/{device_id}/action_status/{action_name}

Trials Performed

Tested with the following commands:

mosquitto_sub -h stage.bytebeam.io -p 1883 -t /tenants/demo/devices/1002/action_status/lock
... # in another terminal
mosquitto_pub -h stage.bytebeam.io -t /tenants/demo/devices/1002/actions/lock -m '{ "action_id": "1", "kind": "process", "name": "lock", "payload": "{}" }'

It was observed that actions was received and responded to by uplink appropriately:

[{"action_id":"1","sequence":0,"timestamp":1700289329194,"state":"Received","progress":0,"errors":[]}]
[{"action_id":"1","sequence":1,"timestamp":1700289329194,"state":"in_progress","progress":13,"errors":[]}]
[{"action_id":"1","sequence":2,"timestamp":1700289329195,"state":"in_progress","progress":26,"errors":[]}]
[{"action_id":"1","sequence":3,"timestamp":1700289330195,"state":"in_progress","progress":36,"errors":[]}]
[{"action_id":"1","sequence":4,"timestamp":1700289331195,"state":"in_progress","progress":46,"errors":[]}]
[{"action_id":"1","sequence":5,"timestamp":1700289332195,"state":"in_progress","progress":50,"errors":[]}]
[{"action_id":"1","sequence":6,"timestamp":1700289333195,"state":"in_progress","progress":60,"errors":[]}]
[{"action_id":"1","sequence":7,"timestamp":1700289334195,"state":"in_progress","progress":77,"errors":[]}]
[{"action_id":"1","sequence":8,"timestamp":1700289335194,"state":"in_progress","progress":87,"errors":[]}]
[{"action_id":"1","sequence":9,"timestamp":1700289336195,"state":"in_progress","progress":96,"errors":[]}]
[{"action_id":"1","sequence":10,"timestamp":1700289337195,"state":"Completed","progress":100,"errors":[]}]

Similar behavior is observed in the case of sending to old topic and subscribing to older response topic:

mosquitto_sub -h stage.bytebeam.io -p 1883 -t /tenants/demo/devices/1002/action/status
... # in another terminal
mosquitto_pub -h stage.bytebeam.io -t /tenants/demo/devices/1002/actions -m '{ "action_id": "1", "kind": "process", "name": "lock", "payload": "{}" }'

Uplink uses old topic to respond:

[{"action_id":"1","sequence":0,"timestamp":1700289329194,"state":"Received","progress":0,"errors":[]}]
[{"action_id":"1","sequence":1,"timestamp":1700289329194,"state":"in_progress","progress":13,"errors":[]}]
[{"action_id":"1","sequence":2,"timestamp":1700289329195,"state":"in_progress","progress":26,"errors":[]}]
[{"action_id":"1","sequence":3,"timestamp":1700289330195,"state":"in_progress","progress":36,"errors":[]}]
[{"action_id":"1","sequence":4,"timestamp":1700289331195,"state":"in_progress","progress":46,"errors":[]}]
[{"action_id":"1","sequence":5,"timestamp":1700289332195,"state":"in_progress","progress":50,"errors":[]}]
[{"action_id":"1","sequence":6,"timestamp":1700289333195,"state":"in_progress","progress":60,"errors":[]}]
[{"action_id":"1","sequence":7,"timestamp":1700289334195,"state":"in_progress","progress":77,"errors":[]}]
[{"action_id":"1","sequence":8,"timestamp":1700289335194,"state":"in_progress","progress":87,"errors":[]}]
[{"action_id":"1","sequence":9,"timestamp":1700289336195,"state":"in_progress","progress":96,"errors":[]}]
[{"action_id":"1","sequence":10,"timestamp":1700289337195,"state":"Completed","progress":100,"errors":[]}]

Devdutt Shenoi added 6 commits November 17, 2023 17:42
@de-sh de-sh marked this pull request as ready for review November 18, 2023 06:40
@de-sh de-sh requested a review from tekjar November 27, 2023 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant