Reputation: 195
In my local machine I can have:
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
for both scripts (send.py and recv.py) in order to establish proper communication, but what about to establish communication from 12.23.45.67 to 132.45.23.14 ? I know about all the parameters that ConnectionParameters() take but I am not sure what to pass to the host or what to pass to the client. It would be appreciated if someone could give an example for host scrip and client script.
Upvotes: 16
Views: 53430
Reputation: 1316
first step is to add another account to your rabbitMQ server. To do this in windows...
Now if you modify the connection info as done in the following modification of send.py you should find success:
#!/usr/bin/env python
import pika
credentials = pika.PlainCredentials('the_user', 'the_pass')
parameters = pika.ConnectionParameters('132.45.23.14',
5672,
'/',
credentials)
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='',
routing_key='hello',
body='Hello W0rld!')
print(" [x] Sent 'Hello World!'")
connection.close()
Hope this helps
Upvotes: 43
Reputation: 2313
See http://pika.readthedocs.org/en/latest/modules/parameters.html, where it says 'rabbit-server1'
you should enter the remote host name of the IP.
Be aware that the guest
account can only connect via localhost https://www.rabbitmq.com/access-control.html
Upvotes: 4