upgrading Windows Azure Service Bus from 1.x to 2.0 - Retry Policy

只愿长相守 提交于 2019-12-13 05:09:20

问题


I am going through an effort to upgrade code that used the old Windows Azure Service Bus (pre 2.0).

This code based used the Enterprise Library Transient Fault Handling blocks to provide a retry policy that is leveraged when calling into the Service Bus API to send and receive queue messages.

Typically the code would look like this (minus all the try/catch/finally, etc.):

 retryPolicy.Execute(() =>  { queueClient.Send(msg); });

However, in Service Bus 2.0, retry policy is built into the messaging factory, so I can set:

_msgFactory.RetryPolicy = RetryExponential.Default;
var queueClient = _msgFactory.CreateQueueClient(path, mode);

Once that is done, I can remove the TFH retry policy's Execute() wrapper around the call to queueClient.Send(msg).

Is this really all that is needed to ensure the queue client is retrying on transient exceptions? Seems to simple. How can I prove that it is retrying?


回答1:


that is indeed all you need to do ;) it's not easy to simulate errors that will be handled transient. maybe a very short network issue (although I'm not sure that client side connection issues will be seen as transient)



来源:https://stackoverflow.com/questions/22768943/upgrading-windows-azure-service-bus-from-1-x-to-2-0-retry-policy

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