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); }
public static SyncNotificationResult NotifyStatusChanges(string identity, string targetServerFqdn, Guid tenantId, string statusUpdateSvcUrl, bool syncNow, IList <UnifiedPolicyStatus> statusUpdates) { if (string.IsNullOrEmpty(identity)) { throw new ArgumentNullException("identity"); } if (tenantId == Guid.Empty) { throw new ArgumentNullException("tenantId"); } if (string.IsNullOrEmpty(statusUpdateSvcUrl)) { throw new ArgumentNullException("statusUpdateSvcUrl"); } if (statusUpdates == null || statusUpdates.Count == 0) { throw new ArgumentNullException("statusUpdates"); } RpcClientWrapper.InitializeIfNeeded(); NotificationType type = NotificationType.ApplicationStatus; if (!RpcClientWrapper.instance.initialized) { return(new SyncNotificationResult(new SyncAgentTransientException("RPC client not initialized"))); } SyncNotificationResult result; try { using (UnifiedPolicyNotificationRpcClient unifiedPolicyNotificationRpcClient = new UnifiedPolicyNotificationRpcClient(targetServerFqdn ?? RpcClientWrapper.instance.localServer.Fqdn)) { SyncStatusUpdateWorkitem syncStatusUpdateWorkitem = new SyncStatusUpdateWorkitem(identity, syncNow, new TenantContext(tenantId, null), statusUpdates, statusUpdateSvcUrl, 0); byte[] data = unifiedPolicyNotificationRpcClient.Notify(1, (int)type, syncStatusUpdateWorkitem.Serialize()); NotificationRpcOutParameters notificationRpcOutParameters = new NotificationRpcOutParameters(data); result = notificationRpcOutParameters.Result; } } catch (RpcException ex) { result = new SyncNotificationResult(new SyncAgentTransientException(ex.Message, ex)); } return(result); }
public static SyncNotificationResult NotifySyncChanges(string identity, string targetServerFqdn, Guid tenantId, string syncSvcUrl, bool fullSync, bool syncNow, SyncChangeInfo[] syncChangeInfos) { if (string.IsNullOrEmpty(identity)) { throw new ArgumentNullException("identity"); } if (tenantId == Guid.Empty) { throw new ArgumentNullException("tenantId"); } if (string.IsNullOrEmpty(syncSvcUrl)) { throw new ArgumentNullException("syncSvcUrl"); } RpcClientWrapper.InitializeIfNeeded(); NotificationType type = NotificationType.Sync; if (!RpcClientWrapper.instance.initialized) { return(new SyncNotificationResult(new SyncAgentTransientException("RPC client not initialized"))); } SyncNotificationResult result; try { using (UnifiedPolicyNotificationRpcClient unifiedPolicyNotificationRpcClient = new UnifiedPolicyNotificationRpcClient(targetServerFqdn ?? RpcClientWrapper.instance.localServer.Fqdn)) { SyncWorkItem syncWorkItem = new SyncWorkItem(identity, syncNow, new TenantContext(tenantId, null), syncChangeInfos, syncSvcUrl, fullSync, Workload.Exchange, false); byte[] data = unifiedPolicyNotificationRpcClient.Notify(1, (int)type, syncWorkItem.Serialize()); NotificationRpcOutParameters notificationRpcOutParameters = new NotificationRpcOutParameters(data); result = notificationRpcOutParameters.Result; } } catch (RpcException ex) { result = new SyncNotificationResult(new SyncAgentTransientException(ex.Message, ex)); } return(result); }