Azure Function App - 如何延迟和重新接收无法处理的消息
Azure Function App - How to defer and re-receive an unprocessable message
我有以下 Azure 架构:
IoTDevices ---> IoTHub ---> 功能应用程序
其中:
- IoTDevices:收集传感器数据并将其发送到 IoTHub
- IoTHub:从设备接收数据并将这些数据传送到 Function App(使用 Event Hub 兼容端点)
- Function App: 对接收到的数据进行一些处理
现在在功能应用程序中我有这样的东西:
public static void Run([IoTHubTrigger("messages/events", Connection = "EventHubConnection")]EventData message, TraceWriter log)
{
string messageString = Encoding.UTF8.GetString(message.GetBytes());
//do some processing with messageString as input
}
由于多种原因,存在无法进行处理的情况;我想保存消息 SequenceNumber
并延迟消息,以便稍后当处理再次可用时,我可以重新接收来自 IoTHub 的消息。
所以总结一下,问题是:
- 如何延迟我的消息?
- 如何 re-receive/re-read 给定
SequenceNumber
的消息?
https://docs.microsoft.com/en-us/azure/service-bus-messaging/message-deferral
Deferred messages remain in the main queue along with all other active messages (unlike dead-letter messages that live in a subqueue), but they can no longer be received using the regular Receive/ReceiveAsync functions. Deferred messages can be discovered via message browsing if an application loses track of them.
我有以下 Azure 架构:
IoTDevices ---> IoTHub ---> 功能应用程序
其中:
- IoTDevices:收集传感器数据并将其发送到 IoTHub
- IoTHub:从设备接收数据并将这些数据传送到 Function App(使用 Event Hub 兼容端点)
- Function App: 对接收到的数据进行一些处理
现在在功能应用程序中我有这样的东西:
public static void Run([IoTHubTrigger("messages/events", Connection = "EventHubConnection")]EventData message, TraceWriter log)
{
string messageString = Encoding.UTF8.GetString(message.GetBytes());
//do some processing with messageString as input
}
由于多种原因,存在无法进行处理的情况;我想保存消息 SequenceNumber
并延迟消息,以便稍后当处理再次可用时,我可以重新接收来自 IoTHub 的消息。
所以总结一下,问题是:
- 如何延迟我的消息?
- 如何 re-receive/re-read 给定
SequenceNumber
的消息?
https://docs.microsoft.com/en-us/azure/service-bus-messaging/message-deferral
Deferred messages remain in the main queue along with all other active messages (unlike dead-letter messages that live in a subqueue), but they can no longer be received using the regular Receive/ReceiveAsync functions. Deferred messages can be discovered via message browsing if an application loses track of them.