如何写入DLQ?
How to write to DLQ?
我目前正在尝试处理 DeadLetterQueue 消息。
如何向 DLQ 写入消息?
我尝试了以下方法:
{
"type": "serviceBus",
"name": "outputSbMsg",
"queueName": "dlq-test",
"connection": "bus",
"accessRights_": "Manage",
"direction": "out"
}
但是当我写入 mySbMsg 时,出现以下错误:
Cannot directly create a client on a sub-queue. Create a client on the main queue and use that to create receivers on the appropriate sub-queue.
如何写入 DLQ(最好使用节点)?
AFAIK,您不能将任意消息直接写入服务总线 DLQ。
这与 Azure Functions 无关。通常,C# 服务总线客户端
- 从队列中取出消息。
- 如果消息处理失败,它会抛出异常,调用
BrokeredMessage.Abandon()
或BrokeredMessage.DeadLetter()
。
- 其中每一个都可以将消息移至 DLQ(可能在多次重试之后)。
现在,这在 C# Azure Functions 的上下文中没有太大变化
- 您创建了一个
in
绑定,它从队列中获取消息。
- 如果处理失败,则抛出异常,或在需要时显式调用
BrokeredMessage.Abandon()
或 BrokeredMessage.DeadLetter()
。
- 消息被移动到 DLQ(可能在多次重试之后)。
现在,在 Node 中您没有 BrokeredMessage
class。但是你仍然可以抛出错误。如果您希望消息在第一个错误后移动到 DLQ,请将服务总线队列的 Max Delivery Count
属性 设置为 1
.
我目前正在尝试处理 DeadLetterQueue 消息。 如何向 DLQ 写入消息? 我尝试了以下方法:
{
"type": "serviceBus",
"name": "outputSbMsg",
"queueName": "dlq-test",
"connection": "bus",
"accessRights_": "Manage",
"direction": "out"
}
但是当我写入 mySbMsg 时,出现以下错误:
Cannot directly create a client on a sub-queue. Create a client on the main queue and use that to create receivers on the appropriate sub-queue.
如何写入 DLQ(最好使用节点)?
AFAIK,您不能将任意消息直接写入服务总线 DLQ。
这与 Azure Functions 无关。通常,C# 服务总线客户端
- 从队列中取出消息。
- 如果消息处理失败,它会抛出异常,调用
BrokeredMessage.Abandon()
或BrokeredMessage.DeadLetter()
。 - 其中每一个都可以将消息移至 DLQ(可能在多次重试之后)。
现在,这在 C# Azure Functions 的上下文中没有太大变化
- 您创建了一个
in
绑定,它从队列中获取消息。 - 如果处理失败,则抛出异常,或在需要时显式调用
BrokeredMessage.Abandon()
或BrokeredMessage.DeadLetter()
。 - 消息被移动到 DLQ(可能在多次重试之后)。
现在,在 Node 中您没有 BrokeredMessage
class。但是你仍然可以抛出错误。如果您希望消息在第一个错误后移动到 DLQ,请将服务总线队列的 Max Delivery Count
属性 设置为 1
.