Last change
on this file since 854 was
854,
checked in by jripsl, 11 years ago
|
add JSON deserialization, mail notification, logging.
|
-
Property svn:executable set to
*
|
File size:
556 bytes
|
Rev | Line | |
---|
[854] | 1 | from amqplib import client_0_8 as amqp |
---|
| 2 | |
---|
| 3 | # connect to server |
---|
| 4 | lConnection = amqp.Connection(host="localhost:5672", userid="guest", password="guest", virtual_host="/", insist=False) |
---|
| 5 | lChannel = lConnection.channel() |
---|
| 6 | |
---|
| 7 | # Create a message |
---|
| 8 | lMessage = amqp.Message("Test message!") |
---|
| 9 | |
---|
| 10 | # Send message as persistant. This means it will survive a reboot. |
---|
| 11 | lMessage.properties["delivery_mode"] = 2 |
---|
| 12 | |
---|
| 13 | # publish the message on the exchange |
---|
| 14 | lChannel.basic_publish(lMessage, exchange="myExchange", routing_key="Test") |
---|
| 15 | |
---|
| 16 | # Close connection |
---|
| 17 | lChannel.close() |
---|
| 18 | lConnection.close() |
---|
Note: See
TracBrowser
for help on using the repository browser.