0

Here is use case I am working upon.

I have few LoRa based devices connected to thingsnetwork server. These devices are used to Switch on/off light. I am using Azure functions to send the commands to the devices (e.g. switch ON light) using thingsnetwork http api and sending downlink command.

When I send the command to switch ON light from one azure function, it goes to ttn server -> gateway -> devices. Device would respond as separate uplink command as response to command. This would trigger seperate Azure function where the light status is received.

Now I want to implement retry, in two scenarios -

  1. If command is send to switch on light - but device upload the light status as OFF. Then I need to send ON command again to that device.
  2. If command is send to switch on light - and no response received from the device within X seconds, then I need to send ON command again to that device.

I am using Azure tech stack - Azure event hub, Service bus, Azure function etc.

Can someone suggest the best practice to implement such async notifications from devices and how we can implement retry pattern?

Ganesh
  • 103
  • 12

1 Answers1

0

azure function can contain multiple input bindings or output bindings.

Maybe you can use two function, one function send messages to some services like event hub to save messages if light status is false, if in X seconds you didn't receive anything, re-send to the device. And another function triggered by the messages in the event hub, also re-send to device if you didn't receive anything in X seconds, etc.

Cindy Pau
  • 13,085
  • 1
  • 15
  • 27