什么“瞬态异常”由ServiceProxy处理?
问题描述:
望着Service Remoting article,我可以看到以下内容:什么“瞬态异常”由ServiceProxy处理?
如果出现瞬态异常,代理重试呼叫。
什么具体被认为是由代理的“瞬态异常”?
在我们处理超时,InvalidOperation(See here),FabricNotReadableException(See here)和FabricTransientExceptions身处地为操作可靠集合了过去 - 我们应该做同样为我们的使用SF Remoting的其他服务互动?
作为一个例子:
//Get Proxy
var serviceProxy = ServiceProxy.Create<IService>(GetServiceUri(), GetPartitionKey());
//Make Call to method which has no internal handling for transient SF failures...
//Should this be wrapped with a retry policy?
var result = await serviceProxy.GetAll();
答
具体根据异常处理程序用于在远程(ServiceRemotingExceptionHandler.cs),看来该代理将处理如下错误:
- FabricNotPrimaryException当主移动
- FabricTransientException异常
- FabricNotReadableException异常
您可能仍希望自己处理Timeout异常。
它可能是某处[在代码中](https://github.com/Azure/service-fabric-services-and-actors-dotnet/blob/develop/src/Microsoft.ServiceFabric.Services.Remoting/Client /ServiceRemotingExceptionHandler.cs#L118),所以也许可以得到代码,然后进行一些挖掘。 –
@PeterBons谢谢!我没有意识到这一切都是开源的......看起来它包含了FabricNotPrimaryException,当主移动时以及FabricTransientException和FabricNotReadableException的所有实例 –