hello and welcome to everybody on cloud fitness so in today's video we are going to talk about azure event grid so basically in this video i'm only going to cover what exactly as your event grid is what are the basic concepts related to azure event grid and then in the upcoming video i'll give a hands-on session on azure event grid will actually use it in the portal and i'll actually show you in my upcoming videos but for this video i'll only restrict to uh you know giving an overview of what azure event grid is why we should use it and what are the different features of it and what are the different key concepts related to azure image grid so basically it is a centralized service in azure which is used to route events so when i say that it is a centralized service it is used to route events we are going to see in detail what it exactly means it is actually based on a publish and subscribe model so when i say it is routing event so while routing events the first thing is what we do is called we publish the events once we publish it we route those event we subscribe to those events that is why it is also called as you know your publish subscribe model so this is your event crib is actually a publish and subscribe model that is being used over here it is a pretty simple service so when i say publishers so publisher is something what you call uh what you can call as some some resources or within azure which actually uh which actually are the source of event right that are quite publishers so that is the starting point when you talk about is your different grid so those are the uh key factors or the key resources in azure which actually gives you an event so let's say azure blob storage so whenever you write a file into azure blob storage that actually is an event right so that is exactly your starting point and that is called as event publishers so when you talk about azure event grid what you exactly do is you publish that event you say to event grid that yes i have this file coming into my your blog storage and that take this as an event so when you say that you are actually publishing uh you are actually publishing to eventgrid so that is what is called as publish and when you say subscribe so now on the right hand side you have multiple subscriptions so when i say subscription uh these are basically actions right so whenever a file is coming in the block storage this is my this is my publish event and based on this event i want to trigger something i might want to trigger a logic app workflow i might want to trigger a code written in your function i might want to trigger event hub i want i might want to trigger any xyz thing maybe your web hook right so these are called your handlers these are called your event handlers because these will handle the way your event uh will respond so your event is when your file comes into block storage and event handlers will handle the output that will be generated as the outcome of the event right and these event handlers will subscribe to the event that you have published now what you have published you have published that yes whenever a file enters into my blob storage just that beca that is your event that you have published now any of these event handlers which will actually subscribe to that particular event which you have created so only the uh handlers which have subscribed to the event only those handlers will execute in future whenever an event occurs so let's say that your file enters into the block you have uh created an event out of it you have published that event now once you have published that event let's say the logic app has subscribed to it now once logic hap app has subscribed to it now in future whenever there will be a file inside your blog storage automatically whatever workflow you have designed in the logic app that will only execute because logic app has already subscribed to your event grid so this is the whole workflow of event grid and this event grid is maximum like it has lots of usage not just what i'm going to tell you it has like n number of usage but most of the time it is used to send emails in um in a conjunction to any event right so event publishers event handlers and even grid in between and when you talk about event publishers these are the sources which generate the event and once you generate an event you actually uh publish it to the event grid what you publish now uh when i'm saying that a file lands into blob storage you publish that to the event rate now what you are publishing is called a topic it is as simple as that and these are just the keywords otherwise it is a very simple workflow these are called topics now saying to the event grid that my file has arrived in the blog so please you know uh that publish thing is actually a topic i will actually show you in the portal how to create a topic how to subscribe in the hands-on session i don't want to cover everything in the one video so i'll keep this video pretty short and the other one has been pretty short otherwise the whole video will become very long right and similarly uh when i'm talking about subscription once you have created a topic inside event grid you actually go in the portal you actually click on you know subscribe to that particular event so this is how your whole azure event grid workflow is and the main thing to remember here is that to a one particular event right so when i say one particular event or one particular topic which is let's say for in our example a file coming in the blob storage there can be multiple subscriptions right so for the same event you can subscribe event hubs you you can subscribe logic app you can subscribe as your function so it is a one-to-many relationship you have to you know keep this picture in your mind uh about azure event grid which i'm showing on the screen and then you just make sure that you know that it is a one-to-many relationship and the second most important thing about azure event grid is that which probably you don't have in any other service is that you can uh you know even connect to azure subscription when i say azure subscription you see on the left hand side at the top you see as your subscription right it can also act as an event in event grid so let's say um you there is a somebody somebody just created a virtual machine somebody created a storage account somebody deleted a virtual machine somebody deleted a storage account even that can act as an topic even that can act as an event for azure event grid so let's say you have a team you you you have a team and you want to get notified whenever somebody creates a resource group whenever somebody creates a virtual machine right so in that case you can have your subscription itself as a event publisher in case of azure event grid so let's move ahead so most of the thing actually i've explained in pretty much in the first slide itself so uh to understand it in a better way so let's say you have a music sharing application right with a web api that runs in azure now whenever user uploads a new song you need to notify all the mobile application users that you know this song has been uploaded and whosoever is interested that person can you know directly go and use that song right now in this case uh if you see who is the publisher you know so music sharer is the publisher over here music sharing application music sharing application is the publisher over here and who are the subscribers subscribers are the people who are who will be actually notified right now the people who are notified they uh they just subscribed to the notifications right now in this case the publisher the music sharing application does not need to bother about who has subscribed to it it just need to publish the sound file to anybody right whosoever has subscribed to it so this is called a publisher subscriber model and this is the same model that is used in event grid you have a set of publishers you have a set of subscribers publishers just publish it and the subscriber whosoever is interested in that they'll just simply subscribe to the events and then automatically the flow will execute and that is why it is also called as one to many relationship right so this kind of architecture wherever you have you will definitely need to use as your event grid now again same question what is an azure event grid right it is a fully managed event routing service on the top of your azure service right so in case you are trying to build any event-based application or a server-less application on azure the solution is your azure event grid you can list n number of events it has connected to almost every uh resource in your azure blob storage or your subscription resource group your iot it can link to everything almost everything almost every event and then you can perform actions based on your events now the basic concepts in azure event grid events what is an event event is something like what happened right a file came into the blob storage that is an event what is an event source even sources are also called as publishers so do not confuse with these names event source whenever i say event event is what happened a file came into the blob storage that is an event what is an event source event source is also called as publisher event source is where it happened right it happened in the blog storage so that is your event source topic what are topics now an http endpoint where you can send your events that is called a topic it will be more clear when you will actually see it in the next video so topics are basically two types system topics and custom topics system topics are usually in built topics so um i i'll talk about this in the next video i think that would be better you know if i talk about it right now it might be confusing so the demo that we will do we will do both based on system topics as well as on custom topics so custom topics is something that you create system topics are something that are already in built right so let's say your azure data factory so if you talk about azure data factory i think you all know that you have uh you know your event-based triggers right so what are these event based triggers what happens underneath so it is your azure event grid that plays the role so that are called system topics because they are already built in you just uh you know create a event trigger and underneath your azure event grid starts its functionality similarly here comes your as your subscription so as your subscriptions are basically a linkage between your event handlers and event grid so when i say that whenever they uh subs whenever somebody wants to subscribe to an event or whenever somebody wants to subscribe to a topic in that case uh you know they create a subscription so this subscription will actually help them notify that yes a file has landed into blob storage now you know proceed with the logic apps or proceed with this functionality so that are called event subscription so similarly event handlers are also called as subscribers right so uh think about that music application example that i have already given so just like the subscribers here you have event handlers so these are synonyms so don't confuse with the name again so whatever is the reaction that the reaction to a particular event will be done by some subscriber right so that subscriber is also called as event handler so that might be your logic app your as your functions which will actually do something based on an event so those are called your as your uh subscribers so why you should use event grid right the very first thing is simplicities is quite a simple thing and you know once you have that picture in your mind you know that it is just the publisher and the subscriber model you just have to publish to an event i publish an event and then just subscribe to it to make anything going so it is that pretty simple and straightforward even when you will do it in the portal you will actually see how simple it is when you talk about advanced filtering it essentially means that let's say you have one subscriber now that one subscriber only wants to subscribe to few topics not all the topics so they have that kind of flexibility to do that kind of filtering i will show you in that demo it will be much more visible but yeah this basic understanding is required before moving on to the demo fan out basically means like from just one particular event you have multiple subscribers so that is called a fan out right so this functionality anyway you have with a single event you can you know execute your multiple workflows by subscribing multiple workflows to the same event so next is your reliability so let's say event grid fails for the first second it will again we try retry up to 24 hours so that is why it is called quite reliable and then you pay per event so when i say you pay per event you need to understand uh this thing that it is pretty cheap anyway but you pay for each message that you transfer so let's say a blob and a file gets created in the blog and you send a topic so this topic is a one message and then from topic you crea you subscribe to three workflows now um you have three workflows over there so you are sending it three more times right so then total four times so that is how you pay for per events for each message you would actually pay although it it it is not that expensive and you need to remember that this event grid has a very high throughput it can process your millions of events per second which is not very common in other azure services so especially in this case your iot applications works best with event grid because you know in your iot applications you have to process a lot of events at the same time and event grid serves the purpose very nicely so guys this was pretty much that i wanted to cover in this video i hope you got what i was trying to explain and do let me know in the comment section whether you understood it or not because the next video will be based on this only this is the code concept and based on this concept we'll be doing the hands-on session in the azure portal so thank you so much for being till here and do remember to like subscribe and share thank you so much