While working on desktop and web applications, you may have worked on events and event handling. You might have written code for handling some events – for ex. handling button click, or handling selection changed, etc.
Similarly, Azure event grid service is a cloud service that provides infrastructure for event driven computing.
In this article, we will have look at what is event grid, and some basic concepts which we should know before consuming event grid service.
What is Event Grid ?
Event Grid is fully managed intelligent event routing service. It allows uniform event consumption using publisher-subscriber model.
You can use Azure event grid to react to relevant events across both azure and non-azure services in real time fashion.
Steps to Use Event Grid
You can use Event Grid using two step process. First, you need to select Azure resource you would like to subscribe to. Second, you need to select either event handler or web-hook endpoint to send the event to.
Event Grid has built-in support for events coming from Azure services, like storage blobs and resource groups. Event Grid also has support for your own events, using custom topics.
You can also use filters to route events to different endpoints or you can multicast events to multiple endpoints and make sure that events are delivered to appropriate consumers.
Terms to Remember
This section is to explain few terms which we should know before using Event Grid in the solutions.
Events
Event is the smallest amount of information that describes something has happened. Every event has some common information (source, occurrence time, ID, etc) and some information which is specific to the event.
Event Sources
An event source is where the event occurred. Each event source is related to one or more event types.
For example, Azure Storage is the event source for blob created events. Your application is the event source for custom events that you define.
Event Handlers
Event handler is the place where event is sent. The handler takes some further action to process the event. Event grid supports different type of handlers. You can use a supported Azure service or your own webhook as the handler.
Event Delivery
If Event Grid can’t confirm that an event has been received by the subscriber’s endpoint, it redelivers the event.
Publishers
Publisher is user or organization that sends events to event grid.
Topics
Topic is the endpoint where publishers send events.
A topic is used for a collection of related events. To respond to certain types of events, subscribers decide which topics to subscribe to.
System topics are built-in topics provided by Azure services. You don’t see system topics in your Azure subscription because the publisher owns the topics, but you can subscribe to them.
To subscribe, you provide information about the resource you want to receive events from. As long as you have access the resource, you can subscribe to its events.
Custom topics are application and third-party topics. When you create or are assigned access to a custom topic, you see that custom topic in your subscription.
Subscriptions
A subscription tells Event Grid which events on a topic you’re interested in receiving. When creating the subscription, you provide an endpoint for handling the event. You can filter the events that are sent to the endpoint. Y
Security
Event Grid provides security for subscribing to topics, and publishing topics. When subscribing, you must have adequate permissions on the resource or event grid topic. When publishing, you must have a SAS token or key authentication for the topic.
Batching
While using custom topics, you can batch the events together to achieve higher throughput. The batch size can be up to 1 MB, each event can be up to 64 kb.
In this article we have seen some basic concepts and basic terms to understand what is event grid. In next articles, we will see how to enable Azure event grid on some other services in event based architecture. I hope you enjoyed reading this article. Please do comment and let me know your thoughts.