コード例 #1
0
        public void Should_be_able_to_use_fluent_configuration()
        {
            var rabbitMqConfig = new RabbitMqConfiguration() as IRabbitMqConfiguration;

            rabbitMqConfig
            .DefineExchange("exchange-fluent")
            .Type("direct")
            .IsDurable(true)
            .DeclareQueue("rabbitmq://./inbox-work-1")
            .IsDurable(false);

            var factory  = new RabbitMqQueueFactory(rabbitMqConfig);
            var exchange = factory.Configuration.FindExchangeConfiguration("exchange-fluent");
            var queue    = factory.Configuration.FindQueueConfiguration(new Uri("rabbitmq://./inbox-work-1"));

            Assert.IsNotNull(exchange, "The exchange not found asking the QueueFactory configuration.");
            Assert.IsNotNull(queue, "The queue not found asking the QueueFactory configuration.");


            Assert.AreEqual("exchange-fluent", exchange.Name);
            Assert.AreEqual("direct", exchange.Type);
            Assert.IsTrue(exchange.IsDurable);

            Assert.AreEqual("rabbitmq://./inbox-work-1", queue.Uri);
            Assert.IsFalse(queue.IsDurable);
        }
コード例 #2
0
        public void Should_be_able_to_use_fluent_configuration_via_service_bus()
        {
            var rabbitMqConfig = new RabbitMqConfiguration() as IRabbitMqConfiguration;

            rabbitMqConfig
            .DefineExchange("exchange-bus")
            .Type("direct")
            .IsDurable(true)
            .DeclareQueue("rabbitmq://./inbox-work-1")
            .IsDurable(false);

            var busConfig = new ServiceBusConfiguration();

            busConfig.QueueFactory <RabbitMqQueueFactory>(rabbitMqConfig);

            Assert.IsNotNull(QueueManager.Instance.GetQueueFactory("rabbitmq://./inbox-work-1"));
        }