add support for Basic.Reject
This adds the reject method to QAmqpQueue in order to reject an incoming message, and conditionally requeue it.
This commit is contained in:
parent
e6b69010e4
commit
d051f5a445
|
|
@ -533,6 +533,32 @@ void QAmqpQueue::ack(qlonglong deliveryTag, bool multiple)
|
||||||
d->sendFrame(frame);
|
d->sendFrame(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QAmqpQueue::reject(const QAmqpMessage &message, bool requeue)
|
||||||
|
{
|
||||||
|
ack(message.deliveryTag(), requeue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QAmqpQueue::reject(qlonglong deliveryTag, bool requeue)
|
||||||
|
{
|
||||||
|
Q_D(QAmqpQueue);
|
||||||
|
if (!d->opened) {
|
||||||
|
qAmqpDebug() << Q_FUNC_INFO << "channel is not open";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QAmqpMethodFrame frame(QAmqpFrame::Basic, QAmqpQueuePrivate::bmReject);
|
||||||
|
frame.setChannel(d->channelNumber);
|
||||||
|
|
||||||
|
QByteArray arguments;
|
||||||
|
QDataStream out(&arguments, QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
out << deliveryTag;
|
||||||
|
out << qint8(requeue ? 1 : 0);
|
||||||
|
|
||||||
|
frame.setArguments(arguments);
|
||||||
|
d->sendFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
bool QAmqpQueue::cancel(bool noWait)
|
bool QAmqpQueue::cancel(bool noWait)
|
||||||
{
|
{
|
||||||
Q_D(QAmqpQueue);
|
Q_D(QAmqpQueue);
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,10 @@ public:
|
||||||
bool consume(int options = NoOptions);
|
bool consume(int options = NoOptions);
|
||||||
void get(bool noAck = true);
|
void get(bool noAck = true);
|
||||||
bool cancel(bool noWait = false);
|
bool cancel(bool noWait = false);
|
||||||
|
|
||||||
void ack(const QAmqpMessage &message);
|
void ack(const QAmqpMessage &message);
|
||||||
void ack(qlonglong deliveryTag, bool multiple);
|
void ack(qlonglong deliveryTag, bool multiple);
|
||||||
|
void reject(const QAmqpMessage &message, bool requeue);
|
||||||
|
void reject(qlonglong deliveryTag, bool requeue);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void declared();
|
void declared();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue