简体   繁体   中英

Can an Azure function listen to multiple EventGrid Events?

I have an Azure function which contains some generic logic to sync some database information. Currently, this is exposed via three functions to cover three separate events, and isn't quite as DRY as I'd like. Is it possible to have a singular function listen to the three different events and execute only once in the event all three fire at once? I have yet to find any documentation that suggests it could be done.

The Azure Event Grid is an eventing Pub/Sub model for distributing an event interest to the destination resource in the reliable way and PUSH manner. There is no listener for consumer of the event interest.

The event interest in this model can be distributed in the FAN-IN and/or FAN-OUT Patterns.

Your scenario can be achieved using the FAN-IN Pattern, where multiple subscriptions are using the same destination resource such as an Azure Function, see the following screen snippet:

在此处输入图像描述

Note, that each subscription in this distributed eventing model has owned metadata (topic, filtering, retry policy, etc.) for handling a managing delivery of the event message to the destination resource.

In the case, when the event interest source (topic) is the same, you can use a single subscription with an advanced pre-filtering of your interest and the detail filtering in the subscriber code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM