#!/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-10-preview.xml"))
client.start({"LOGIN": "guest", "PASSWORD": "guest"})
ch = client.channel(1)
ch.session_open()
ch.queue_declare(queue="test")
ch.queue_bind(exchange="amq.direct", queue="test", routing_key="test")
print ch.queue_query(queue="test")
ch.message_subscribe(queue="test", destination="test")
msg = Content("hello world")
msg["content_type"] = "text/plain"
ch.message_transfer(destination="amq.direct", content=msg)
