/// <summary>
 /// Constructor
 /// </summary>
 public DatabasePoller(DbMessenger messenger, MessageGatewayService service)
     : base(messenger.PollingInterval * 1000)
 {
     this.messenger = messenger;
     this.messageGatewayService = service;
     this.isRunning = false;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public DatabasePoller(DbMessenger messenger, MessageGatewayService service)
     : base(messenger.PollingInterval * 1000)
 {
     this.messenger             = messenger;
     this.messageGatewayService = service;
     this.isRunning             = false;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public OutgoingMessagePoller(MessageGatewayService service)
     : base()
 {
     this.messageGatewayService = service;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public OutgoingMessagePoller(MessageGatewayService service)
     : base()
 {
     this.messageGatewayService = service;
 }
        /// <summary>
        /// Starts the message service.
        /// </summary>
        private void StartMessageService()
        {
            try
            {
                log.Info("Start message service");

                if (messageGatewayService != null)
                {
                    messageGatewayService.RemoveAll();
                    messageGatewayService = null;
                }

                // Create the gateway service instance
                messageGatewayService = MessageGatewayService.NewInstance();

                foreach (GatewayConfig gwConfig in GatewayConfig.All())
                {
                    if (gwConfig.AutoConnect.Value)
                        ConnectGateway(gwConfig);
                }

                log.Info("Message service started successfully");
            }
            catch (Exception ex)
            {
                log.Error(string.Format("Error starting message service: {0}", ex.Message, ex));
            }
        }