[rabbitmq-discuss] rabbitMQ-2.8.2 : problem with credentials

bino oetomo bino at indoakses-online.com
Thu May 17 06:26:49 BST 2012


Dear All ...
My System is RabitMQ 2.8.2 on Ubuntu-lucid.
Installed using apt-get from :
deb http://www.rabbitmq.com/debian/ testing main

I try to use credential, but got error msg.

Here it is :
==1.This is the sender01.py without credential=======
import pika
import sys

connection = 
pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()

channel.queue_declare(queue='task_queue', durable=True)

message = ' '.join(sys.argv[1:]) or "Hello World!"
channel.basic_publish(exchange='',
     routing_key='task_queue',
     body=message,
     properties=pika.BasicProperties(delivery_mode = 2,))
print ' [x] Sent %r' % (message,)
connection.close()
==2. and the result is===============================
root at core /opt/oprekan# python ./sender01.py 'without credentials'
  [x] Sent 'without credentials'
==3. try to add 1 user===============================
root at core /opt/oprekan# rabbitmqctl add_user bino01 123456
Creating user "bino01" ...
...done.
==4. and this is sender02.py with credentials========
import pika
import sys

credentials = pika.PlainCredentials('bino01', '123456')
connection = 
pika.BlockingConnection(pika.ConnectionParameters(credentials=credentials,host='127.0.0.1'))
channel = connection.channel()
channel.queue_declare(queue='task_queue', durable=True)

message = ' '.join(sys.argv[1:]) or "Hello World!"
channel.basic_publish(exchange='',
     routing_key='task_queue',
     body=message,
     properties=pika.BasicProperties(delivery_mode = 2,))
print ' [x] Sent %r' % (message,)
connection.close()

==5. and here is the result============================
root at core /opt/oprekan# python ./sender02.py 'WITH credentials'
Traceback (most recent call last):
   File "./sender02.py", line 5, in <module>
     connection = 
pika.BlockingConnection(pika.ConnectionParameters(credentials=credentials,host='127.0.0.1'))
   File 
"/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", 
line 32, in __init__
     BaseConnection.__init__(self, parameters, None, reconnection_strategy)
   File 
"/usr/local/lib/python2.6/dist-packages/pika/adapters/base_connection.py", 
line 50, in __init__
     reconnection_strategy)
   File "/usr/local/lib/python2.6/dist-packages/pika/connection.py", 
line 170, in __init__
     self._connect()
   File "/usr/local/lib/python2.6/dist-packages/pika/connection.py", 
line 228, in _connect
     self.parameters.port or  spec.PORT)
   File 
"/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", 
line 44, in _adapter_connect
     self._handle_read()
   File 
"/usr/local/lib/python2.6/dist-packages/pika/adapters/base_connection.py", 
line 151, in _handle_read
     data = self.socket.recv(self._suggested_buffer_size)
socket.timeout: timed out
====================================

Kindly please tell me what to do to fix this problem

sincerely
-bino-


More information about the rabbitmq-discuss mailing list