Пример #1
0
    static async Task Main()
    {
        //required to prevent possible occurrence of .NET Core issue https://github.com/dotnet/coreclr/issues/12668
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
        Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");

        Console.Title = "Samples.Unobtrusive.Client";
        var endpointConfiguration = new EndpointConfiguration("Samples.Unobtrusive.Client");

        endpointConfiguration.UsePersistence <LearningPersistence>();
        endpointConfiguration.UseTransport <LearningTransport>();
        var dataBus = endpointConfiguration.UseDataBus <FileShareDataBus>();

        dataBus.BasePath(@"..\..\..\DataBusShare\");

        endpointConfiguration.ApplyCustomConventions();

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        await CommandSender.Start(endpointInstance)
        .ConfigureAwait(false);

        await endpointInstance.Stop()
        .ConfigureAwait(false);
    }
Пример #2
0
    static async Task Main()
    {
        Console.Title = "Samples.ImmutableMessages.UsingInterfaces.Sender";

        #region immutable-messages-endpoint-config

        var endpointConfiguration = new EndpointConfiguration("Samples.ImmutableMessages.UsingInterfaces.Sender");
        endpointConfiguration.UseSerialization <NewtonsoftSerializer>();
        endpointConfiguration.UsePersistence <LearningPersistence>();
        var transportConfiguration = endpointConfiguration.UseTransport <LearningTransport>();

        #endregion

        var routingConfiguration = transportConfiguration.Routing();
        routingConfiguration.RouteToEndpoint(typeof(MyMessageImpl), "Samples.ImmutableMessages.UsingInterfaces.Receiver");
        routingConfiguration.RouteToEndpoint(typeof(MyMessage), "Samples.ImmutableMessages.UsingInterfaces.Receiver");

        endpointConfiguration.ApplyCustomConventions();

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        await MessageSender.Start(endpointInstance)
        .ConfigureAwait(false);

        await endpointInstance.Stop()
        .ConfigureAwait(false);
    }
Пример #3
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.Unobtrusive.Server";
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Unobtrusive.Server");

        endpointConfiguration.EnableInstallers();
        endpointConfiguration.UsePersistence <InMemoryPersistence>();
        endpointConfiguration.UseDataBus <FileShareDataBus>()
        .BasePath(@"..\..\..\DataBusShare\");
        byte[] encryptionKey = Encoding.ASCII.GetBytes("gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6");
        endpointConfiguration.RijndaelEncryptionService("2015-10", encryptionKey);
        endpointConfiguration.SendFailedMessagesTo("error");

        endpointConfiguration.ApplyCustomConventions();

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);

        try
        {
            await CommandSender.Start(endpoint);
        }
        finally
        {
            await endpoint.Stop();
        }
    }
Пример #4
0
        public static Task Main(string[] args)
        {
            var endpoint = "Platformm.GatewayAPI";

            Console.Title = endpoint;
            var configuration = BuildConfigurationBuilder();
            var logger        = LoggerConfiguration.CreateLogger(configuration, endpoint);

            LogManager.Use <SerilogFactory>().WithLogger(logger);
            return(Host
                   .CreateDefaultBuilder(args)
                   .UseNServiceBus(context =>
            {
                var endpointConfiguration = new EndpointConfiguration(endpoint);
                var serilogTracing = endpointConfiguration.EnableSerilogTracing(logger);
                serilogTracing.EnableMessageTracing();
                endpointConfiguration.ApplyCustomConventions();
                var transport = endpointConfiguration.UseTransport <LearningTransport>();
                transport.Routing().RouteToEndpoint(typeof(CreateContact), "Contact.Service");

                return endpointConfiguration;
            })
                   .ConfigureWebHostDefaults(builder =>
                                             builder.UseStartup <Startup>()
                                             )
                   .Build()
                   .RunAsync());
        }
Пример #5
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.Unobtrusive.Client";
        var endpointConfiguration = new EndpointConfiguration("Samples.Unobtrusive.Client");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.UseDataBus<FileShareDataBus>()
            .BasePath(@"..\..\..\DataBusShare\");
        byte[] encryptionKey = Encoding.ASCII.GetBytes("gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6");
        endpointConfiguration.RijndaelEncryptionService("2015-10", encryptionKey);
        endpointConfiguration.SendFailedMessagesTo("error");

        endpointConfiguration.ApplyCustomConventions();

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        try
        {
            await CommandSender.Start(endpointInstance)
                .ConfigureAwait(false);
        }
        finally
        {
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
    }
Пример #6
0
    static async Task Main()
    {
        Console.Title = "Samples.ImmutableMessages.UsingInterfaces.Receiver";
        var endpointConfiguration = new EndpointConfiguration("Samples.ImmutableMessages.UsingInterfaces.Receiver");

        endpointConfiguration.UseSerialization <NewtonsoftSerializer>();
        endpointConfiguration.UsePersistence <LearningPersistence>();
        endpointConfiguration.UseTransport <LearningTransport>();

        endpointConfiguration.ApplyCustomConventions();

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        Console.WriteLine("Samples.ImmutableMessages.UsingInterfaces.Receiver started. Press any key to exit.");
        Console.ReadLine();

        await endpointInstance.Stop()
        .ConfigureAwait(false);
    }
Пример #7
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.Unobtrusive.Server";
        var endpointConfiguration = new EndpointConfiguration("Samples.Unobtrusive.Server");

        endpointConfiguration.UsePersistence <LearningPersistence>();
        endpointConfiguration.UseTransport <LearningTransport>();
        endpointConfiguration.UseDataBus <FileShareDataBus>()
        .BasePath(@"..\..\..\DataBusShare\");

        endpointConfiguration.ApplyCustomConventions();

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        await CommandSender.Start(endpointInstance)
        .ConfigureAwait(false);

        await endpointInstance.Stop()
        .ConfigureAwait(false);
    }
Пример #8
0
        public static IHostBuilder CreateHostBuilder(string[] args, string endpoint)
        {
            var configuration = BuildConfigurationBuilder();
            var logger        = LoggerConfiguration.CreateLogger(configuration, endpoint);

            LogManager.Use <SerilogFactory>().WithLogger(logger);
            return(Host.CreateDefaultBuilder(args)
                   .UseNServiceBus(context =>
            {
                var endpointConfiguration = new EndpointConfiguration(endpoint);
                var serilogTracing = endpointConfiguration.EnableSerilogTracing(logger);
                serilogTracing.EnableMessageTracing();
                endpointConfiguration.ApplyCustomConventions();
                var transport = endpointConfiguration.UseTransport <LearningTransport>();
                return endpointConfiguration;
            })
                   .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup <Startup>();
            }));
        }
Пример #9
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.Unobtrusive.Server";
        var endpointConfiguration = new EndpointConfiguration("Samples.Unobtrusive.Server");

        endpointConfiguration.EnableInstallers();
        endpointConfiguration.UsePersistence <InMemoryPersistence>();
        endpointConfiguration.UseDataBus <FileShareDataBus>()
        .BasePath(@"..\..\..\DataBusShare\");
        endpointConfiguration.SendFailedMessagesTo("error");

        endpointConfiguration.ApplyCustomConventions();

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        await CommandSender.Start(endpointInstance)
        .ConfigureAwait(false);

        await endpointInstance.Stop()
        .ConfigureAwait(false);
    }
Пример #10
0
    static async Task AsyncMain()
    {
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.EndpointName("Samples.Unobtrusive.Client");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.UseDataBus<FileShareDataBus>()
            .BasePath(@"..\..\..\DataBusShare\");
        endpointConfiguration.RijndaelEncryptionService("gdDbqRpqdRbTs3mhdZh8qCaDaxJXl+e7");
        endpointConfiguration.SendFailedMessagesTo("error");

        endpointConfiguration.ApplyCustomConventions();

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            await CommandSender.Start(endpoint);
        }
        finally
        {
            await endpoint.Stop();
        }
    }