Test - python
Links
Install
Follow Getting Started to install and start the RabbitMQ server…
Install the python client for the Advanced Message Queuing Procotol (AMQP):
easy_install amqplib
Copy the following script to a test folder:
../../misc/howto/rabbitmq/all.py
Run
Note: Sample 1 is really good as we can see all the code, it is well commented and the article explains everything very clearly…
Sample 1
Follow Getting Started to start the RabbitMQ server…
Download amqp_consumer.py.
Start the message consumer:
amqp_consumer.py
Download amqp_publisher.py.
Send test messages to the consumer:
amqp_publisher.py "Hello..."
Sample 2
Slighty complicated sample, but probably worth a look… particularly if you want to send a message to all clients…
Basic open-set intermediated peer-to-peer messaging with RabbitMQ:
Follow Getting Started to start the RabbitMQ server…
Download all.py to a folder.
Open the first (of two) python shells:
import all
all.queue_setup("agent1")
Open the second python shell:
import all
all.queue_setup("agent2")
To send a message to all clients, type the following from one of the shells:
all.notify_others("Hello, world! (Agent 1)")