本文介绍了适用于Azure Service Bus的EventGridTrigger主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基于EventGrid触发器创建了一个Azure函数.每当有新消息到达服务总线主题时,就会触发该触发器.下面是生成的功能模板

I created an Azure Function based on EventGrid Trigger. That trigger will fire whenever a new message arrives at a service bus topic. Below is the function template generated

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

public static void Run(JObject eventGridEvent, TraceWriter log)
{
    log.Info(eventGridEvent.ToString(Formatting.Indented));
}

我对Azure功能的要求是处理数据并将其存储在ADLS中.现在,我该如何解析/反序列化来自JObject类型的数据.在将其持久化到Data Lake存储之前,我需要对该函数中的数据进行规范化.我需要覆盖该功能吗?

My requirement from Azure function is to process the data and store it in ADLS. Now how do I parse/de-serialize data from JObject type. I need to normalize data within this function before persisting it to Data lake store.Do I need to overwrite the function?.

请提供一些详细信息/参考以符合此要求

Please provide some details/reference to meet this requirement

推荐答案

服务总线(Premium)发送两种情况的事件:

Service Bus (Premium) sends events for two scenarios:

  1. ActiveMessagesWithNoListenersAvailable
  2. DeadletterMessagesAvailable

当存在与特定实体相关联的消息且不存在活动的侦听器时,将发出第一个事件.该实体将连同其访问所需的其他必需信息(例如名称空间或要从中接收的订阅主题)一起显示在有效负载中.该架构在文档.

The first event will be emitted when there are messages associated with a specific entity and no active listeners exist. The entity will be indicated in the payload, along with other required information to access it (such as the namespace, or the topic of the subscription to receive from). The schema is defined in documentation.

第二个事件模式明智,与第一个事件模式类似,并且是为死字母队列发出的.

The second event schema wise is similar to the first one, and is emitted for dead-lettered letter queues.

eventGridEvent JSON本身不会给您Azure服务总线消息.您将需要知道原始消息是如何首先序列化的,即发件人端使用了什么.该反序列化将需要进入Function,然后是代码以编写对象Data Lake.

eventGridEvent JSON itself is not going to give you the Azure Service Bus message (s).You will need to know how the original messages were serialized first, i.e. what the sender side used. That deserialization will need to go into the Function, followed by code to write the object Data Lake.

这篇关于适用于Azure Service Bus的EventGridTrigger主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 20:28