Skip to content

Commit 0a4c9c5

Browse files
author
Vlad Alexandru Ionescu
committed
merging bug23065 into default
2 parents 7027b10 + add636d commit 0a4c9c5

File tree

5 files changed

+105
-0
lines changed

5 files changed

+105
-0
lines changed

docs/specs/amqp0-9-1.stripped.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,12 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
458458
<method name="recover-ok" synchronous="1" index="111">
459459
<chassis name="client" implement="MUST"/>
460460
</method>
461+
<method name="nack" index="120">
462+
<chassis name="server" implement="MUST"/>
463+
<field name="delivery-tag" domain="delivery-tag"/>
464+
<field name="multiple" domain="bit"/>
465+
<field name="requeue" domain="bit"/>
466+
</method>
461467
</class>
462468
<class name="tx" handler="channel" index="90">
463469
<chassis name="server" implement="SHOULD"/>

docs/specs/amqp0-9-1.xml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,6 +1972,7 @@
19721972
/ C:ACK
19731973
/ S:ACK
19741974
/ C:REJECT
1975+
/ C:NACK
19751976
/ C:RECOVER-ASYNC
19761977
/ C:RECOVER S:RECOVER-OK
19771978
</doc>
@@ -2734,6 +2735,91 @@
27342735
</doc>
27352736
<chassis name = "client" implement = "MUST" />
27362737
</method>
2738+
2739+
<method name = "nack" index = "120" label = "reject one or more incoming messages">
2740+
<doc>
2741+
This method allows a client to reject one or more incoming messages. It can be
2742+
used to interrupt and cancel large incoming messages, or return untreatable
2743+
messages to their original queue.
2744+
</doc>
2745+
2746+
<rule name = "01">
2747+
<doc>
2748+
The server SHOULD be capable of accepting and processing the Nack method while
2749+
sending message content with a Deliver or Get-Ok method. I.e. the server should
2750+
read and process incoming methods while sending output frames. To cancel a
2751+
partially-send content, the server sends a content body frame of size 1 (i.e.
2752+
with no data except the frame-end octet).
2753+
</doc>
2754+
</rule>
2755+
2756+
<rule name = "02">
2757+
<doc>
2758+
The server SHOULD interpret this method as meaning that the client is unable to
2759+
process the message at this time.
2760+
</doc>
2761+
<doc type = "scenario">
2762+
TODO.
2763+
</doc>
2764+
</rule>
2765+
2766+
<rule name = "03">
2767+
<doc>
2768+
The client MUST NOT use this method as a means of selecting messages to process.
2769+
</doc>
2770+
<doc type = "scenario">
2771+
TODO.
2772+
</doc>
2773+
</rule>
2774+
2775+
<chassis name = "server" implement = "MUST" />
2776+
2777+
<field name = "delivery-tag" domain = "delivery-tag" />
2778+
2779+
<field name = "multiple" domain = "bit" label = "reject multiple messages">
2780+
<doc>
2781+
If set to 1, the delivery tag is treated as "up to and
2782+
including", so that multiple messages can be rejected
2783+
with a single method. If set to zero, the delivery tag
2784+
refers to a single message. If the multiple field is 1, and
2785+
the delivery tag is zero, this indicates rejection of
2786+
all outstanding messages.
2787+
</doc>
2788+
<rule name = "exists" on-failure = "precondition-failed">
2789+
<doc>
2790+
A message MUST not be rejected more than once. The
2791+
receiving peer MUST validate that a non-zero delivery-tag
2792+
refers to an unacknowledged, delivered message, and
2793+
raise a channel exception if this is not the case.
2794+
</doc>
2795+
<doc type = "scenario">
2796+
TODO.
2797+
</doc>
2798+
</rule>
2799+
</field>
2800+
2801+
<field name = "requeue" domain = "bit" label = "requeue the message">
2802+
<doc>
2803+
If requeue is true, the server will attempt to requeue the message. If requeue
2804+
is false or the requeue attempt fails the messages are discarded or dead-lettered.
2805+
</doc>
2806+
2807+
<rule name = "01">
2808+
<doc>
2809+
The server MUST NOT deliver the message to the same client within the
2810+
context of the current channel. The recommended strategy is to attempt to
2811+
deliver the message to an alternative consumer, and if that is not possible,
2812+
to move the message to a dead-letter queue. The server MAY use more
2813+
sophisticated tracking to hold the message on the queue and redeliver it to
2814+
the same client at a later stage.
2815+
</doc>
2816+
<doc type = "scenario">
2817+
TODO.
2818+
</doc>
2819+
</rule>
2820+
</field>
2821+
</method>
2822+
27372823
</class>
27382824

27392825
<!-- == TX =============================================================== -->

projects/client/RabbitMQ.Client/src/client/api/IModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,14 @@ void BasicAck(ulong deliveryTag,
418418
void BasicReject(ulong deliveryTag,
419419
bool requeue);
420420

421+
///<summary>Reject one or more delivered message(s).</summary>
422+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
423+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
424+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
425+
void BasicNack(ulong deliveryTag,
426+
bool multiple,
427+
bool requeue);
428+
421429
///<summary>(Spec method)</summary>
422430
[AmqpMethodDoNotImplement(null)]
423431
void BasicRecover(bool requeue);

projects/client/RabbitMQ.Client/src/client/impl/ModelBase.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,10 @@ public abstract void BasicAck(ulong deliveryTag,
10961096
public abstract void BasicReject(ulong deliveryTag,
10971097
bool requeue);
10981098

1099+
public abstract void BasicNack(ulong deliveryTag,
1100+
bool multiple,
1101+
bool requeue);
1102+
10991103
public abstract void BasicRecoverAsync(bool requeue);
11001104

11011105
public abstract void TxSelect();

projects/client/RabbitMQ.Client/src/client/messagepatterns/Subscription.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public Subscription(IModel model, string queueName, bool noAck)
138138
{
139139
m_model = model;
140140
m_queueName = queueName;
141+
m_noAck = noAck;
141142
m_consumer = new QueueingBasicConsumer(m_model);
142143
m_consumerTag = m_model.BasicConsume(m_queueName, m_noAck, m_consumer);
143144
m_latestEvent = null;

0 commit comments

Comments
 (0)