How do I dead-letter a message with the Azure Service Bus HTTP API

て烟熏妆下的殇ゞ 提交于 2021-01-05 11:28:15

问题


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.

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.

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.

Does this operation exist in the HTTP API?


回答1:


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.




回答2:


Even though I did not find any documentation for it, you can access dead letter messages via:

https://{servicebusnamespace}/{topic}/subscriptions/{subscriptionname}/$deadletterqueue/messages/head




回答3:


I took a look at the REST Api Reference too and I could not find a way. There's a comparative table that shows features that are available through REST Api and features available through .NET SDK.

http://msdn.microsoft.com/en-us/library/windowsazure/hh780771.aspx

It sounds strange for me because I thought that .NET SDK calls a REST API Resource.

I believe that you must apply Peek-Lock on a message and after the processing, delete it.

Peek-lock message:

http://msdn.microsoft.com/en-us/library/windowsazure/hh780735.aspx

Delete:

http://msdn.microsoft.com/en-us/library/windowsazure/hh780768.aspx



来源:https://stackoverflow.com/questions/20497240/how-do-i-dead-letter-a-message-with-the-azure-service-bus-http-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!