// Token: 0x06000B0B RID: 2827 RVA: 0x00047C18 File Offset: 0x00045E18
        private void ProcessEvent(ADUser user, MailboxSession mailboxSession, StoreObject item)
        {
            Exception     ex            = null;
            StringBuilder stringBuilder = new StringBuilder();

            UMPartnerMessageAssistant.UMPartnerMessageRpcTargetPicker instance = UMPartnerMessageAssistant.UMPartnerMessageRpcTargetPicker.Instance;
            IADSystemConfigurationLookup iadsystemConfigurationLookup          = ADSystemConfigurationLookupFactory.CreateFromOrganizationId(user.OrganizationId);
            ProcessPartnerMessageRequest processPartnerMessageRequest          = new ProcessPartnerMessageRequest();

            processPartnerMessageRequest.MailboxGuid = mailboxSession.MailboxGuid;
            processPartnerMessageRequest.TenantGuid  = iadsystemConfigurationLookup.GetExternalDirectoryOrganizationId();
            processPartnerMessageRequest.ItemId      = item.Id.ToBase64String();
            LocalizedString partnerMessageDescription = UMPartnerMessageAssistant.GetPartnerMessageDescription(item);
            int             num  = 0;
            int             num2 = 0;

            for (;;)
            {
                IVersionedRpcTarget versionedRpcTarget = instance.PickNextServer(user.UMRecipientDialPlanId.ObjectGuid, out num);
                if (versionedRpcTarget == null)
                {
                    break;
                }
                try
                {
                    ex = null;
                    versionedRpcTarget.ExecuteRequest(processPartnerMessageRequest);
                    UMPartnerMessageAssistant.LogMessageProcessingSuccessEvent(partnerMessageDescription, user, versionedRpcTarget);
                    UMPartnerMessageAssistant.SafeDeleteItem(mailboxSession, item.Id);
                    goto IL_151;
                }
                catch (RpcException ex2)
                {
                    ex = ex2;
                    UMPartnerMessageAssistant.Tracer.TraceWarning <string, RpcException>(0L, "UMPMA.ProcessEvent({0}): {1}", versionedRpcTarget.Name, ex2);
                    stringBuilder.AppendLine(Strings.UMRpcError(versionedRpcTarget.Name, ex2.ErrorCode, ex2.Message));
                    if (UMErrorCode.IsPermanent(ex2.ErrorCode))
                    {
                        throw new SkipException(Strings.descUMServerFailure(versionedRpcTarget.Name, partnerMessageDescription, user.DistinguishedName), ex2);
                    }
                    if (UMErrorCode.IsNetworkError(ex2.ErrorCode))
                    {
                        instance.ServerUnavailable(versionedRpcTarget);
                    }
                }
                if (++num2 >= num)
                {
                    goto IL_151;
                }
            }
            UMPartnerMessageAssistant.LogNoServersAvailableEvent(partnerMessageDescription, user);
            throw new TransientMailboxException(Strings.descUMServerNotAvailable(partnerMessageDescription, user.DistinguishedName), null, UMPartnerMessageAssistant.RetrySchedule);
IL_151:
            if (ex != null)
            {
                UMPartnerMessageAssistant.LogMessageProcessingFailedEvent(partnerMessageDescription, user, stringBuilder.ToString());
                throw new TransientMailboxException(Strings.descUMAllServersFailed(partnerMessageDescription, user.DistinguishedName), ex, UMPartnerMessageAssistant.RetrySchedule);
            }
        }
Beispiel #2
0
        // Token: 0x06000A90 RID: 2704 RVA: 0x000455A4 File Offset: 0x000437A4
        private void DoRpc(MwiMessage message)
        {
            int    num    = 3;
            Server server = (Server)base.ConfigObject;

            while (num-- > 0)
            {
                string text = string.Empty;
                try
                {
                    using (UMMwiDeliveryRpcClient ummwiDeliveryRpcClient = new UMMwiDeliveryRpcClient(server.Fqdn))
                    {
                        text = ummwiDeliveryRpcClient.OperationName;
                        ummwiDeliveryRpcClient.SetTimeOut(10000);
                        int assistantLatencyMsec = (int)(ExDateTime.UtcNow.Subtract(message.EventTimeUtc).TotalMilliseconds + (double)base.AverageProcessingTimeMsec);
                        ExTraceGlobals.RpcTracer.TraceDebug((long)this.GetHashCode(), "ExRpcMwiTarget: Executing {0}. Mailbox:{1} {2} {3}", new object[]
                        {
                            text,
                            message.MailboxGuid,
                            message.UserName,
                            message.TenantGuid
                        });
                        ummwiDeliveryRpcClient.SendMwiMessage(message.MailboxGuid, message.DialPlanGuid, message.UserExtension, message.UserName, message.UnreadVoicemailCount, message.TotalVoicemailCount, assistantLatencyMsec, message.TenantGuid);
                        ExTraceGlobals.RpcTracer.TraceDebug((long)this.GetHashCode(), "ExRpcMwiTarget: {0} succeeded. Mailbox:{1} {2} {3}", new object[]
                        {
                            text,
                            message.MailboxGuid,
                            message.UserName,
                            message.TenantGuid
                        });
                    }
                    break;
                }
                catch (RpcException ex)
                {
                    ExTraceGlobals.RpcTracer.TraceWarning((long)this.GetHashCode(), "ExRpcMwiTarget: {0} failed. Mailbox:{1} RetryCount:{2} Error:{3} {4}", new object[]
                    {
                        text,
                        message.MailboxGuid,
                        num,
                        ex.ErrorCode,
                        ex
                    });
                    if (num == 0 || !UMErrorCode.IsNetworkError(ex.ErrorCode))
                    {
                        throw;
                    }
                }
            }
        }