Beispiel #1
0
        public ActiveProducer(IConnection amqConnection, ISession amqSession, String amqQueueName, EasyNetQ.IBus rabbitBus)
        {
            _rabbitBus = rabbitBus;

            ActiveMQQueue topic = new ActiveMQQueue(amqQueueName);
            _amqProducer = amqSession.CreateProducer(topic);
            countOfMessages = 0;
            _timProducer = new Timer(2000);
            _timProducer.Elapsed += _timProducer_Elapsed;
            _timProducer.Enabled = true;
            log.Info("Producer Connected to Queue '" + amqQueueName + "'");
        }
 public CustomErrorStrategy(
     EasyNetQ.IConnectionFactory connectionFactory,
     ISerializer serializer,
     IEasyNetQLogger logger,
     IConventions conventions,
     ITypeNameSerializer typeNameSerializer)
 {
     this.connectionFactory = connectionFactory;
     this.serializer = serializer;
     this.logger = logger;
     this.conventions = conventions;
     this.typeNameSerializer = typeNameSerializer;
 }
Beispiel #3
0
        public ActiveConsumer(IConnection amqConnection, ISession amqSession, String amqQueueName, EasyNetQ.IBus rabbitBus)
        {
            try
            {
                _rabbitBus = rabbitBus;
                ActiveMQQueue topic = new ActiveMQQueue(amqQueueName);

                _amqConsumer = amqSession.CreateConsumer(topic);
                _amqConsumer.Listener +=_amqConsumer_Listener;

               _rabbitBus.Subscribe<CorpMessage>(amqQueueName, _rabbitMQConsumer_Listener);

               log.Info("Consumer Connected to Queue '" + amqQueueName + "'");
            }
            catch(Exception e)
            {
                log.Info(e.ToString());
                log.Debug(e.ToString());
            }
            finally
            {

            }
        }
 private void MapArguments(EasyNetQ.Management.Client.Model.Arguments arguments, Model.Arguments modelArguments)
 {
     foreach (var argument in arguments)
         modelArguments.Add(argument.Key, argument.Value);
 }
 private static bool IsSystemQueue(EasyNetQ.Management.Client.Model.Queue queue)
 {
     return (queue.AutoDelete ||
             string.IsNullOrEmpty(queue.Name) ||
             queue.Name.StartsWith("amq."));
 }
 private static bool IsSystemBinding(EasyNetQ.Management.Client.Model.Binding binding)
 {
     return (string.IsNullOrEmpty(binding.Source));
 }
Beispiel #7
0
 public override EasyNetQ.Consumer.AckStrategy HandleConsumerError(EasyNetQ.Consumer.ConsumerExecutionContext context, Exception exception)
 {
     return base.HandleConsumerError(context, exception);
 }
Beispiel #8
0
        public void Produce_Open_Message_From_Web_Tracker()
        {
            // Arrange
            var requestUrls = new []
            {
                "http://qawdweb01:8200/?arf=wgedxyzhtzpww",
                "http://qawdweb01:8200/yzhtzp.edx.e-slbnl.wg_1_081214103414.htm"
            };

            const string queueName = "wd40.tracker.queueprocessor";
            const string userAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36";
            
            var msgs = ConsumerClient.GetMessages(queueName);
            var originalMsgCount = msgs.Count();

            // Act
            using (var client = new WebClient())
            {
                client.Headers["User-Agent"] = userAgent;

                requestUrls.ToList().ForEach(x => 
                {
                    var result = client.DownloadString(x);
                
                    // Assert
                    Assert.IsTrue("GIF" == result.Substring(0, 3));
                });
            }

            // Act
            msgs = ConsumerClient.GetMessages(queueName);

            // Assert
            Assert.AreEqual(originalMsgCount + 1, msgs.Count());
        }