clean up QAMQP::Queue api

removed noAck as it relates only to the synchronous get AMQP api
moved noAck to get method
applied visual separation in headers between AMQP Queue and AMQP Basic methods
This commit is contained in:
Matt Broadstone 2014-06-24 21:09:45 -04:00
parent fcc3d36bba
commit e94f372cfe
3 changed files with 9 additions and 26 deletions

View File

@ -14,7 +14,6 @@ QueuePrivate::QueuePrivate(Queue *q)
: ChannelPrivate(q),
delayedDeclare(false),
declared(false),
noAck(true),
recievingMessage(false),
consuming(false)
{
@ -296,18 +295,6 @@ int Queue::options() const
return d->options;
}
void Queue::setNoAck(bool noAck)
{
Q_D(Queue);
d->noAck = noAck;
}
bool Queue::noAck() const
{
Q_D(const Queue);
return d->noAck;
}
void Queue::declare(int options)
{
Q_D(Queue);
@ -481,11 +468,11 @@ bool Queue::isConsuming() const
return d->consuming;
}
void Queue::get()
void Queue::get(bool noAck)
{
Q_D(Queue);
if (!d->opened) {
qAmqpDebug() << Q_FUNC_INFO << "queue is not open";
qAmqpDebug() << Q_FUNC_INFO << "channel is not open";
return;
}
@ -498,7 +485,7 @@ void Queue::get()
out << qint16(0); //reserved 1
Frame::writeField('s', out, d->name);
out << qint8(d->noAck ? 1 : 0); // noAck
out << qint8(noAck ? 1 : 0); // noAck
frame.setArguments(arguments);
d->sendFrame(frame);
@ -508,7 +495,7 @@ void Queue::ack(const Message &message)
{
Q_D(Queue);
if (!d->opened) {
qAmqpDebug() << Q_FUNC_INFO << "queue is not open";
qAmqpDebug() << Q_FUNC_INFO << "channel is not open";
return;
}

View File

@ -20,7 +20,6 @@ class QAMQP_EXPORT Queue : public Channel, public QQueue<Message>
Q_ENUMS(QueueOptions)
Q_PROPERTY(int options READ options CONSTANT)
Q_PROPERTY(QString consumerTag READ consumerTag WRITE setConsumerTag)
Q_PROPERTY(bool noAck READ noAck WRITE setNoAck)
Q_ENUMS(QueueOption)
Q_ENUMS(ConsumeOption)
Q_ENUMS(RemoveOption)
@ -56,13 +55,9 @@ public:
~Queue();
bool isConsuming() const;
void setConsumerTag(const QString &consumerTag);
QString consumerTag() const;
void setNoAck(bool noAck);
bool noAck() const;
// AMQP Queue
void declare(int options = Durable|AutoDelete);
void bind(const QString &exchangeName, const QString &key);
@ -74,7 +69,7 @@ public:
// AMQP Basic
bool consume(int options = NoOptions);
void get();
void get(bool noAck = true);
void ack(const Message &message);
bool cancel(bool noWait = false);
@ -83,9 +78,10 @@ Q_SIGNALS:
void bound();
void unbound();
void removed();
void purged(int messageCount);
void messageReceived();
void empty();
void purged(int messageCount);
void consuming(const QString &consumerTag);
void cancelled(const QString &consumerTag);

View File

@ -47,9 +47,9 @@ public:
int options;
bool delayedDeclare;
bool declared;
bool noAck;
QString consumerTag;
QQueue<QPair<QString, QString> > delayedBindings;
QString consumerTag;
bool recievingMessage;
Message currentMessage;
bool consuming;