static void Main(string[] args) { LoggerManager.Create(Log4NetFactory.CreateFrom("config/logging.xml")); var service = ConfigurationHelper.With("config/service.xml") .Log4NetBuilder("config/logging.xml") .ConfigureMessageBuilder() .With( RegisterTypes.FromAssembly(typeof(MessageBasic)) .Pick() .WithService.FirstInterface() ).AllInterfaceToClass() .ConfigureService() .Create(); service.Start(); Console.WriteLine("Pulsa X para parar el servicio"); while (true) { var key = Console.ReadKey(true); if (key.KeyChar == 'x' || key.KeyChar == 'X') { break; } } service.Stop(); }
static void Main(string[] args) { var busPublisher = ConfigurationPublisher.With("config/sender.xml") .Log4NetBuilder("config/logging.xml") .ConfigureMessageBuilder().With( RegisterTypes.FromAssembly(typeof(IMySimpleData)) .Pick() .WithService.FirstInterface() ).AllInterfaceToClass() .ConfigurePublisher() .Create(); Console.WriteLine("Pulsa un tecla para enviar un mensaje, o X para salir."); while (true) { var key = Console.ReadKey(true); if (key.KeyChar == 'x' || key.KeyChar == 'X') { break; } var mySimpleData = busPublisher.MessageBuilder.CreateInstance <IMySimpleData>(data => { data.Data = "Hello Receiver"; data.Count = 10; }); busPublisher.Publish(mySimpleData); } }