summaryrefslogtreecommitdiff
path: root/python/hello-world
blob: 51c71baa5d22e6fa5479281e385aa7888ea795a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python
import qpid
from qpid.client import Client
from qpid.content import Content

client = Client("127.0.0.1", 5672, qpid.spec.load("../specs/amqp.0-9.xml",
                                                  "../specs/amqp-errata.0-9.xml"))
client.start({"LOGIN": "guest", "PASSWORD": "guest"})
ch = client.channel(1)
ch.channel_open()
ch.queue_declare(queue="test")
ch.queue_bind(exchange="amq.direct", queue="test", routing_key="test")
ch.message_consume(queue="test", destination="test")
ch.message_transfer(destination="amq.direct", routing_key="test",
                    body="hello world")
msg = client.queue("test").get()
print msg
msg.ok()
import time
time.sleep(3)