Skip to content

Commit 15c005e

Browse files
author
Alexandru Scvortov
committed
first stab at confirm support in .NET client
1 parent 9e01ceb commit 15c005e

File tree

9 files changed

+240
-5
lines changed

9 files changed

+240
-5
lines changed

docs/specs/amqp0-8.stripped.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
448448
</method>
449449
<method name="ack" index="80">
450450
<chassis name="server" implement="MUST"/>
451+
<chassis name="client" implement="MUST"/>
451452
<field name="delivery tag" domain="delivery tag"/>
452453
<field name="multiple" type="bit"/>
453454
</method>
@@ -675,6 +676,19 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
675676
<chassis name="client" implement="MUST"/>
676677
</method>
677678
</class>
679+
<class name="confirm" handler="channel" index="85">
680+
<method name="select" synchronous="1" index="10">
681+
<chassis name="server" implement="MUST"/>
682+
<response name="select-ok"/>
683+
<field name = "nowait" type = "bit">
684+
</field>
685+
<field name = "multiple" type = "bit">
686+
</field>
687+
</method>
688+
<method name="select-ok" synchronous="1" index="11">
689+
<chassis name="client" implement="MUST"/>
690+
</method>
691+
</class>
678692
<class name="tunnel" handler="tunnel" index="110">
679693
<chassis name="server" implement="MAY"/>
680694
<chassis name="client" implement="MAY"/>

docs/specs/amqp0-8.xml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0"?>
22
<!-- WARNING: Modified from the official 0-8 specification XML by
3-
the addition of queue.unbind, queue.unbind-ok -->
3+
the addition of queue.unbind, queue.unbind-ok,
4+
confirm.select and confirm.select-ok -->
45
<!--
56
Copyright Notice
67
================
@@ -2405,6 +2406,8 @@ localised reply text
24052406
message.
24062407
</doc>
24072408
<chassis name = "server" implement = "MUST" />
2409+
<chassis name="client" implement="MUST"/>
2410+
24082411
<field name = "delivery tag" domain = "delivery tag" />
24092412

24102413
<field name = "multiple" type = "bit">
@@ -3681,6 +3684,43 @@ confirm transaction mode
36813684
<chassis name="client" implement="MUST"/>
36823685
</method>
36833686
</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 = "nowait" type = "bit">
3698+
do not send a reply method
3699+
<doc>
3700+
If set, the server will not respond to the method. The client should
3701+
not wait for a reply method. If the server could not complete the
3702+
method it will raise a channel or connection exception.
3703+
</doc>
3704+
</field>
3705+
<field name = "multiple" type = "bit">
3706+
acknowledge multiple messages
3707+
<doc>
3708+
If set to 1, the delivery tag in the returned acks is
3709+
treated as "up to and including", so that the server can
3710+
acknowledge multiple messages with a single method. If set
3711+
to zero, the delivery tag refers to a single message.
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>
36843724
<class name="tunnel" handler="tunnel" index="110">
36853725
<!--
36863726
======================================================

docs/specs/amqp0-9.stripped.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
478478
</method>
479479
<method name="ack" index="80">
480480
<chassis name="server" implement="MUST"/>
481+
<chassis name="client" implement="MUST"/>
481482
<field name="delivery-tag" domain="delivery-tag"/>
482483
<field name="multiple" domain="bit"/>
483484
</method>
@@ -707,6 +708,19 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
707708
<chassis name="client" implement="MUST"/>
708709
</method>
709710
</class>
711+
<class name="confirm" handler="channel" index="85">
712+
<method name="select" synchronous="1" index="10">
713+
<chassis name="server" implement="MUST"/>
714+
<response name="select-ok"/>
715+
<field name = "nowait" type = "bit">
716+
</field>
717+
<field name = "multiple" type = "bit">
718+
</field>
719+
</method>
720+
<method name="select-ok" synchronous="1" index="11">
721+
<chassis name="client" implement="MUST"/>
722+
</method>
723+
</class>
710724
<class name="tunnel" handler="tunnel" index="110">
711725
<chassis name="server" implement="MAY"/>
712726
<chassis name="client" implement="MAY"/>

docs/specs/amqp0-9.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version = "1.0"?>
22

3+
<!--
4+
WARNING: Modified from the official 0-9 specification XML by
5+
the addition of confirm.select and confirm.select-ok.
6+
-->
7+
38
<!--
49
EDITORS: (PH) Pieter Hintjens <[email protected]>
510
(KvdR) Kim van der Riet <[email protected]>
@@ -3052,6 +3057,7 @@
30523057
</doc>
30533058

30543059
<chassis name = "server" implement = "MUST" />
3060+
<chassis name="client" implement="MUST"/>
30553061

30563062
<field name = "delivery-tag" domain = "delivery-tag" />
30573063

@@ -4378,6 +4384,44 @@
43784384
</method>
43794385
</class>
43804386

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 = "nowait" type = "bit">
4398+
do not send a reply method
4399+
<doc>
4400+
If set, the server will not respond to the method. The client should
4401+
not wait for a reply method. If the server could not complete the
4402+
method it will raise a channel or connection exception.
4403+
</doc>
4404+
</field>
4405+
<field name = "multiple" type = "bit">
4406+
acknowledge multiple messages
4407+
<doc>
4408+
If set to 1, the delivery tag in the returned acks is
4409+
treated as "up to and including", so that the server can
4410+
acknowledge multiple messages with a single method. If set
4411+
to zero, the delivery tag refers to a single message.
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+
43814425
<!-- == TUNNEL =========================================================== -->
43824426

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

docs/specs/qpid-amqp.0-8.stripped.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
446446
</method>
447447
<method name="ack" index="80">
448448
<chassis name="server" implement="MUST"/>
449+
<chassis name="client" implement="MUST"/>
449450
<field name="delivery tag" domain="delivery tag"/>
450451
<field name="multiple" type="bit"/>
451452
</method>
@@ -677,6 +678,19 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
677678
<chassis name="client" implement="MUST"/>
678679
</method>
679680
</class>
681+
<class name="confirm" handler="channel" index="85">
682+
<method name="select" synchronous="1" index="10">
683+
<chassis name="server" implement="MUST"/>
684+
<response name="select-ok"/>
685+
<field name = "nowait" type = "bit">
686+
</field>
687+
<field name = "multiple" type = "bit">
688+
</field>
689+
</method>
690+
<method name="select-ok" synchronous="1" index="11">
691+
<chassis name="client" implement="MUST"/>
692+
</method>
693+
</class>
680694
<class name="tunnel" handler="tunnel" index="110">
681695
<chassis name="server" implement="MAY"/>
682696
<chassis name="client" implement="MAY"/>

docs/specs/qpid-amqp.0-8.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,6 +2430,7 @@ localised reply text
24302430
message.
24312431
</doc>
24322432
<chassis name = "server" implement = "MUST" />
2433+
<chassis name = "client" implement = "MUST" />
24332434
<field name = "delivery tag" domain = "delivery tag" />
24342435

24352436
<field name = "multiple" type = "bit">
@@ -3715,6 +3716,43 @@ confirm transaction mode
37153716
<chassis name="client" implement="MUST"/>
37163717
</method>
37173718
</class>
3719+
<class name="confirm" handler="channel" index="85">
3720+
<method name="select" synchronous="1" index="10">
3721+
select confirm mode (i.e. enable publisher acknowledgements)
3722+
<doc>
3723+
This method sets the channel to use publisher acknowledgements.
3724+
The client can only use this method on a non-transactional
3725+
channel.
3726+
</doc>
3727+
<chassis name="server" implement="MUST"/>
3728+
<response name="select-ok"/>
3729+
<field name = "nowait" type = "bit">
3730+
do not send a reply method
3731+
<doc>
3732+
If set, the server will not respond to the method. The client should
3733+
not wait for a reply method. If the server could not complete the
3734+
method it will raise a channel or connection exception.
3735+
</doc>
3736+
</field>
3737+
<field name = "multiple" type = "bit">
3738+
acknowledge multiple messages
3739+
<doc>
3740+
If set to 1, the delivery tag in the returned acks is
3741+
treated as "up to and including", so that the server can
3742+
acknowledge multiple messages with a single method. If set
3743+
to zero, the delivery tag refers to a single message.
3744+
</doc>
3745+
</field>
3746+
</method>
3747+
<method name="select-ok" synchronous="1" index="11">
3748+
acknowledge confirm mode
3749+
<doc>
3750+
This method confirms to the client that the channel was successfully
3751+
set to use publisher acknowledgements.
3752+
</doc>
3753+
<chassis name="client" implement="MUST"/>
3754+
</method>
3755+
</class>
37183756
<class name="tunnel" handler="tunnel" index="110">
37193757
<!--
37203758
======================================================

projects/client/ApigenBootstrap/RabbitMQ.Client.ApigenBootstrap.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878
<Compile Include="..\RabbitMQ.Client\src\client\events\BasicReturnEventHandler.cs">
7979
<Link>src\client\events\BasicReturnEventHandler.cs</Link>
8080
</Compile>
81+
<Compile Include="..\RabbitMQ.Client\src\client\events\BasicAckEventArgs.cs">
82+
<Link>src\client\events\BasicAckEventArgs.cs</Link>
83+
</Compile>
84+
<Compile Include="..\RabbitMQ.Client\src\client\events\BasicAckEventHandler.cs">
85+
<Link>src\client\events\BasicAckEventHandler.cs</Link>
86+
</Compile>
8187
<Compile Include="..\RabbitMQ.Client\src\client\events\CallbackExceptionEventArgs.cs">
8288
<Link>src\client\events\CallbackExceptionEventArgs.cs</Link>
8389
</Compile>

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public interface IModel: IDisposable
8383
///the broker.</summary>
8484
event BasicReturnEventHandler BasicReturn;
8585

86+
///<summary>Signalled when a Basic.Ack command arrives from
87+
///the broker.</summary>
88+
event BasicAckEventHandler BasicAcks;
89+
8690
///<summary>Signalled when an exception occurs in a callback
8791
///invoked by the model.</summary>
8892
///<remarks>
@@ -268,6 +272,11 @@ uint QueueDelete(string queue,
268272
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
269273
bool nowait);
270274

275+
///<summary>(Spec method) Enable publisher acknowledgements.</summary>
276+
void ConfirmSelect(bool multiple,
277+
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
278+
bool nowait);
279+
271280
///<summary>Start a Basic content-class consumer.</summary>
272281
///<remarks>
273282
///The consumer is started with noAck=false (i.e. BasicAck is required),
@@ -632,7 +641,12 @@ void HandleBasicReturn(ushort replyCode,
632641
IBasicProperties basicProperties,
633642
[AmqpContentBodyMapping]
634643
byte[] body);
635-
644+
645+
///<summary>Handle incoming Basic.Ack methods. Signals a
646+
///BasicAckEvent.</summary>
647+
void HandleBasicAck(ulong deliveryTag,
648+
bool multiple);
649+
636650
///<summary>Used to send a Channel.FlowOk. Confirms that
637651
///Channel.Flow from the broker was processed.</summary>
638652
[AmqpMethodMapping(null, "channel", "flow-ok")]

0 commit comments

Comments
 (0)