/// <summary>
 /// Check exchange mailboxes subscriptions state. Starts exchange events service.
 /// Fail handler for mailboxes without subscription.
 /// </summary>
 /// <param name="userConnection"><see cref="UserConnection"/> instance.</param>
 /// <param name="parameters">Process parameters collection.</param>
 public void Execute(UserConnection userConnection, IDictionary <string, object> parameters)
 {
     _log = ClassFactory.Get <ISynchronizationLogger>(new ConstructorArgument("userId", userConnection.CurrentUser.Id));
     try {
         _log.InfoFormat("ListenerServiceFailJob started");
         if (!GetIsFeatureEnabled(userConnection, "ExchangeListenerEnabled"))
         {
             return;
         }
         UserConnection  = userConnection;
         ListenerManager = GetExchangeListenerManager();
         _log.DebugFormat("ListenerServiceFailJob: _listenerManager initiated");
         var mailboxes = GetMailboxesWithoutSubscriptions();
         ScheduleFailoverHandlers(mailboxes);
     } finally {
         int periodMin = Core.Configuration.SysSettings.GetValue(userConnection, "ListenerServiceFailJobPeriod", 1);
         if (periodMin == 0)
         {
             var schedulerWraper = ClassFactory.Get <IAppSchedulerWraper>();
             schedulerWraper.RemoveGroupJobs(ListenerServiceFailJobFactory.JobGroupName);
             _log.ErrorFormat("ListenerServiceFailJobPeriod is 0, ListenerServiceFailJob stopped");
         }
         _log.InfoFormat("ListenerServiceFailJob ended");
     }
 }
        /// <summary>
        /// Starts events subscription and email synchronization process for period.
        /// </summary>
        /// <param name="userConnection"><see cref="UserConnection"/> instance.</param>
        /// <param name="parameters">Parameters collection.</param>
        public void Execute(UserConnection userConnection, IDictionary <string, object> parameters)
        {
            _log.DebugFormat("ListenerServiceFailHandler started");
            UserConnection = userConnection;
            if (!GetIsFeatureEnabled("ExchangeListenerEnabled"))
            {
                _log.DebugFormat("ExchangeListenerEnabled feature disabled, ListenerServiceFailHandler ended");
                return;
            }
            ListenerManager = GetExchangeListenerManager();
            _log.DebugFormat("ExchangeListenerManager created");
            Guid mailboxId = (Guid)parameters["mailboxId"];
            var  mailbox   = GetMailbox(mailboxId);

            StartSubscription(mailbox);
            _log.DebugFormat("Events subscription for {0} mailbox created", mailboxId);
            StartPeriodSyncJob(mailbox);
            _log.DebugFormat("Email synchronization process for {0} mailbox created", mailboxId);
            _log.DebugFormat("ListenerServiceFailHandler ended");
        }
Exemplo n.º 3
0
        public void RecreateListener(Guid mailboxId)
        {
            IExchangeListenerManager manager = GetExchangeListenerManager();

            manager.RecreateListener(mailboxId);
        }
Exemplo n.º 4
0
        public void StopListener(Guid mailboxId)
        {
            IExchangeListenerManager manager = GetExchangeListenerManager();

            manager.StopListener(mailboxId);
        }
 /// <summary>
 /// ctor.
 /// </summary>
 public MailDiagnosticToolsService() : base()
 {
     _mailboxService =
         ClassFactory.Get <IMailboxService>(new ConstructorArgument("uc", UserConnection));
     _exchangeListenerManager = GetExchangeListenerManager();
 }
        public IntegrationCredentialsValidator(UserConnection uc) : base(uc)
        {
            var listenerManagerFactory = ClassFactory.Get <IListenerManagerFactory>();

            _listenerManager = listenerManagerFactory.GetExchangeListenerManager(uc);
        }