public CustomersController(IConfiguration Configuration, LoggerFactory loggerFactory, IMapper mapper)
        {
            this._config        = Configuration;
            this._mapper        = mapper;
            this._loggerFactory = loggerFactory;


            this._logger = loggerFactory.CreateLogger <CustomersController>();

            // -------------- Setup Kafka AppEvent Producer ----------------------- //
            this._crudMsgQueueTopic = Configuration["KafkaService:Topic"];
            this._appEventProducer  = new app.common.messaging.generic.KafkaProducer <AppEventArgs <Customer> >(loggerFactory);
            this._appEventProducer.Setup(new Dictionary <string, object>
            {
                { "bootstrap.servers", this._config["KafkaService:Server"] }
            });

            this._notificationMsgQueueTopic = Configuration["KafkaService:NotificationTopic"];
            // -------------- Setup Kafka Notification Producer ----------------------- //
            this._notificationProducer = new app.common.messaging.generic.KafkaProducer <EmailEventArgs>(loggerFactory);
            this._notificationProducer.Setup(new Dictionary <string, object>
            {
                { "bootstrap.servers", this._config["KafkaService:Server"] }
            });

            // Configure repository
            this._evtHandlerLst = new List <Guid>();
            __setupRepo();
        }
        public AppEmailServer(ILoggerFactory loggerFactory, IConfigurationRoot Configuration)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException("LoggerFactory needed for AppEmailServer initialization");
            }


            if (Configuration == null)
            {
                throw new ArgumentNullException("Configuration needed for AppReplicationServer initialization");
            }

            this._loggerFactory = loggerFactory;

            this._logger = this._loggerFactory.CreateLogger <AppEmailServer>();

            // Get Mail Service related configuration
            string host           = Configuration["SmtpService:Host"];
            int    port           = Convert.ToInt32(Configuration["SmtpService:Port"]);
            string userid         = Configuration["SmtpService:UserID"];
            string pwd            = Configuration["SmtpService:Password"];
            string mailboxName    = Configuration["SmtpService:MailboxName"];
            string mailboxAddress = Configuration["SmtpService:MailboxAddress"];
            bool   usessl         = Convert.ToBoolean(Configuration["SmtpService:EnableSSL"]);

            this.mailService = new EmailService(this._loggerFactory);
            this.mailService.Setup(host, port, userid, pwd, mailboxName, mailboxAddress, usessl);

            // Get Kafka Service related configuration
            this._kafkaServerAddress       = Configuration["KafkaService:Server"];
            this._notificationTopic        = Configuration["KafkaService:Topic"];
            this._notificationGroup        = Configuration["KafkaService:Group"];
            this._notificationFailureTopic = Configuration["KafkaService:FailedTopic"];

            this._notificationProducer = new app.common.messaging.generic.KafkaProducer <EmailEventArgs>(loggerFactory);
            this._notificationProducer.Setup(new Dictionary <string, object>
            {
                { "bootstrap.servers", this._kafkaServerAddress }
            });
        }
        public AppReplicationServer(ILoggerFactory loggerFactory, IConfigurationRoot Configuration)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException("LoggerFactory needed for AppReplicationServer initialization");
            }

            if (Configuration == null)
            {
                throw new ArgumentNullException("Configuration needed for AppReplicationServer initialization");
            }

            this._loggerFactory = loggerFactory;
            this._logger        = this._loggerFactory.CreateLogger <AppReplicationServer>();
            this._config        = Configuration;

            // Get Kafka Service related configuration
            this._kafkaServerAddress = Configuration["KafkaService:Server"];

            // ---------------------  Setup Kafka Consumer ------------------------- //
            this._crudMsgQueueTopic   = Configuration["KafkaService:Topic"];
            this._notificationGroup   = Configuration["KafkaService:Group"];
            this._appEventMsgConsumer = new app.common.messaging.generic.KafkaConsumer <AppEventArgs <Customer> >(loggerFactory);
            var customerConfig = new Dictionary <string, object>
            {
                { "bootstrap.servers", this._kafkaServerAddress },
                { "group.id", this._notificationGroup },

                { "auto.commit.interval.ms", 5000 },
                { "auto.offset.reset", "earliest" }
            };
            var consumeTopics = new List <string>()
            {
                this._crudMsgQueueTopic
            };

            this._appEventMsgConsumer.Setup(customerConfig, consumeTopics);


            // -------------- Setup Kafka Notification Producer ----------------------- //
            this._notificationMsgQueueTopic = Configuration["KafkaService:NotificationTopic"];
            this._notificationProducer      = new app.common.messaging.generic.KafkaProducer <EmailEventArgs>(loggerFactory);
            this._notificationProducer.Setup(new Dictionary <string, object>
            {
                { "bootstrap.servers", this._kafkaServerAddress }
            });

            // -------------------- Configure data replication repository ---------------------------- //
            this._custrepo = new MongoRepository <Customer>(this._loggerFactory);
            this._custrepo.Setup(
                Configuration["ConnectionStrings:CustomerDb:url"],
                Configuration["ConnectionStrings:CustomerDb:db"],
                Configuration["ConnectionStrings:CustomerDb:collection"]);


            // ------------- Configure ElasticSearch repository -------------------------------- //
            this._searchrepo = new ElasticRepository <Customer>(loggerFactory,
                                                                Configuration["ElasticService:ServerUrl"], null,
                                                                "customer",
                                                                Configuration["ElasticService:AppIndex"]);
        }