コード例 #1
0
        public static IConveyBuilder RegisterConvey(this IConveyBuilder builder, IConfiguration configuration)
        {
            var uniqueId = Assembly.GetEntryAssembly().GetName().Name;

            //Consult

            /*
             * var consulOptions = new ConsulOptions();
             * configuration.GetSection("External::consult").Bind(consulOptions);
             *
             * //Fabio
             * var fabioOptions = new FabioOptions();
             * configuration.GetSection(FabioSectionName).Bind(fabioOptions);
             *
             *
             * var httpClientOptions = builder.GetOptions<HttpClientOptions>(HttpClientSectionName);
             *
             * consulOptions.Service = uniqueId.ToLower();
             * fabioOptions.Service = uniqueId.ToLower();
             *
             * builder
             *  .AddHttpClient()
             *  .AddConsul(consulOptions, httpClientOptions)
             *  .AddFabio(fabioOptions, consulOptions, httpClientOptions);
             */

            builder
            .AddHttpClient()
            .AddConsul()
            .AddFabio();

            return(builder);
        }
コード例 #2
0
        public static IConveyBuilder AddApp(this IConveyBuilder builder)
        {
            builder
            .AddHttpClient()
            .AddConsul()
            .AddFabio()
            .AddCommandHandlers()
            .AddEventHandlers()
            .AddInMemoryCommandDispatcher()
            .AddInMemoryEventDispatcher()
            .AddMetrics()
            .AddRabbitMq <CorrelationContext>();

            builder.Services.AddChronicle();
            builder.Services.AddTransient <IAvailabilityServiceClient, AvailabilityServiceClient>();

            return(builder);
        }