#!/usr/bin/env python

from haigha.connection import Connection
from haigha.message import Message

connection = Connection(user='guest', password='guest', vhost='/', host='localhost', heartbeat=None, debug=True)
ch = connection.channel()
ch.exchange.declare('test_exchange', 'direct', durable=True)
ch.queue.declare('test_queue', durable=True)
ch.queue.bind('test_queue', 'test_exchange', 'test_key')
ch.basic.publish( Message("hello world", application_headers={'hello':'world'}), 'test_exchange', 'test_key' )

connection.close()

connection = Connection(user='guest', password='guest', vhost='/', host='localhost', heartbeat=None, debug=True)
ch = connection.channel()
ch.exchange.declare('test_exchange', 'direct')
ch.queue.declare('test_queue')
ch.queue.bind('test_queue', 'test_exchange', 'test_key')
ch.basic.publish( Message("hello world", application_headers={'hello':'world'}), 'test_exchange', 'test_key' )

connection.close()
