1

I am new to Azure managed services. I am not sure about the below mentioned approach is the best approach for the IOT HUB to WEB APP communication.

In IOT Hub, we have created some devices. So, Those devices will send the payload in bytes format to IOT hub.

Now, from IOT hub, I have to pass this payload to Web app which is hosted in Azure and process those payloads and send the response payload to that device using IOT hub service-client.

For passing the payload from IOT Hub to the Web app, I have done the following.

Approach followed:

Step 1: Created a Service Bus namespace in Azure and created a Queue(boxtoserverqueue) in service bus namespace.

Step 2: I have created the Endpoint for the above Servicebus queue in IOT Hub(Custom Endpoint)

Step 3: I have created a Servicebus queue trigger Continuous running WebJob inside my web app. So, this WebJob will listen to the Servicebus message. Whenever the BrokerMessage is added to the Service Bus Queue from the IOT Hub, This Web job will get triggered with the Broker Message. So, then I will process the Message Payload and send back to Azure IOT Hub directly using IOT hub serviceClient.

Am I in the right direction with this approach or Should I think about Event Hub client to achieve the above communication between the IOT Hub to Web APP or another prototype is available for this communication?

Note: I read, If I use Event Hub client in my web app, I should pool the Event hub client for listening to the Messages While(true){} loop. not sure about this.

Which approach Should be the best approach for this IOT HUB to Web App communication?

Please share your thoughts on this?

Thanks in advance!

Vignesh
  • 814
  • 7
  • 29
  • 1
    Why not just use Azure Functions? There's a built-in trigger for IoT Hub (which really means the underlying Event Hub in this case). – evilSnobu Nov 17 '17 at 08:50
  • @evilSnobu Thanks you for your thoughts and reply. I really appreciate it! So, I did not aware azure functions. I will google it and let me try. I have Two questions 1.) What are all the setup and accounts in Azure I really required to achieve Azure functions route? 2.) For the above approach which is asked in my question will that work or what flaw is there in this approach? – Vignesh Nov 17 '17 at 09:24
  • @evilSnobu I have googled the Azure functions. As per my understanding its similarly functioning like an Azure WebJobs. So, Do you want me to implement the following approach(IOT Hub --> Service bus Queue --> Azure Service bus Queue Trigger Function --> WebApp )? Please share you thoughts on this? – Vignesh Nov 17 '17 at 10:03
  • 1
    No. Azure Functions with IoT Hub trigger, it's in the samples you get when you do New Function from the Azure Portal - https://imgur.com/a/Hbj6S – evilSnobu Nov 17 '17 at 16:18
  • @evilSnobu Thanks for your inputs. Let me try this and implement the Azure Functions with IoT Hub trigger. Just for the heads-up, I am able to achieve following approach (IOT Hub --> Service bus Queue --> Azure Service bus Queue Trigger Function --> WebApp). – Vignesh Nov 20 '17 at 17:06
  • @evilSnobu I have done your approach which works fine now. I have one question. Without Azure functions, Is it good to run the endless loop to capture the Events Messages(messages/events) from IOT Hub Devices? Because our Team Lead is not interested to pay an additional cost to Azure functions. Correct me if I am wrong. Please share your thoughts on this.(Approach I followed: Device sends Message to IOT Hub -->IOT Hub will redirect the Messages to Default Events(messages/events)--> we are running endless Loop which will capture the Messages and Process them based on our requirement inside loop – Vignesh Nov 28 '17 at 07:25
  • Stream Analytics is what you'd usually use there if we're talking high throughput: IoT Hub (Event Hub) --> Stream Analytics (query goes here). Then you can hook multiple outputs from SA. – evilSnobu Nov 28 '17 at 07:58

0 Answers0