如何使用Azure Service Bus HTTP API对消息进行死信

问题描述:

我正在尝试与Azure Service Bus集成以执行代理消息传递.之前,我已经成功使用了托管.NET API,但是这次我需要使用HTTP API.

I'm trying to integrate with the Azure Service Bus to perform brokered messaging. I've used the managed .NET API successfully before, but this time I need to use the HTTP API.

在处理消息时,如果我确定消息是有毒的(即永远无法成功处理),我想将消息移至死信队列.

When processing a message, if I determine that a message is poisonous (i.e. it can never be processed successfully), I want to move the message to the dead-letter queue.

在托管API中,我将调用 BrokeredMessage.DeadLetterAsync() ,它使我可以指定对消息进行死信处理的原因,并将其作为原子操作移至死信队列中.

In the managed API, I'd call BrokeredMessage.DeadLetterAsync() which lets me specify the reasons for dead-lettering the message and moves it to the dead-letter queue as an atomic operation.

一直在阅读 HTTP API文档,我已经找到并调用了执行其他操作的操作,例如窥视锁定,删除锁定的消息或放弃了锁定,但是我找不到用于对消息进行死信的显式操作.

Having been reading through the HTTP API documentation, I've found and invoked operations to perform the other actions, such as peek-lock, delete a locked message or abandon a lock, but I can't find an explicit operation to dead-letter a message.

HTTP API中是否存在此操作?

Does this operation exist in the HTTP API?

今天,通过http/rest API不支持DeadLetter操作.我们将在即将发布的版本中添加该支持.当达到任何邮件的最大传递计数并且仍未完成时,如果为队列/订阅启用了该传递计数,则会自动对它进行死信签名.上面提到的连接模式适用于.NET API,其中SBMP服务总线协议通过http/port80连接进行隧道传输,因此它不使用REST API.

DeadLetter operation today is not supported thru the http/rest API. We will add that support in an upcoming release. When the max delivery count for any message is reached and it is still not completed then it will be automatically deadlettered if that is enabled for the queue/subscription. The connectivity mode mentioned above is for the .NET API where the SBMP service bus protocol is tunneled over a http/port80 connection so it is not using REST APIs for that.