What is Azure Event Grid?
Microsoft Azure Event Grid is a service using which users can build serverless applications easily with event-based architecture. It is an event routing service that distributes events from sources like Blob Storage, Media Services to Azure functions, and Webhooks. Event Grid can be used as a Third-party service and supports Azure services as a publisher or subscriber. It has the support to create its own event using custom topics.
How does Azure Event Grid Work?
Azure event grid receives messages from multiple sources and distributes these messages using an event handler based on the event grid subscription. Event sources send the details of the event to the Event grid and then relevant events from the grids are sent to the subscriber. Topics are used to segregate the relevant events and decide which events to send to the event handlers. Each event from the sources is tagged to multiple topics and event handlers subscribe to the intended topics from events.
Figure_Reference: https://docs.microsoft.com/en-gb/learn/modules/choose-a-messaging-model-in-azure-to-connect-your-services/media/4-event-grid.png
As illustrated in the figure above Azure event grid uses the below components to connect to the source and subscriber:
- Events: It is the notification of certain conditions or the state change of what happened in the application.
- Event Sources: Sources where the event is running or executing. Event sources used are Event Hubs, IoT Hubs, Blob Storage, etc.
- Topics: It is the endpoint to receive events from publishers.
- Event Subscriptions: It is the built-in mechanism used by the endpoint used to route the events to the single or multiple event handlers. Subscriptions basically decide relevant events from incoming events.
- Event Handlers: It is the service or app like Event Hubs, Queue Storage, WebHooks, etc. to react to events.
How to Create and Use Azure Event Grid?
Before learning to create the Azure Event Grid users must have an Azure Subscription, so that they can login with valid credentials to the Azure Portal and create Azure Event Grid.
-
Create a Custom Topic
Step 1: Use valid credential to Login into the Azure Portal :
Step 2: Select the search bar field and enter the Event Grid Topics and from drop-down list click on the Event grid topics:
Step 3: From the Event Grid Topics page toolbar select +Add option to create add new topic:
Step 4: In Create Topic page users can enter the topic details as per requirement:
- Select the Azure Subscription and Create a new resource group if needed or use the existing one from the drop-down list.
- Enter the Topic name in the Name field and the name should be unique as it represents the DNS.
- Select the Location from the drop-down list.
Step 5: Click on the Review+create to validate the entered detail and then click on the Create button from the bottom of the page:
Step 6: Deployment of the Topic will Start and Once the Deployment is completed topic will be available in the Event Grid Topic list.
-
Create a Message Endpoint
Users need to create a subscription for the custom topic and create an endpoint for the event message. We are using pre-built web app to display event message:
Step 7: Click on Deploy to Azure link below and provide the deployment parameters on the page:
Enter the details by selecting the Housing Plan, Site Name, and Regions:
-
Create Event Subscription
Step 8: In the Search, field enter Event grid Subscription to create a new subscription:
Step 9: Select + Event Subscription to add new subscription:
Step 10:Enter the event subscription detail in the Create Event Subscription:
Step 11: Enter the details in Create Event Subscription:
- Name: Enter the Unique name for the subscriber.
- Select Event Schema as Event Grid Schema from the Drop Down List.
- In topic types select Event Grid Topics.
- Select Subscription, Resource group and resource as per your subscription.
- Select the Endpoint Type created above.
Step 12: Click on the Create button from the link of the Create Event Subscription page and start deployment:
Step 13: It will start the Deployment to create and Subscriber.
Uses
- Azure Event Grid is simple and easy as Users can point and click the events from Azure Resource to any event handler or endpoints.
- It has support for many built-in events so that users can get up and run resources faster and with low latency.
- It has high reliability as the event grid runs 24-Hour and makes sure that events are delivered successfully.
- Users can filter the event type and event publish path to decide which events to select from the event handler.
- Users can only pay for the used resources as there is support for Pay-per-event.
Conclusion
In conclusion, Azure Grid Event helps users to build applications easily and users can also publish or subscribe to the message needed. Due to the pay-per pricing model users just have to pay for what they are using.
Recommended Articles
This is a guide to Azure Event Grid. Here we discuss an introduction to Azure Event Grid, working, and steps to use to create Azure Event Grid. You can also go through our other related articles to learn more –
6 Online Courses | 5 Hands-on Projects | 67+ Hours | Verifiable Certificate of Completion
4.5
View Course
Related Courses