azureazure-eventhubazure-eventgrid

I'm unsure if I should use Azure Event Hub or Azure Event Grid


I've been digging into both products Azure Event Grid and Azure Event Hub to learn which tool suits better in my use case. I'll share a brief of my use case, hopefully that makes some clarity around this dilemma I have:

Use case

When user's state change, the service needs to publish an event saying that the user's state has changed, it'll include a few properties in the event payload, such as timestamp, the reason why state changed, etc. - I'm dropping below a drafted schema. There will be a few consumers of these events, each consumer has its own logic for processing the events, and ALL of them should receive the same event so they do their stuff. I expect to have around 40k of events to be published in average per day, there can be days where 80k events can be published as well... at the end of the day I'd say there will be less than 100k events to be published in a day.

Event schema

{ 
    "userId": "", 
    "reason": "", 
    "timestamp": "", 
    "creationDate": "", 
    "secondaryId": ""
}

I've seeing that Azure Event Hub is really good at handling large amount of data (millions of events per second), though my use case doesn't sound too much data to handle in the first place. I want to keep pull delivery, so assuming I want to use Azure Event Grid, I'd create a Queue event subscription so consumers can pull at their own pace. Azure Event Hub seems to be in the market for a while whereas Azure Event Grid not (in particular this Queue event subscription), so maybe Azure Event Hub is more mature in the space - please keep me honest here, I used this blog as source: https://yourazurecoach.com/2023/12/22/azure-service-bus-vs-event-grid-pull-delivery/ . Any thoughts, guidance will be highly appreciated. I can also provide more information if needed.

Thank you!


Solution

  • For your use case, Event Hubs feels like an overkill. If anything, Service Bus with subscriptions is probably a better option than Event Hubs. On the other hand, Event Grid with a pull option is a very similar option. If you're a complete newbie to messaging, Service Bus might be more accessible to start with and find the necessary information. Event Grid v2 is relatively new, and there are probably fewer materials online to rely on when figuring things out. In terms of the throughput, 100K msg/day is ~70 msg/sec, which is very low throughput and would be easily handled by either of the services.

    My recommendation is to pick both of the options, Service Bus and Event Grid, and validate which service you and your team would be more comfortable with.