Unable to connect to remote rabbitmq server using pika
<p>I am trying to connect to my remote rabbitmq using pika but I am getting Connectionclosed() error. I have made the required changes in rabbit.config for guest user to allow all connections and also the same connection works from my Java code. I even tried creating a new user with all the permission and connecting it, but it still doesn't work. The same code works fine on my localhost though. Can anyone please let me know what might I be doing wrong here?</p>

<pre><code>def queue_message(message, queue):
    credentials = pika.PlainCredentials('xxxx', 'xxxx')
    parameters = pika.ConnectionParameters('remote-server',
                                   5672,
                                    '/',
                                    credentials)
   connection = pika.BlockingConnection(parameters)
   channel = connection.channel()
   channel.queue_declare(queue='python_update_queue')
   channel.basic_publish(exchange='update.fanout',
                  body=message)
   logger.info("Sent message: {} to queue: {}".format(message, queue))
   print 'message sent'
   connection.close()
</code></pre>

<p>Below is the error I get:</p>

<pre><code>app/project/rabbitmq.py" in queue_message
connection = pika.BlockingConnection(parameters)
env/lib/python2.7/site-packages/pika/adapters/blocking_connection.py" in __init__
     self._process_io_for_connection_setup()
env/lib/python2.7/site-packages/pika/adapters/blocking_connection.py" in ss_io_for_connection_setup
                        self._open_error_result.is_ready)
env/lib/python2.7/site-packages/pika/adapters/blocking_connection.py" in _flush_output
         raise exceptions.ConnectionClosed
</code></pre>