通过 azure 函数将事件发布到 azure 事件网格

Publishing events to azure event grid via azure functions

我想通过 azure 函数将事件发布到 azure 事件网格。其他 azure 函数会消耗这些事件。

是否可以仅使用 azure 函数触发事件网格事件?

我们可以在 Azure Event Grids 的帮助下轻松构建基于事件的架构。

集成有两个关键点Event Grid with Azure functions,看看我们可以与多语言交互的文档。

  1. Trigger
  2. Output binding

EventGridPublisherClient、EventGridEvent 是我们在Python中使用的客户端,我们从azure.eventgrid

导入它们

下面是我们在python

中处理事件的方式
key = os.environ["EG_ACCESS_KEY"]
endpoint = os.environ["EG_TOPIC_HOSTNAME"]

# authenticate client
credential = AzureKeyCredential(key)
client = EventGridPublisherClient(endpoint, credential)

有关详细信息,请参阅 Azure SDK 中的 Python Source code for Python。