示例#1
0
        public static void ConfigureServices(IServiceCollection services, IConfiguration configuration)
        {
            services.AddTransient(typeof(CatService));
            services.AddTransient(typeof(DogService));

            DataLayerConfiguration.ConfigureServices(services, configuration);
        }
        public IDataLayerConfiguration BuildDatabaseConfiguration(IConfigurationRoot configurationBuilder)
        {
            lock (this._lock)
            {
                this.Ec2Check();

                var networkConfiguration = new DataLayerConfiguration
                {
                    IsEc2Instance          = EC2InstanceMetadata.InstanceId != null,
                    ScheduledRuleQueueName = this.GetValue("ScheduledRuleQueueName", configurationBuilder),
                    ScheduleRuleDistributedWorkQueueName = this.GetValue("ScheduleRuleDistributedWorkQueueName", configurationBuilder),
                    CaseMessageQueueName             = this.GetValue("CaseMessageQueueName", configurationBuilder),
                    DataSynchroniserRequestQueueName = this.GetValue("DataSynchronizerQueueName", configurationBuilder),
                    ClientServiceUrl               = this.GetValue("ClientServiceUrlAndPort", configurationBuilder),
                    TestRuleRunUpdateQueueName     = this.GetValue("TestRuleRunUpdateQueueName", configurationBuilder),
                    SurveillanceUserApiAccessToken = this.GetValue("SurveillanceUserApiAccessToken", configurationBuilder),
                    AuroraConnectionString         = this.GetValue("AuroraConnectionString", configurationBuilder),
                    BmllServiceUrl                    = this.GetValue("BmllServiceUrlAndPort", configurationBuilder),
                    UploadCoordinatorQueueName        = this.GetValue("UploadCoordinatorQueueName", configurationBuilder),
                    ScheduleRuleCancellationQueueName = this.GetValue("ScheduleRuleCancellationQueueName", configurationBuilder),
                    ScheduleDelayedRuleRunQueueName   = this.GetValue("ScheduleDelayedRuleRunQueueName", configurationBuilder)
                };

                return(networkConfiguration);
            }
        }
        public async Task Send_SubmitsMessageToQueue()
        {
            var configuration = new DataLayerConfiguration
            {
                DataSynchroniserRequestQueueName =
                    "dev-surveillance-reddeer-data-synchronizer-request"
            };
            var queueClient   = new AwsQueueClient(null);
            var serialiser    = new ThirdPartyDataRequestSerialiser();
            var messageSender = new QueueDataSynchroniserRequestPublisher(
                configuration,
                queueClient,
                serialiser,
                this._logger);

            await messageSender.Send("1");
        }