Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var config = new Configuration(AppDomainUnityContext.Current)
                .SetInputQueue("PSB.App2.Input")
                .SetErrorQueue("PSB.App2.Error")
                .AddEndpoint("Shared.ClientMessages", "PSB.App1.Input")
                .AddHandlers(typeof(Program).Assembly);

            var bus = new ServiceBus(config);
            bus.Run();

            Console.WriteLine("Server started. Press enter to send message");

            while (true)
            {
                Console.ReadKey();

                var message = new SayHelloToClientMessage() { Message = "Hello Client!" };
                bus.Send(message);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var bus = ServiceBus.Run(c => c
                .SetServiceLocator(AppDomainUnityServiceLocator.Current)
                .MsmqTransport()
                .SetInputQueue("PSB.App2.Input")
                .SetErrorQueue("PSB.App2.Error")
                .AddEndpoint("Shared.ClientMessages", "PSB.App1.Input")
                .Dispatcher(d => d
                    .AddHandlers(typeof(Program).Assembly)
                )
            );

            Console.WriteLine("Server started. Press enter to send message");

            while (true)
            {
                Console.ReadKey();

                var message = new SayHelloToClientMessage() { Message = "Hello Client!" };
                bus.Send(message);
            }
        }