Example #1
0
        public static IServiceCollection AddAccountsHealthChecks(
            this IServiceCollection services,
            AccountsDatabaseConfiguration database,
            AccountsRabbitMqConfiguration rabbitMq)
        {
            services.AddHealthChecks()
            .AddNpgSql(database.ConnectionString)
            .AddRabbitMQ(rabbitMq.ConnectionString);

            return(services);
        }
Example #2
0
        public static IServiceCollection AddAccountsRabbitMq(
            this IServiceCollection services,
            AccountsRabbitMqConfiguration configuration)
        {
            services.AddPhemaJsonSerializer();

            var builder = services.AddPhemaRabbitMq(configuration.InstanceName,
                                                    options =>
            {
                options.UserName    = configuration.Username;
                options.Password    = configuration.Password;
                options.Port        = configuration.Port;
                options.HostName    = configuration.Hostname;
                options.VirtualHost = configuration.VirtualHost;
            });

            builder.AddProducers(options =>
                                 options.AddProducer <AccountsExceptionPayload>("amq.direct", "errors")
                                 .Mandatory());

            return(services);
        }