This commit is contained in:
Alexey Shcherbakov 2013-03-31 11:51:23 +06:00
commit 26e8614c27
1 changed files with 9 additions and 5 deletions

View File

@ -67,18 +67,22 @@ Usage
{ {
QUrl con(QString("amqp://guest:guest@localhost:5672/")); QUrl con(QString("amqp://guest:guest@localhost:5672/"));
client_ = new QAMQP::Client(this); client_ = new QAMQP::Client(this);
connect(client_, SIGNAL(connected()), this, SLOT(connected()));
client_->open(con); client_->open(con);
exchange_ = client_->createExchange("test.test2"); exchange_ = client_->createExchange("test.test2");
exchange_->declare("fanout");
queue_ = client_->createQueue("test.my_queue", exchange_->channelNumber()); queue_ = client_->createQueue("test.my_queue", exchange_->channelNumber());
queue_->declare();
exchange_->bind(queue_);
connect(queue_, SIGNAL(declared()), this, SLOT(declared())); connect(queue_, SIGNAL(declared()), this, SLOT(declared()));
connect(queue_, SIGNAL(messageRecieved()), this, SLOT(newMessage())); connect(queue_, SIGNAL(messageRecieved()), this, SLOT(newMessage()));
} }
void Test::connected()
{
exchange_->declare("fanout");
queue_->declare();
exchange_->bind(queue_);
}
void Test::declared() void Test::declared()
{ {