public SubscriptionFacade(string configPath, Consumer consumer, Publisher publisher, MySqlDatabaseClient database)
 {
     _configPath            = configPath;
     _configContent         = new JsonFileContent(configPath);
     _consumer              = consumer;
     _publisher             = publisher;
     _subject               = new Subject();
     _dbClien               = database;
     _subscriptionQueueKey  = Convert.ToString(_configContent.Value("SubscriotionQueueKey"));
     _subscriptionKey       = Convert.ToString(_configContent.Value("SubscriotionKey"));
     _cancelSubscriptionKey = Convert.ToString(_configContent.Value("CanceledSubscriotionKey"));
     _unit = new SubscriptionUnitOfWork(_dbClien);
     Restart();
 }
Example #2
0
        public Intialization()
        {
            var configPath = Path.Join(Directory.GetCurrentDirectory(), "configs.json");

            configContent = new JsonFileContent(configPath);
            consumer      = new Consumer(
                configContent.Value("RabbitUrl").ToString(),
                configContent.Value("RabbitLogin").ToString(),
                configContent.Value("RabbitPassword").ToString()
                );
            publisher = new Publisher(
                configContent.Value("RabbitUrl").ToString(),
                configContent.Value("RabbitLogin").ToString(),
                configContent.Value("RabbitPassword").ToString()
                );
            connection = new MySqlDatabaseConnection(
                configContent.Value("MySqlServer").ToString(),
                configContent.Value("MySqlDatabase").ToString(),
                configContent.Value("MySqlLogin").ToString(),
                configContent.Value("MySqlPassword").ToString()
                );
            databaseClient = new MySqlDatabaseClient(connection);
            facade         = new SubscriptionFacade("configs.json", consumer, publisher, databaseClient);
        }