Sunday 25 June 2017

Queue Vs Service Bus Vs Event Hub Vs Azure Iot Hub

    I have always heard about Queue, service bus and event hub. I wondered how they fit into real world scenarios. I have worked in IBM MQ(queues) when i started my career, so i know about queues. When we need asynchronous way of programming, solution is to queue your command and some other program picks to process it up. But when i heard all other buzz words, i got curious and did some research, and did not find any concrete details in one place, so i thought i will write one.


    As discussed in the intro of the blog, we will use queue for asynchronous programming, but queue does not solve all your asynchronous  needs. But it solves your problem when they are one sender and one receiver who wants to work asynchronously then it is the best choice. We can have multiple receiver waiting for a queue but when a command is received in a queue, any receiver can pick it up and the message is removed from the queue.


Azure service Bus

    Service bus is different animal which uses the queue but works in a different way, i will not get into nitty gritty of the different mechanism in which queue deals with messages. It can be used when you want one Sender and multiple subscriber for your message. If you want read more about it, you can read here. We will discuss about the topics here and how it works. In topics the sender can send data and the receiver can filter message based on the data being received and data can also be sent to all the subscribers.

In the above scenario, the data is received by the subscriber based on the filter, they have receive data based on finance or accounts. Subscriber 3 wants to receive all messages that is posted in the queue. Above scenario is only done through topics, we need to write lots of code, if we want to implement the same in queue.

Event Hub

    In Event hub there can be multiple sender and multiple receiver .

 Queue and service does supports multiple sender concept, we can write to the queue from the multiple sender, but service bus or queue cannot handle multiple sender with high throughput. We will not choose the queue or service bus, when we know the input will be from the different devices or senders. So choose Event hub when you know there will be multiple senders.

Azure IOT Hub.

    Azure IOT hub is used for asynchronous communication for high throughput and scalable application, it is synonymous with azure event hub. Different protocols and holds Device informations

But major difference is it’s security, protocols and also the device information available in the IOT hub. One of the main use cases for IoT Hub is to gather telemetry from devices. Devices state can also be saved. Event hub cannot retrieve those device state informations. For IOT devices, azure Iot is the best choice.

Build Bot using LUIS