Exemple #1
0
        public async void Configure(
            IApplicationBuilder app,
            ISqsClient sqsClient,
            ISqsConsumerService sqsConsumerService,
            IActorsRepository actorsRepository,
            IMoviesRepository moviesRepository)
        {
            app.UseSerilogRequestLogging();
            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapCustomHealthChecks("SqsReader service");
            });

            if (_appConfig.AwsQueueAutomaticallyCreate)
            {
                await sqsClient.CreateQueueAsync();
            }

            sqsConsumerService.StartConsuming();
            await actorsRepository.CreateTableAsync();

            await moviesRepository.CreateTableAsync();
        }
        public void Configure(
            IApplicationBuilder app
            //#if (AddSqsPublisher || AddSqsConsumer)
            , ISqsClient sqsClient
            //#endif
            //#if (AddSqsConsumer)
            , ISqsConsumerService sqsConsumerService
            //#endif
            )
        {
            //#if (AddSerilog)
            app.UseSerilogRequestLogging();
            //#endif
            app.UseMiddleware <HttpExceptionMiddleware>();
            app.UseRouting();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                //#if (AddHealthChecks)
                endpoints.MapCustomHealthChecks("PROJECT_NAME service");
                //#endif
            });
            //#if (AddSqsPublisher || AddSqsConsumer)

            if (_appConfig.AwsSettings.AutomaticallyCreateQueue)
            {
                sqsClient.CreateQueueAsync().Wait();
            }
            //#endif
            //#if (AddSqsConsumer)
            sqsConsumerService.StartConsuming();
            //#endif
        }
 public IActionResult Start()
 {
     _sqsConsumerService.StartConsuming();
     return(StatusCode((int)HttpStatusCode.OK));
 }