Exemplo n.º 1
0
 public override byte[] Notify(int version, int type, byte[] inputParameterBytes)
 {
     byte[] result2;
     try
     {
         using (new Timer(new TimerCallback(RpcServerWrapper.CrashOnCallTimeout), Thread.CurrentThread, RpcServerWrapper.notifyRequestTimeout, TimeSpan.FromMilliseconds(-1.0)))
         {
             WorkItemBase           workItem = WorkItemBase.Deserialize(inputParameterBytes);
             SyncNotificationResult result   = null;
             try
             {
                 WorkItemBase workItem2 = SyncManager.EnqueueWorkItem(workItem);
                 result = new SyncNotificationResult(UnifiedPolicyNotificationFactory.Create(workItem2, new ADObjectId()));
             }
             catch (SyncAgentExceptionBase error)
             {
                 result = new SyncNotificationResult(error);
             }
             NotificationRpcOutParameters notificationRpcOutParameters = new NotificationRpcOutParameters(result);
             result2 = notificationRpcOutParameters.Serialize();
         }
     }
     catch (Exception ex)
     {
         ExWatson.SendReport(ex, ReportOptions.None, null);
         NotificationRpcOutParameters notificationRpcOutParameters = new NotificationRpcOutParameters(new SyncNotificationResult(ex));
         result2 = notificationRpcOutParameters.Serialize();
     }
     return(result2);
 }
Exemplo n.º 2
0
 public void Update(WorkItemBase item)
 {
     if (item == null)
     {
         throw new ArgumentException("item is null");
     }
     if (item.WorkItemId == null)
     {
         throw new ArgumentException("WorkItemId can't be null inside Update");
     }
     try
     {
         using (UnifiedPolicySyncNotificationDataProvider dataProvider = this.GetDataProvider(item.TenantContext.TenantId))
         {
             UnifiedPolicyNotificationBase unifiedPolicyNotificationBase = UnifiedPolicyNotificationFactory.Create(item, dataProvider.MailboxOwner.Id);
             unifiedPolicyNotificationBase.ResetChangeTracking(true);
             unifiedPolicyNotificationBase.Version = Guid.NewGuid();
             dataProvider.Save(unifiedPolicyNotificationBase);
         }
     }
     catch (ObjectNotFoundException)
     {
     }
     catch (StorageTransientException innerException)
     {
         throw new SyncAgentTransientException("Failed to update sync workitem in persistent queue because of StorageTransientException", innerException);
     }
     catch (StoragePermanentException innerException2)
     {
         throw new SyncAgentPermanentException("Failed to update sync workitem in persistent queue because of StoragePermanentException", innerException2);
     }
     catch (TransientException innerException3)
     {
         throw new SyncAgentTransientException("Failed to update sync workitem in persistent queue because of TransientException", innerException3);
     }
     catch (DataSourceOperationException innerException4)
     {
         throw new SyncAgentTransientException("Failed to update sync workitem in persistent queue because of DataSourceOperationException", innerException4);
     }
     catch (DataValidationException innerException5)
     {
         throw new SyncAgentTransientException("Failed to update sync workitem in persistent queue because of DataValidationException", innerException5);
     }
 }
Exemplo n.º 3
0
 public void Enqueue(WorkItemBase item)
 {
     if (item == null)
     {
         throw new ArgumentException("item is null");
     }
     try
     {
         using (UnifiedPolicySyncNotificationDataProvider dataProvider = this.GetDataProvider(item.TenantContext.TenantId))
         {
             UnifiedPolicyNotificationBase unifiedPolicyNotificationBase = UnifiedPolicyNotificationFactory.Create(item, dataProvider.MailboxOwner.Id);
             dataProvider.Save(unifiedPolicyNotificationBase);
             item.HasPersistentBackUp = true;
             item.WorkItemId          = unifiedPolicyNotificationBase.StoreObjectId.ToBase64String();
         }
     }
     catch (StorageTransientException innerException)
     {
         throw new SyncAgentTransientException("Failed to enqueue sync workitem into persistent queue because of StorageTransientException", innerException);
     }
     catch (StoragePermanentException innerException2)
     {
         throw new SyncAgentPermanentException("Failed to enqueue sync workitem into persistent queue because of StoragePermanentException", innerException2);
     }
     catch (TransientException innerException3)
     {
         throw new SyncAgentTransientException("Failed to enqueue sync workitem into persistent queue because of TransientException", innerException3);
     }
     catch (DataSourceOperationException innerException4)
     {
         throw new SyncAgentTransientException("Failed to enqueue sync workitem into persistent queue because of DataSourceOperationException", innerException4);
     }
     catch (DataValidationException innerException5)
     {
         throw new SyncAgentTransientException("Failed to enqueue sync workitem into persistent queue because of DataValidationException", innerException5);
     }
 }