Skip to content

Commit 64f34fc

Browse files
author
Emile Joubert
committed
Merged default into bug22942
2 parents 7153c73 + eacdb8b commit 64f34fc

File tree

9 files changed

+105
-145
lines changed

9 files changed

+105
-145
lines changed

docs/specs/amqp0-8.stripped.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -684,19 +684,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
684684
<chassis name="client" implement="MUST"/>
685685
</method>
686686
</class>
687-
<class name="confirm" handler="channel" index="85">
688-
<method name="select" synchronous="1" index="10">
689-
<chassis name="server" implement="MUST"/>
690-
<response name="select-ok"/>
691-
<field name = "multiple" type = "bit">
692-
</field>
693-
<field name = "nowait" type = "bit">
694-
</field>
695-
</method>
696-
<method name="select-ok" synchronous="1" index="11">
697-
<chassis name="client" implement="MUST"/>
698-
</method>
699-
</class>
700687
<class name="tunnel" handler="tunnel" index="110">
701688
<chassis name="server" implement="MAY"/>
702689
<chassis name="client" implement="MAY"/>

docs/specs/amqp0-8.xml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,43 +3684,6 @@ confirm transaction mode
36843684
<chassis name="client" implement="MUST"/>
36853685
</method>
36863686
</class>
3687-
<class name="confirm" handler="channel" index="85">
3688-
<method name="select" synchronous="1" index="10">
3689-
select confirm mode (i.e. enable publisher acknowledgements)
3690-
<doc>
3691-
This method sets the channel to use publisher acknowledgements.
3692-
The client can only use this method on a non-transactional
3693-
channel.
3694-
</doc>
3695-
<chassis name="server" implement="MUST"/>
3696-
<response name="select-ok"/>
3697-
<field name = "multiple" type = "bit">
3698-
acknowledge multiple messages
3699-
<doc>
3700-
If set to 1, the delivery tag in the returned acks is
3701-
treated as "up to and including", so that the server can
3702-
acknowledge multiple messages with a single method. If set
3703-
to zero, the delivery tag refers to a single message.
3704-
</doc>
3705-
</field>
3706-
<field name = "nowait" type = "bit">
3707-
do not send a reply method
3708-
<doc>
3709-
If set, the server will not respond to the method. The client should
3710-
not wait for a reply method. If the server could not complete the
3711-
method it will raise a channel or connection exception.
3712-
</doc>
3713-
</field>
3714-
</method>
3715-
<method name="select-ok" synchronous="1" index="11">
3716-
acknowledge confirm mode
3717-
<doc>
3718-
This method confirms to the client that the channel was successfully
3719-
set to use publisher acknowledgements.
3720-
</doc>
3721-
<chassis name="client" implement="MUST"/>
3722-
</method>
3723-
</class>
37243687
<class name="tunnel" handler="tunnel" index="110">
37253688
<!--
37263689
======================================================

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
488488
<method name="select" synchronous="1" index="10">
489489
<chassis name="server" implement="MUST"/>
490490
<response name="select-ok"/>
491-
<field name = "multiple" type = "bit">
492-
</field>
493491
<field name = "nowait" type = "bit">
494492
</field>
495493
</method>

docs/specs/amqp0-9-1.xml

Lines changed: 84 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,28 +2570,38 @@
25702570

25712571
<method name = "ack" index = "80" label = "acknowledge one or more messages">
25722572
<doc>
2573-
This method acknowledges one or more messages delivered via the Deliver or Get-Ok
2574-
methods. The client can ask to confirm a single message or a set of messages up to
2575-
and including a specific message.
2573+
When sent by the client, this method acknowledges one or more
2574+
messages delivered via the Deliver or Get-Ok methods.
2575+
2576+
When sent by server, this method acknowledges one or more
2577+
messages published with the Publish method on a channel in
2578+
confirm mode.
2579+
2580+
The acknowledgement can be for a single message or a set of
2581+
messages up to and including a specific message.
25762582
</doc>
25772583

25782584
<chassis name = "server" implement = "MUST" />
2579-
<chassis name="client" implement="MUST"/>
2585+
<chassis name ="client" implement = "MUST"/>
25802586

25812587
<field name = "delivery-tag" domain = "delivery-tag" />
25822588
<field name = "multiple" domain = "bit" label = "acknowledge multiple messages">
25832589
<doc>
2584-
If set to 1, the delivery tag is treated as "up to and including", so that the
2585-
client can acknowledge multiple messages with a single method. If set to zero,
2586-
the delivery tag refers to a single message. If the multiple field is 1, and the
2587-
delivery tag is zero, tells the server to acknowledge all outstanding messages.
2590+
If set to 1, the delivery tag is treated as "up to and
2591+
including", so that multiple messages can be acknowledged
2592+
with a single method. If set to zero, the delivery tag
2593+
refers to a single message. If the multiple field is 1, and
2594+
the delivery tag is zero, this indicates acknowledgement of
2595+
all outstanding messages.
25882596
</doc>
25892597
<rule name = "exists" on-failure = "precondition-failed">
25902598
<doc>
2591-
The server MUST validate that a non-zero delivery-tag refers to a delivered
2592-
message, and raise a channel exception if this is not the case. On a transacted
2593-
channel, this check MUST be done immediately and not delayed until a Tx.Commit.
2594-
Specifically, a client MUST not acknowledge the same message more than once.
2599+
A message MUST not be acknowledged more than once. The
2600+
receiving peer MUST validate that a non-zero delivery-tag
2601+
refers to a delivered message, and raise a channel
2602+
exception if this is not the case. On a transacted
2603+
channel, this check MUST be done immediately and not
2604+
delayed until a Tx.Commit.
25952605
</doc>
25962606
<doc type = "scenario">
25972607
TODO.
@@ -2849,7 +2859,67 @@
28492859

28502860
<!-- == CONFIRM ========================================================== -->
28512861

2852-
<class name="confirm" handler="channel" index="85">
2862+
<class name = "confirm" handler = "channel" index = "85" label = "work with confirms">
2863+
<doc>
2864+
The Confirm class allows publishers to put the channel in
2865+
confirm mode and susequently be notified when messages have been
2866+
handled by the broker. The intention is that all messages
2867+
published on a channel in confirm mode will be acknowledged at
2868+
some point. By acknowledging a message the broker assumes
2869+
responsibility for it and indicates that it has done something
2870+
it deems reasonable with it.
2871+
2872+
Unroutable mandatory or immediate messages are acknowledged
2873+
right after the Basic.Return method. Messages are acknowledged
2874+
when all queues to which the message has been routed
2875+
have either delivered the message and received an
2876+
acknowledgement (if required), or enqueued the message (and
2877+
persisted it if required).
2878+
2879+
Published messages are assigned ascending sequence numbers,
2880+
starting at 0 when the Confirm.Select method is used. The server
2881+
confirms messages by sending Basic.Ack methods referring to these
2882+
sequence numbers.
2883+
</doc>
2884+
2885+
<rule name = "all messages acknowledged">
2886+
<doc>
2887+
The server MUST acknowledge all messages received after the
2888+
channel was put into confirm mode.
2889+
</doc>
2890+
</rule>
2891+
2892+
<rule name = "all queues">
2893+
<doc>
2894+
The server MUST acknowledge a message only after it was
2895+
properly handled by all the queues it was delivered to.
2896+
</doc>
2897+
</rule>
2898+
2899+
<rule name = "unroutable messages">
2900+
<doc>
2901+
The server MUST acknowledge an unroutable mandatory or
2902+
immediate message only after it sends the Basic.Return.
2903+
</doc>
2904+
</rule>
2905+
2906+
<rule name = "time guarantees">
2907+
<doc>
2908+
No guarantees are made as to how soon a message is
2909+
acknowledged. Applications SHOULD NOT make assumptions about
2910+
this.
2911+
</doc>
2912+
</rule>
2913+
2914+
<doc type = "grammar">
2915+
confirm = C:SELECT S:SELECT-OK
2916+
</doc>
2917+
2918+
<chassis name = "server" implement = "SHOULD" />
2919+
<chassis name = "client" implement = "MAY" />
2920+
2921+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2922+
28532923
<method name="select" synchronous="1" index="10">
28542924
select confirm mode (i.e. enable publisher acknowledgements)
28552925
<doc>
@@ -2859,15 +2929,6 @@
28592929
</doc>
28602930
<chassis name="server" implement="MUST"/>
28612931
<response name="select-ok"/>
2862-
<field name = "multiple" type = "bit">
2863-
acknowledge multiple messages
2864-
<doc>
2865-
If set to 1, the delivery tag in the returned acks is
2866-
treated as "up to and including", so that the server can
2867-
acknowledge multiple messages with a single method. If set
2868-
to zero, the delivery tag refers to a single message.
2869-
</doc>
2870-
</field>
28712932
<field name = "nowait" type = "bit">
28722933
do not send a reply method
28732934
<doc>
@@ -2877,6 +2938,7 @@
28772938
</doc>
28782939
</field>
28792940
</method>
2941+
28802942
<method name="select-ok" synchronous="1" index="11">
28812943
acknowledge confirm mode
28822944
<doc>

docs/specs/amqp0-9.stripped.xml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -716,19 +716,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
716716
<chassis name="client" implement="MUST"/>
717717
</method>
718718
</class>
719-
<class name="confirm" handler="channel" index="85">
720-
<method name="select" synchronous="1" index="10">
721-
<chassis name="server" implement="MUST"/>
722-
<response name="select-ok"/>
723-
<field name = "multiple" type = "bit">
724-
</field>
725-
<field name = "nowait" type = "bit">
726-
</field>
727-
</method>
728-
<method name="select-ok" synchronous="1" index="11">
729-
<chassis name="client" implement="MUST"/>
730-
</method>
731-
</class>
732719
<class name="tunnel" handler="tunnel" index="110">
733720
<chassis name="server" implement="MAY"/>
734721
<chassis name="client" implement="MAY"/>

docs/specs/amqp0-9.xml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4384,44 +4384,6 @@
43844384
</method>
43854385
</class>
43864386

4387-
<class name="confirm" handler="channel" index="85">
4388-
<method name="select" synchronous="1" index="10">
4389-
select confirm mode (i.e. enable publisher acknowledgements)
4390-
<doc>
4391-
This method sets the channel to use publisher acknowledgements.
4392-
The client can only use this method on a non-transactional
4393-
channel.
4394-
</doc>
4395-
<chassis name="server" implement="MUST"/>
4396-
<response name="select-ok"/>
4397-
<field name = "multiple" type = "bit">
4398-
acknowledge multiple messages
4399-
<doc>
4400-
If set to 1, the delivery tag in the returned acks is
4401-
treated as "up to and including", so that the server can
4402-
acknowledge multiple messages with a single method. If set
4403-
to zero, the delivery tag refers to a single message.
4404-
</doc>
4405-
</field>
4406-
<field name = "nowait" type = "bit">
4407-
do not send a reply method
4408-
<doc>
4409-
If set, the server will not respond to the method. The client should
4410-
not wait for a reply method. If the server could not complete the
4411-
method it will raise a channel or connection exception.
4412-
</doc>
4413-
</field>
4414-
</method>
4415-
<method name="select-ok" synchronous="1" index="11">
4416-
acknowledge confirm mode
4417-
<doc>
4418-
This method confirms to the client that the channel was successfully
4419-
set to use publisher acknowledgements.
4420-
</doc>
4421-
<chassis name="client" implement="MUST"/>
4422-
</method>
4423-
</class>
4424-
44254387
<!-- == TUNNEL =========================================================== -->
44264388

44274389
<class name = "tunnel" handler = "tunnel" index = "110" label = "methods for protocol tunnelling">

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,16 @@ uint QueueDelete(string queue,
321321
///<summary>Enable publisher acknowledgements.</summary>
322322
[AmqpMethodDoNotImplement(null)]
323323
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
324-
void ConfirmSelect(bool multiple);
324+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
325+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
326+
void ConfirmSelect();
325327

326328
///<summary>Enable publisher acknowledgements.</summary>
327329
[AmqpMethodDoNotImplement(null)]
328330
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
329-
void ConfirmSelect(bool multiple, bool nowait);
331+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
332+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
333+
void ConfirmSelect(bool nowait);
330334

331335

332336
///<summary>Start a Basic content-class consumer.</summary>
@@ -648,9 +652,10 @@ void _Private_BasicConsume(string queue,
648652
///confirm API calls this while also managing internal
649653
///datastructures.</summary>
650654
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
655+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
656+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
651657
[AmqpMethodMapping(null, "confirm", "select")]
652-
void _Private_ConfirmSelect(bool multiple,
653-
[AmqpNowaitArgument(null)]
658+
void _Private_ConfirmSelect([AmqpNowaitArgument(null)]
654659
bool nowait);
655660

656661

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -779,18 +779,17 @@ public uint QueueDelete(string queue)
779779
return QueueDelete(queue, false, false, false);
780780
}
781781

782-
public void ConfirmSelect(bool multiple) {
783-
ConfirmSelect(multiple, false);
782+
public void ConfirmSelect() {
783+
ConfirmSelect(false);
784784
}
785785

786-
public void ConfirmSelect(bool multiple, bool nowait) {
786+
public void ConfirmSelect(bool nowait) {
787787
m_pubMsgCount = 0;
788-
_Private_ConfirmSelect(multiple, nowait);
788+
_Private_ConfirmSelect(nowait);
789789
}
790790

791791

792-
public abstract void _Private_ConfirmSelect(bool multiple,
793-
bool nowait);
792+
public abstract void _Private_ConfirmSelect(bool nowait);
794793

795794
public string BasicConsume(string queue,
796795
IDictionary arguments,

projects/client/Unit/src/unit/TestRecoverAfterCancel.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ [SetUp] public void Connect()
8484
{
8585
Connection = new ConnectionFactory().CreateConnection();
8686
Channel = Connection.CreateModel();
87-
Queue = Channel.QueueDeclare();
87+
Queue = Channel.QueueDeclare("", false, false, true, false, false, null);
8888
}
8989

9090
[TearDown] public void Disconnect()
@@ -98,18 +98,15 @@ public void TestRecoverAfterCancel_()
9898
UTF8Encoding enc = new UTF8Encoding();
9999
Channel.BasicPublish("", Queue, null, enc.GetBytes("message"));
100100
QueueingBasicConsumer Consumer = new QueueingBasicConsumer(Channel);
101-
QueueingBasicConsumer DefaultConsumer = new QueueingBasicConsumer(Channel);
102-
Channel.DefaultConsumer = DefaultConsumer;
101+
103102
String CTag = Channel.BasicConsume(Queue, null, Consumer);
104103
BasicDeliverEventArgs Event = (BasicDeliverEventArgs) Consumer.Queue.Dequeue();
105104
Channel.BasicCancel(CTag);
106-
Channel.BasicRecover(false);
107-
108-
// The server will now redeliver us the first message again, with the
109-
// same ctag, but we're not set up to handle it with a standard
110-
// consumer - it should end up with the default one.
105+
Channel.BasicRecover(true);
111106

112-
BasicDeliverEventArgs Event2 = (BasicDeliverEventArgs) DefaultConsumer.Queue.Dequeue();
107+
QueueingBasicConsumer Consumer2 = new QueueingBasicConsumer(Channel);
108+
Channel.BasicConsume(Queue, null, Consumer2);
109+
BasicDeliverEventArgs Event2 = (BasicDeliverEventArgs)Consumer2.Queue.Dequeue();
113110

114111
Assert.AreEqual(Event.Body, Event2.Body);
115112
Assert.IsFalse(Event.Redelivered);
@@ -121,7 +118,7 @@ public void TestRecoverCallback()
121118
{
122119
int callbackCount = 0;
123120
Channel.BasicRecoverOk += (sender, eventArgs) => callbackCount++;
124-
Channel.BasicRecover(false);
121+
Channel.BasicRecover(true);
125122
Assert.AreEqual(1, callbackCount);
126123
}
127124

0 commit comments

Comments
 (0)