Author : MD TAREQ HASSAN | Updated : 2021/04/18
Messaging Services In Azure
- Azure Queue Storage
- Azure Service Bus
- Azure Event Hub
- Azure Event Grid
- Azure IoT Hub
- Azure SignalR Service
- Azure Relay
- Notification Hubs
- Azure Web PubSub service
- https://docs.microsoft.com/en-us/azure/messaging-services/
Azure Queue Storage
- A simple queue service useful to store a large number of small size messages
- REST-based HTTP verbs (i.e. GET and PUT) to read and insert messages into the queue
- Uses queue concept: application can also look at the message on the head of the queue using the PEEK command
- Usage case:
- workloads or tasks to be processed asynchronously
- message order guarantee is not important
Azure Event Grid
- Event Grid is an eventing backplane that enables event-driven, reactive programming. It uses the publish-subscribe model
- Fully-managed event routing service
- Routes descrete events to event handlers
- messages are pushed to event handlers
- handlers should be capable of handling the load or implement a throttling mechanism
- Use cases
- an application needs to react to the changes that happened in another service (i.e. process a file when a new file is uploaded in blob container)
- filter and fan out an event to multiple targets (i.e. Azure Function, Azure Logic Apps etc.)
Azure Event Hub
- Azure Event Hubs is a big data streaming platform and event ingestion service
- It also supports Advanced Message Queuing Protocol (AMQP)
- Azure Event hub supports Kafka API (allowing applications to migrate without code change which are using Kafka as message broker)
- Usae cases
- high-speed data ingestion (telemetry, distributed data streaming)
- aggregate stream of events
- to publish stream of ‘state change’ events and “any specific action from consumers” is not expected (i.e. time series click-stream from a website to track user)
- stream from millions of IoT devices
Azure Service Bus
- Service Bus is a fully managed enterprise message broker with message queues and publish-subscribe topics
- Enterprise grade integration message broker: asynchronous transfer of data between applications
- It supports Advanced Message Queuing Protocol (AMQP) which is a TCP based efficient and reliable open protocol and makes a solution vendor-neutral
- Service Bus includes advanced features that enable you to solve more complex messaging problems: https://docs.microsoft.com/en-us/azure/service-bus-messaging/advanced-features-overview
Event Grid vs Event Hubs vs Service Bus
Event vs Message
- Message:
- A message is raw data produced by a service to be consumed or stored elsewhere
- Use “Azure Service Bus”
- Event:
- An event is a lightweight notification of a condition or a state change. The publisher of the event has no expectation about how the event is handled. The consumer of the event decides what to do with the notification
- Discrete event: use “Azure Event Grid”
- Stream of events: use “Azure Event Hub”
- See: Event vs. message services
Event Hub vs Event Grid
- Event Hubs accept only endpoints for the ingestion of data and they don’t provide a mechanism for sending data back to publishers. On the other hand, Event Grid sends HTTP requests to notify events that happen in publishers
- Event Grid can trigger an Azure Function. In the case of Event Hubs, the Azure Function needs to pull and process an event
- Drability:
- Event Grid is a distribution system, not a queueing mechanism. If an event is pushed in, it gets pushed out immediately and if it doesn’t get handled, it’s gone forever unless we send the undelivered events to a storage account (This process is known as dead-lettering, by default this option is disabled, so if we need to enable it, we have to specify a storage account at the creation of the Event Grid)
- In Event Hubs, publishers and subscribers read and write from durable storage. The data can be kept in the Event Hubs for up to seven days and then replayed. This gives us the ability to resume from a certain point or to restart from an older point in time and reprocess events when we need it
- Event Grid doesn’t guarantee the order of the events. Contrarily, Event Hubs use partitions and these partitions are ordered sequences, so it can maintain the order of the events in the same partition
- Courtesy: https://www.cognizantsoftvision.com/blog/azure-event-grid-vs-event-hubs/
Details: https://docs.microsoft.com/en-us/azure/event-grid/compare-messaging-services