public void Start()
        {
            Log.Assign(new ConsoleLog(typeof(ServiceBusHost))
            {
                LogLevel = LogLevel.Trace
            });

            ConnectionStrings.Approve();

            var subscriptionManager = SubscriptionManager.Default();

            subscriptionManager.Subscribe(new[] { typeof(OrderCompletedEvent).FullName });

            bus = ServiceBus
                  .Create()
                  .SubscriptionManager(subscriptionManager)
                  .AddModule(new SystemExceptionModule())
                  .Start();
        }
Exemple #2
0
        public void Start()
        {
            Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(ServiceBusHost))));

            ConnectionStrings.Approve();

            Log.Information("E-Mail Server Started.");

            container.RegisterSingleton <IEMailGateway, EMailGateway>();
            container.RegisterSingleton <IEMailConfiguration, EMailConfiguration>();
            container.RegisterTransient <IMessageHandler>("Shuttle.EMail.Server");

            bus = ServiceBus
                  .Create()
                  .MessageHandlerFactory(new CastleMessageHandlerFactory(container))
                  .SubscriptionManager(SubscriptionManager.Default())
                  .AddModule(new ActiveTimeRangeModule())
                  .Start();
        }
        private static void Main()
        {
            Log.Assign(new ConsoleLog(typeof(Program))
            {
                LogLevel = LogLevel.Trace
            });

            ConnectionStrings.Approve();

            var subscriptionManager = SubscriptionManager.Default();

            subscriptionManager.Subscribe(new[] { typeof(WorkDoneEvent).FullName });

            var bus = ServiceBus
                      .Create()
                      .SubscriptionManager(subscriptionManager)
                      .Start();

            Console.WriteLine();
            ColoredConsole.WriteLine(ConsoleColor.Green, "Client bus started.  Press CTRL+C to stop.");
            Console.WriteLine();
            ColoredConsole.WriteLine(ConsoleColor.Green, "Press enter to publish an OrderCompleted event.");
            Console.WriteLine();

            while (true)
            {
                Console.ReadLine();

                var message = new OrderCompletedEvent
                {
                    OrderId = Guid.NewGuid()
                };

                bus.Publish(message);

                Console.WriteLine("Published OrderCompleted Id: {0}", message.OrderId);
            }
        }