public RabbitMQMessageQueueTest()
        {
            var RABBITMQ_ENABLED  = Environment.GetEnvironmentVariable("RABBITMQ_ENABLED") ?? "true";
            var RABBITMQ_URI      = Environment.GetEnvironmentVariable("RABBITMQ_URI");
            var RABBITMQ_HOST     = Environment.GetEnvironmentVariable("RABBITMQ_HOST") ?? "localhost";
            var RABBITMQ_PORT     = Environment.GetEnvironmentVariable("RABBITMQ_PORT") ?? "5672";
            var RABBITMQ_QUEUE    = Environment.GetEnvironmentVariable("RABBITMQ_QUEUE") ?? "test";
            var RABBITMQ_EXCHANGE = Environment.GetEnvironmentVariable("RABBITMQ_EXCHANGE") ?? "test";
            var RABBITMQ_USER     = Environment.GetEnvironmentVariable("RABBITMQ_USER") ?? "user";
            var RABBITMQ_PASS     = Environment.GetEnvironmentVariable("RABBITMQ_PASS") ?? "pass123";

            _enabled = BooleanConverter.ToBoolean(RABBITMQ_ENABLED);

            if (_enabled)
            {
                _queue = new RabbitMQMessageQueue("TestQueue");
                _queue.Configure(ConfigParams.FromTuples(
                                     "exchange", RABBITMQ_EXCHANGE,
                                     "queue", RABBITMQ_QUEUE,
                                     "options.auto_create", true,
                                     "connection.uri", RABBITMQ_URI,
                                     "connection.host", RABBITMQ_HOST,
                                     "connection.port", RABBITMQ_PORT,
                                     "credential.username", RABBITMQ_USER,
                                     "credential.password", RABBITMQ_PASS
                                     ));
                _queue.Interval = 100;

                _queue.OpenAsync(null).Wait();
                _queue.ClearAsync(null).Wait();

                _fixture = new MessageQueueFixture(_queue);
            }
        }
Exemple #2
0
 public RabbitMQMessageQueueFactory()
 {
     Register(MemoryQueueDescriptor, (locator) => {
         Descriptor descriptor = (Descriptor)locator;
         var queue             = new RabbitMQMessageQueue(descriptor.Name);
         if (_config != null)
         {
             queue.Configure(_config);
         }
         return(queue);
     });
 }