示例#1
0
 public static IHostBuilder CreateHostBuilder(string[] args) =>
 Host.CreateDefaultBuilder(args)
 .UseSerilog()
 .RegisterApplicationServices()
 .ConfigureNSBEndpointWithDefaults(x => HostedEndpointConfig.ReadFrom(x.Configuration))
 .ConfigureServices(services => services.AddHostedService <ChatlistenerWorker>())
 .UseWindowsService();
示例#2
0
        public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
        .UseSerilog()
        .UseNServiceBus(context =>
        {
            var config  = HostedEndpointConfig.ReadFrom(context.Configuration);
            var builder = new EndpointBuilder(config);

            builder.ConfigureRouting(routing =>
            {
                routing.RouteToEndpoint(typeof(LeaveChannelCommand), "AntiHarassmentChatlistener");
                routing.RouteToEndpoint(typeof(JoinChannelCommand), "AntiHarassmentChatlistener");
                routing.RouteToEndpoint(typeof(SendAccountConfirmationCommand), "AntiHarassmentChatlistener");
                routing.RouteToEndpoint(typeof(SendPasswordResetTokenCommand), "AntiHarassmentChatlistener");
                routing.RouteToEndpoint(typeof(RuleExceedCheckCommand), "AntiHarassmentChatlistener");
            });

            return(builder.BuildConfiguration());
        })
        .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup <Startup>());
示例#3
0
        public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
        .UseNServiceBus(context =>
        {
            var config  = HostedEndpointConfig.ReadFrom(context.Configuration);
            var builder = new EndpointBuilder(config);

            builder.ConfigureRouting(routing =>
            {
                routing.RouteToEndpoint(typeof(CheckDataFeedCommand), "AntiHarassmentChatlistener");
                routing.RouteToEndpoint(typeof(TrainSystemCommand), "AntiHarassmentChatlistener");
                routing.RouteToEndpoint(typeof(LeaveChannelCommand), "AntiHarassmentChatlistener");
                routing.RouteToEndpoint(typeof(JoinChannelCommand), "AntiHarassmentChatlistener");
            });

            return(builder.BuildConfiguration());
        })
        .ConfigureServices((_, services) =>
        {
            services.AddSingleton <IMessageDispatcher, MessageDispatcher>();
            services.AddHostedService <Worker>();
        });