revert reordering publish arguments

I originally changed the publishing arguments to take a routingKey first
which is pretty nonstandard across implementations. Reverting for
conformity.
This commit is contained in:
Matt Broadstone 2014-06-17 15:14:23 -04:00
parent 14f9b7e955
commit b5d77e17e3
3 changed files with 15 additions and 15 deletions

View File

@ -174,19 +174,19 @@ void Exchange::remove(int options)
d->sendFrame(frame); d->sendFrame(frame);
} }
void Exchange::publish(const QString &key, const QString &message, void Exchange::publish(const QString &message, const QString &routingKey,
const MessageProperties &properties) const MessageProperties &properties)
{ {
publish(key, message.toUtf8(), QLatin1String("text.plain"), QVariantHash(), properties); publish(message.toUtf8(), routingKey, QLatin1String("text.plain"), QVariantHash(), properties);
} }
void Exchange::publish(const QString &key, const QByteArray &message, void Exchange::publish(const QByteArray &message, const QString &routingKey,
const QString &mimeType, const MessageProperties &properties) const QString &mimeType, const MessageProperties &properties)
{ {
publish(key, message, mimeType, QVariantHash(), properties); publish(message, routingKey, mimeType, QVariantHash(), properties);
} }
void Exchange::publish(const QString &key, const QByteArray &message, void Exchange::publish(const QByteArray &message, const QString &routingKey,
const QString &mimeType, const QVariantHash &headers, const QString &mimeType, const QVariantHash &headers,
const MessageProperties &properties) const MessageProperties &properties)
{ {
@ -199,7 +199,7 @@ void Exchange::publish(const QString &key, const QByteArray &message,
out << qint16(0); //reserved 1 out << qint16(0); //reserved 1
Frame::writeField('s', out, d->name); Frame::writeField('s', out, d->name);
Frame::writeField('s', out, key); Frame::writeField('s', out, routingKey);
out << qint8(0); out << qint8(0);
frame.setArguments(arguments); frame.setArguments(arguments);

View File

@ -56,11 +56,11 @@ public:
void remove(int options = roIfUnused|roNoWait); void remove(int options = roIfUnused|roNoWait);
// AMQP Basic // AMQP Basic
void publish(const QString &key, const QString &message, void publish(const QString &message, const QString &routingKey,
const MessageProperties &properties = MessageProperties()); const MessageProperties &properties = MessageProperties());
void publish(const QString &key, const QByteArray &message, void publish(const QByteArray &message, const QString &routingKey,
const QString &mimeType, const MessageProperties &properties = MessageProperties()); const QString &mimeType, const MessageProperties &properties = MessageProperties());
void publish(const QString &key, const QByteArray &message, void publish(const QByteArray &message, const QString &routingKey,
const QString &mimeType, const QVariantHash &headers, const QString &mimeType, const QVariantHash &headers,
const MessageProperties &properties = MessageProperties()); const MessageProperties &properties = MessageProperties());

View File

@ -59,7 +59,7 @@ void tst_QAMQPQueue::defaultExchange()
queue->consume(); queue->consume();
Exchange *defaultExchange = client->createExchange(); Exchange *defaultExchange = client->createExchange();
defaultExchange->publish("test-default-exchange", "first message"); defaultExchange->publish("first message", "test-default-exchange");
QVERIFY(waitForSignal(queue, SIGNAL(messageReceived()))); QVERIFY(waitForSignal(queue, SIGNAL(messageReceived())));
Message message = queue->dequeue(); Message message = queue->dequeue();
QCOMPARE(message.payload(), QByteArray("first message")); QCOMPARE(message.payload(), QByteArray("first message"));
@ -92,7 +92,7 @@ void tst_QAMQPQueue::standardExchanges()
QVERIFY(waitForSignal(queue, SIGNAL(bound()))); QVERIFY(waitForSignal(queue, SIGNAL(bound())));
Exchange *defaultExchange = client->createExchange(exchange); Exchange *defaultExchange = client->createExchange(exchange);
defaultExchange->publish(routingKey, "test message"); defaultExchange->publish("test message", routingKey);
QVERIFY(waitForSignal(queue, SIGNAL(messageReceived()))); QVERIFY(waitForSignal(queue, SIGNAL(messageReceived())));
QCOMPARE(queue->dequeue().payload(), QByteArray("test message")); QCOMPARE(queue->dequeue().payload(), QByteArray("test message"));
} }
@ -219,7 +219,7 @@ void tst_QAMQPQueue::removeIfEmpty()
queue->declare(Queue::Durable); queue->declare(Queue::Durable);
QVERIFY(waitForSignal(queue, SIGNAL(declared()))); QVERIFY(waitForSignal(queue, SIGNAL(declared())));
Exchange *defaultExchange = client->createExchange(); Exchange *defaultExchange = client->createExchange();
defaultExchange->publish("test-remove-if-empty", "first message"); defaultExchange->publish("first message", "test-remove-if-empty");
// create a second client and try to delete the queue // create a second client and try to delete the queue
{ {
@ -264,9 +264,9 @@ void tst_QAMQPQueue::purge()
queue->declare(Queue::Durable); queue->declare(Queue::Durable);
QVERIFY(waitForSignal(queue, SIGNAL(declared()))); QVERIFY(waitForSignal(queue, SIGNAL(declared())));
Exchange *defaultExchange = client->createExchange(); Exchange *defaultExchange = client->createExchange();
defaultExchange->publish("test-purge", "first message"); defaultExchange->publish("first message", "test-purge");
defaultExchange->publish("test-purge", "second message"); defaultExchange->publish("second message", "test-purge");
defaultExchange->publish("test-purge", "third message"); defaultExchange->publish("third message", "test-purge");
// create second client to listen to messages and attempt purge // create second client to listen to messages and attempt purge
{ {