Message bus vs. Service bus vs. Event hub vs Event grid

azure-eventgridazure-eventhubazureservicebusmessage-queueservicebus

I'm learning the messaging system and got confused by those terminology.

All the messaging system below provides loose coupling between services with different sets of features.

queue – FIFO, pulling mechanism, 1 consumer each queue but any number of producers?

message bus – pub/sub model, any number of consumers with any number of producers processing messages? Is Azure Service Bus an implementation of message bus?

event bus – pub/sub model, any number of consumers with any number of producers processing events?

Do people use message bus and event bus interchangeably as far as terminology goes?

What are the difference between events and messages? Are those just synonyms in this context?

event hub – pub/sub model, partition, replay, consumers can store events in external storage or close to real-time data analysis. What exactly is event hub?

event grid – it can be used as a downstream service of event hub. What does it exactly do that event hub doesn't do?

Can someone provide some historical context as how each technology evolve to another each tied with some practical use cases?

I've found message bus vs. message queue helpful

Best Answer

Even thou all these services deal with the transfer of data from source to target and might seem similar falling under the umbrella messaging services they do differ in their intent.

High-level definition:

  • Azure Event Grids – Event-driven publish-subscribe model (think reactive programming)
  • Azure Event Hubs – Multiple source big data streaming pipeline (think telemetry data)
  • Azure Service Bus- Traditional enterprise broker messaging system (replaces Azure Queue Storage)

Difference between Event Grids & Event Hubs

  1. Event Grids doesn’t guarantee the order of the events, but Event Hubs use partitions which are ordered sequences, so it can maintain the order of the events in the same partition.
  2. Event Hubs are accepting 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 Grids sends HTTP requests to notify events that happen in publishers.
  3. Event Grid can trigger an Azure Function. In the case of Event Hubs, the Azure Function needs to pull and process an event.
  4. Event Grids 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.
  5. In Event Hubs the data can be kept 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.

Difference between Event Hubs & Service Bus

To the external publisher or the receiver Service Bus and Event Hubs can look very similar and this is what makes it difficult to understand the differences between the two and when to use what.

  1. Event Hubs focuses on event streaming where Service Bus is more of a traditional messaging broker.
  2. Service Bus is used as the backbone to connects applications running in the cloud to other applications or services and transfers data between them whereas Event Hubs is more concerned about receiving massive volume of data with high throughout and low latency.
  3. Event Hubs decouples multiple event-producers from event-receivers whereas Service Bus aims to decouple applications.
  4. Service Bus messaging supports a message property ‘Time to Live’ whereas Event Hubs has a default retention period of 7 days.
  5. Service Bus has the concept of message session. It allows relating messages based on their session-id property whereas Event Hubs does not.
  6. Service Bus the messages are pulled out by the receiver & cannot be processed again whereas Event Hubs message can be ingested by multiple receivers.
  7. Service Bus uses the terminology of queues and topics whereas Event Hubs partitions terminology is used.

Use this loose general rule of thumb.

SOMETHING HAS HAPPENED – Even Hubs

DO SOMETHING or GIVE ME SOMETHING – Service Bus

As @Louie Almeda stated you may find this link to the official Azure documentation useful.

Related Topic