I have a Azure Web App that generate different types of notifications. At the moment, every notification is written in a queue. A queue function I call
scheduler read the notification and redirect it toward other functions. Each one of those functions generate a type of notification: email, push, sms.
I have different types of notification. For example:
- new user
- update user
- new request
- update request
- delete request
- new quotation
- purchase quotation ....
Everytime a event is raised from my app I could send different kind of notification. For example, I must send both email and sms when I create a new user. But everytime a new quotation is created I must send all kind of notifications: email, sms and push.
I want to replace my custom "engine" with Azure Event Grid. I am start studying from here, but honestly I do not understand how to apply what I am studing. I think my main problem is I haven't really understood what a topic and a subscription are.
I share with you my partial solution I think is correct:
- I create a topic for each "entity" I have in my project domain. I mean a user topic, a request topic, a quotation topic, ...
- Then I create a subscription for each topic and event type. So:
- In the guide I linked above in the concept paragraph I read:
Event subscriptions - The endpoint or built-in mechanism to route events, sometimes to more than one handler. Event handlers - The app or service reacting to the event.
What I understand is that I could have 1 subscription that run for eample more than one function. So I was thinking to have 1 supscription that run the sms function, the email function and the push-notification function. But I don't understand how to call more than one function from one subscription!
Should I create a subscription foreach event type and for each notification type?
I am fear I am complicationg too much the solution, and perhaps I risk I have to create to many subscriptions.
Another solution I was thinking is to create 1 publisher per notification type. So I would have just 3 publisher: 1 for email , 1 for sms and 1 for push. But in this way, every publisher should manage almost all event type and I must be sure that each event type has a unique name. For example I could not have a generic
new but I should have a
new-quotation and a
new-user because my publisher my distinguish the topic that has managed the event.
Honestly, I don't linke any solution I am thinking. How would you build your Event Grid solution ? Any suggestion please?
PS.: I hope is the correct forum.