/// <summary> /// Factory method. Create and run service bus /// </summary> public static IServiceBus Run(Func <ServiceBusConfiguration, ServiceBusConfiguration> configurationAction) { var config = new ServiceBusConfiguration(); configurationAction(config); var bus = new ServiceBus(config); bus.Run(); return(bus); }
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); } }
/// <summary> /// Factory method. Create and run service bus /// </summary> public static IServiceBus Run(Func<ServiceBusConfiguration, ServiceBusConfiguration> configurationAction) { var config = new ServiceBusConfiguration(); configurationAction(config); var bus = new ServiceBus(config); bus.Run(); return bus; }