I am completely new to MQs and pika.
When I am trying to execute this code(server code) I am getting errors: (I am getting same error for receiver code also.)
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(
host="localhost:5672"))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='',
routing_key='hello',
body='Hello World!')
print(" [x] Sent 'Hello World!'")
connection.close()
Error :
Traceback (most recent call last):
File "D:\Workspace\Luna_WS\MQ\RabbitMQ\Sample\Src\Sample.py", line 10, in <module>
host="localhost:5672"))
File "C:\Python34\lib\site-packages\pika\adapters\blocking_connection.py", line 339, in __init__
self._process_io_for_connection_setup()
File "C:\Python34\lib\site-packages\pika\adapters\blocking_connection.py", line 374, in _process_io_for_connection_setup
self._open_error_result.is_ready)
File "C:\Python34\lib\site-packages\pika\adapters\blocking_connection.py", line 395, in _flush_output
raise exceptions.ConnectionClosed()
pika.exceptions.ConnectionClosed
I had installed: (using windows 7, 32 bit)
pikka package - pika-0.10.0-py2.py3-none-any.whl
Erlang - esl-erlang_18.2-1-windows_i386
RabbitMq server - rabbitmq-server-3.6.0
Try splitting the host into separate host and port connection parameters:
connection = pika.BlockingConnection(
pika.ConnectionParameters(host="localhost", port=5672))