title: Rabbitmq - Need Fix for a error PLAIN login refused
body: <p>I need to listen for a particular message from a rabbit queue.</p>
  
  <p>For eg: JSON response in queue notifications.info is as follows:</p>
  
  <pre><code>{"event_type": "compute.instance.create.end",
   "timestamp": "2012-03-12 17:00:24.156710",
   "message_id": "00004e00-8da5-4c39-8ffb-c94ed0b5278c",
   "priority": "INFO",
   "publisher_id": "compute.compute-1-5-6-7",
    .
    .
    .
  </code></pre>
  
  <p>So this is an JSON response or message which I am getting in a Queue notifications.info.</p>
  
  <p>I need to listen synchronously for the particular message and also needs to perform certain operations after that.</p>
  
  <p>Please anyone let me know the way for doing the same.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here I have elaborated in detail.This is what I have done so far.</p>
  
  <p>Actually my aim is to get some notification on new instance creation.</p>
  
  <p>So that I have set up the notifications.info to receive message during instance creation.</p>
  
  <p>Now I have framed the basic script which is as follows(Using Rabbitmq site guide):</p>
  
  <pre><code>#!/usr/bin/env python
  import pika
  import sys
  
  connection = pika.BlockingConnection(pika.ConnectionParameters(
          host='localhost'))
  channel = connection.channel()
  
  channel.exchange_declare(exchange='nova',
                           type='direct')
  
  result = channel.queue_declare(exclusive=True)
  queue_name = result.method.queue
  
  severities = sys.argv[1:]
  if not severities:
      print &gt;&gt; sys.stderr, "Usage: %s [info] [warning] [error]" % \
                           (sys.argv[0],)
      sys.exit(1)
  
  for severity in severities:
      channel.queue_bind(exchange='nova',
                         queue=queue_name,
                         routing_key=severity)
  
  print ' [*] Waiting for logs. To exit press CTRL+C'
  
  def callback(ch, method, properties, body):
      print " [x] %r:%r" % (method.routing_key, body,)
  
  channel.basic_consume(callback,
                        queue=queue_name,
                        no_ack=True)
  
  channel.start_consuming()
  </code></pre>
  
  <p>There is more modifications were needs to be done in scipts.</p>
  
  <p>But now issue is that while executing the script I am getting error which is as follows:</p>
  
  <pre><code>Traceback (most recent call last):
    File "new1.py", line 6, in &lt;module&gt;
      host='localhost'))
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection                                                                                        .py", line 339, in __init__
      self._process_io_for_connection_setup()
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection                                                                                        .py", line 374, in _process_io_for_connection_setup
      self._open_error_result.is_ready)
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection                                                                                        .py", line 410, in _flush_output
      self._impl.ioloop.poll()
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/select_connection.p                                                                                        y", line 602, in poll
      self._process_fd_events(fd_event_map, write_only)
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/select_connection.p                                                                                        y", line 443, in _process_fd_events
      handler(fileno, events, write_only=write_only)
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py"                                                                                        , line 364, in _handle_events
      self._handle_read()
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py"                                                                                        , line 407, in _handle_read
      return self._handle_error(error)
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py"                                                                                        , line 338, in _handle_error
      self._handle_disconnect()
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py"                                                                                        , line 288, in _handle_disconnect
      self._adapter_disconnect()
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/select_connection.p                                                                                        y", line 95, in _adapter_disconnect
      super(SelectConnection, self)._adapter_disconnect()
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py"                                                                                        , line 154, in _adapter_disconnect
      self._check_state_on_disconnect()
    File "/usr/local/lib/python2.7/dist-packages/pika/adapters/base_connection.py"                                                                                        , line 173, in _check_state_on_disconnect
      raise exceptions.ProbableAuthenticationError
  pika.exceptions.ProbableAuthenticationError
  </code></pre>
  
  <p>Log is showing the error is as follows:</p>
  
  <pre><code>{handshake_error,starting,0,
                   {amqp_error,access_refused,
                               "PLAIN login refused: user 'guest' - invalid credentials",
                               'connection.start_ok'}}
  </code></pre>
  
  <p>So some one let me know what is needs to be done here to fix this.</p>
  
  <p>Note: I am able to access a rabbitmq front end with guest user.</p>