static void Main(string[] args)
        {
            Bus bus = new BusBuilder().Configure(ctx => ctx.WithDefaultSerializationStrategy(new JsonSerializationStrategy())).Build();
            bus.Connect();

            bool readingInput = true;
            while(readingInput)
            {
                Console.WriteLine("Press enter to publish a message or 'X' to exit");

                var keyInfo = Console.ReadKey();

                switch(keyInfo.Key)
                {
                    case ConsoleKey.Enter:
                        bus.Publish(new StatusMessage("This is a test."));
                        break;

                        case ConsoleKey.X:
                        readingInput = false;
                        break;
                }
            }

            bus.Close();
        }
        static void Main(string[] args)
        {
            Bus bus = new BusBuilder().Build();
            bus.Connect();

            bool readingInput = true;
            while (readingInput)
            {
                Console.WriteLine("Press enter to publish a message or 'X' to exit");

                var keyInfo = Console.ReadKey();

                switch (keyInfo.Key)
                {
                    case ConsoleKey.Enter:
                        string messageText = "Hello, World";
                        bus.Publish(new Message(messageText));
                        Console.WriteLine("Published message: {0}", messageText);
                        break;

                    case ConsoleKey.X:
                        readingInput = false;
                        break;
                }
            }

            bus.Close();
        }
        static void Main(string[] args)
        {
            Bus bus = new BusBuilder().Build();
            bus.Connect();

            bus.Subscribe<Message>(messageContext => Console.WriteLine("Received message: \'{0}\'", messageContext.Message.Text));

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
            bus.Close();
        }
        static void ConsumeRabbitMqMessages(int testCount)
        {
            new Thread(() =>
                {
                    var reset = new ManualResetEvent(false);
                    Bus bus = new BusBuilder()
                        .Configure(ctx => ctx.Consume<TestMessage>().WithExchange("rabbitMQ.test.exchange")
                                              .WithQueue("rabbitMQ.test.queue"))
                        .Build();
                    bus.Connect();
                    bus.Subscribe<TestMessage>(x =>
                        {
                            _rabbitMqMessageReceived++;
                            if (_rabbitMqMessageReceived >= testCount)
                                reset.Set();
                        });

                    reset.WaitOne();
                    Console.WriteLine("Finished consuming rabbitMQ messages: " + _rabbitMqMessageReceived);
                    bus.Close();
                }).Start();
        }
 static void TestRabbitBus(int messageCount)
 {
     Bus bus = new BusBuilder()
         .Configure(ctx => ctx.Publish<TestMessage>().WithExchange("rabbitBus.test.exchange"))
         .Build();
     bus.Connect();
     for (int i = 0; i < messageCount; i++)
     {
         bus.Publish(new TestMessage("test"));
     }
     bus.Close();
 }