protected override IEnumerator <IteratorAsyncResult <GetRuntimeEntityDescriptionAsyncResult> .AsyncStep> GetAsyncSteps() { MessagingClientEtwProvider.TraceClient(() => { }); if (!this.executeOnce) { while (this.ShouldGetEntityInfo(MessagingExceptionHelper.Unwrap(base.LastAsyncStepException as CommunicationException))) { if (!RuntimeEntityDescriptionCache.TryGet(this.entityAddress, out this.runtimeEntityDescription)) { this.request = this.CreateOrGetRequestMessage(); GetRuntimeEntityDescriptionAsyncResult getRuntimeEntityDescriptionAsyncResult = this; IteratorAsyncResult <GetRuntimeEntityDescriptionAsyncResult> .BeginCall beginCall = (GetRuntimeEntityDescriptionAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.factory.Channel.BeginRequest(thisPtr.request, t, c, s); yield return(getRuntimeEntityDescriptionAsyncResult.CallAsync(beginCall, (GetRuntimeEntityDescriptionAsyncResult thisPtr, IAsyncResult a) => thisPtr.response = thisPtr.factory.Channel.EndRequest(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Continue)); if (base.LastAsyncStepException == null) { this.runtimeEntityDescription = GetRuntimeEntityDescriptionAsyncResult.BuildRuntimeEntityDescription(this.response); RuntimeEntityDescriptionCache.AddOrUpdate(this.entityAddress, this.runtimeEntityDescription); this.clientEntity.RuntimeEntityDescription = this.runtimeEntityDescription; } else { if (!base.LastAsyncStepException.IsWrappedExceptionTransient()) { yield return(base.CallAsyncSleep(Constants.GetRuntimeEntityDescriptionNonTransientSleepTimeout)); } else { yield return(base.CallAsyncSleep(TimeSpan.FromSeconds((double)(this.attempt % 60)) + TimeSpan.FromMilliseconds((double)ConcurrentRandom.Next(1, 1000)))); } GetRuntimeEntityDescriptionAsyncResult getRuntimeEntityDescriptionAsyncResult1 = this; getRuntimeEntityDescriptionAsyncResult1.attempt = getRuntimeEntityDescriptionAsyncResult1.attempt + 1; } } else { this.clientEntity.RuntimeEntityDescription = this.runtimeEntityDescription; } } } else { if (!RuntimeEntityDescriptionCache.TryGet(this.entityAddress, out this.runtimeEntityDescription)) { this.request = this.CreateOrGetRequestMessage(); GetRuntimeEntityDescriptionAsyncResult getRuntimeEntityDescriptionAsyncResult2 = this; IteratorAsyncResult <GetRuntimeEntityDescriptionAsyncResult> .BeginCall beginCall1 = (GetRuntimeEntityDescriptionAsyncResult thisPtr, TimeSpan t, AsyncCallback c, object s) => thisPtr.factory.Channel.BeginRequest(thisPtr.request, t, c, s); yield return(getRuntimeEntityDescriptionAsyncResult2.CallAsync(beginCall1, (GetRuntimeEntityDescriptionAsyncResult thisPtr, IAsyncResult a) => thisPtr.response = thisPtr.factory.Channel.EndRequest(a), IteratorAsyncResult <TIteratorAsyncResult> .ExceptionPolicy.Transfer)); this.runtimeEntityDescription = GetRuntimeEntityDescriptionAsyncResult.BuildRuntimeEntityDescription(this.response); RuntimeEntityDescriptionCache.AddOrUpdate(this.entityAddress, this.runtimeEntityDescription); } this.clientEntity.RuntimeEntityDescription = this.runtimeEntityDescription; } }
private static RuntimeEntityDescription BuildRuntimeEntityDescription(Message response) { GetRuntimeEntityDescriptionResponseCommand body = response.GetBody <GetRuntimeEntityDescriptionResponseCommand>(); RuntimeEntityDescription runtimeEntityDescription = new RuntimeEntityDescription() { EnableMessagePartitioning = body.EnablePartitioning, RequiresDuplicateDetection = body.RequiresDuplicateDetection, PartitionCount = body.PartitionCount, EnableSubscriptionPartitioning = body.EnableSubscriptionPartitioning }; return(runtimeEntityDescription); }