Пример #1
0
        public static IServiceCollection AddProfilesHealthChecks(
            this IServiceCollection services,
            ProfilesDatabaseConfiguration database,
            ProfilesRabbitMqConfiguration rabbitMq)
        {
            services.AddHealthChecks()
            .AddNpgSql(database.ConnectionString)
            .AddRabbitMQ(rabbitMq.ConnectionString);

            return(services);
        }
        public static IServiceCollection AddProfilesRabbitMq(
            this IServiceCollection services,
            ProfilesRabbitMqConfiguration 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 <ProfilesExceptionPayload>("amq.direct", "errors")
                                 .Mandatory());

            return(services);
        }