[rabbitmq-discuss] Reconnecting to RabbitMQ after disconnection not working?
Kelly Elias
kelly.elias at gmail.com
Fri Mar 1 17:26:34 GMT 2013
Ignore this, the issue was in my code and not RabbitMQ.
On Friday, March 1, 2013 10:04:50 AM UTC-7, Kelly Elias wrote:
>
> I have a class that connects to RabbitMQ like this: (C# code)
>
> private static ConnectionFactory factory;
> private static IConnection connection;
> private static IModel model;
> private static EventingBasicConsumer consumer;
>
> ...
>
>
> factory = new ConnectionFactory {HostName = address};
> factory.RequestedHeartbeat = 30;
> connection = factory.CreateConnection();
>
> connection.ConnectionShutdown += connection_ConnectionShutdown;
>
> model = connection.CreateModel();
>
> lock (model)
> {
> model.ExchangeDeclare(EXCHANGE_NAME, "topic");
> queueName = model.QueueDeclare();
> consumer = new EventingBasicConsumer();
> consumer.Received += consumer_Received;
> model.BasicConsume(queueName, true, consumer);
> }
>
> It all works fine. If I unplug my network connection and wait that 30
> seconds for the heartbeat the code will realize it's no longer connected
> and attempt to reconnect by running the code above again. I don't get any
> errors, but after the re-connection I never get a message from RabbitMQ.
>
> I've tried to dispose the objects I'm using but if I try with the
> connection it hangs and never returns.
>
> Any ideas what I can try?
>
>
> I'm using server version 2.4.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130301/efdeb3e1/attachment.htm>
More information about the rabbitmq-discuss
mailing list