views:

117

answers:

1

I have a Windows Service that retrieves messages from a RabbitMQ queue. The service works locally on a Windows 7 machine. When I install the service on a Windows 2008 server it does not work (and does not throw any errors). My ASP.net MVC app can publish messages to the same queue. Could there be a firewall or security issue here? Should I be retrieving messages from RabbitMQ differently than below?

    public void PullFromQueue()
    {
        var connectionFactory = new ConnectionFactory();

        using (var connection = connectionFactory.CreateConnection())
        using (var channel = connection.CreateModel())
        {
            var consumer = new QueueingBasicConsumer(channel);
            channel.ExchangeDeclare(ExchangeName, ExchangeType.Direct, true);
            channel.QueueDeclare(QueueName, true);
            channel.QueueBind(QueueName, ExchangeName, RoutingKey, false, null);
            channel.BasicConsume(QueueName, null, consumer);
            while (true)
            {
                try
                {
                    var e = (BasicDeliverEventArgs)consumer.Queue.Dequeue();
                    var props = e.BasicProperties;
                    props.DeliveryMode = PersistentDelivery;
                    var businessObject = DeserializeBusinessObject(e.DeliveryTag, e.Body);
                    processBusinessObject(businessObject);
                    channel.BasicAck(e.DeliveryTag, false);

                }
                catch (Exception ex)
                {
                    Log<RabbitMQWrapper>.Error("Error in pulling Business Object from Queue", ex);
                }

            }
        }
    } 
A: 

Forgot about the GAC. When I installed the RabbitMQ.Client locally, it was placed in the GAC. Did not set the RabbitMQ.Client DLL to copy local. I find it curious that it did not generate a runtime error. I feel dumb.

Fluffy