Skip to content

Commit ba97c22

Browse files
API reference updates for consumers
1 parent 0cefa47 commit ba97c22

File tree

4 files changed

+54
-29
lines changed

4 files changed

+54
-29
lines changed

projects/RabbitMQ.Client/client/api/AsyncDefaultBasicConsumer.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ public virtual Task HandleBasicConsumeOk(string consumerTag)
100100
}
101101

102102
/// <summary>
103-
/// Called each time a message arrives for this consumer.
103+
/// Called each time a message is delivered for this consumer.
104104
/// </summary>
105105
/// <remarks>
106-
/// Does nothing with the passed in information.
107-
/// Note that in particular, some delivered messages may require acknowledgement via <see cref="IModel.BasicAck"/>.
108-
/// The implementation of this method in this class does NOT acknowledge such messages.
106+
/// This is a no-op implementation. It will not acknowledge deliveries via <see cref="IModel.BasicAck"/>
107+
/// if consuming in automatic acknowledgement mode.
108+
/// Subclasses must copy or fully use delivery body before returning.
109+
/// Accessing the body at a later point is unsafe as its memory can
110+
/// be already released.
109111
/// </remarks>
110112
public virtual Task HandleBasicDeliver(string consumerTag,
111113
ulong deliveryTag,
@@ -120,10 +122,10 @@ public virtual Task HandleBasicDeliver(string consumerTag,
120122
}
121123

122124
/// <summary>
123-
/// Called when the model shuts down.
124-
/// </summary>
125-
/// <param name="model"> Common AMQP model.</param>
126-
/// <param name="reason"> Information about the reason why a particular model, session, or connection was destroyed.</param>
125+
/// Called when the model (channel) this consumer was registered on terminates.
126+
/// </summary>
127+
/// <param name="model">A channel this consumer was registered on.</param>
128+
/// <param name="reason">Shutdown context.</param>
127129
public virtual Task HandleModelShutdown(object model, ShutdownEventArgs reason)
128130
{
129131
ShutdownReason = reason;

projects/RabbitMQ.Client/client/api/DefaultBasicConsumer.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,14 @@ public virtual void HandleBasicConsumeOk(string consumerTag)
147147
}
148148

149149
/// <summary>
150-
/// Called each time a message arrives for this consumer.
150+
/// Called each time a message is delivered for this consumer.
151151
/// </summary>
152152
/// <remarks>
153-
/// Does nothing with the passed in information.
154-
/// Note that in particular, some delivered messages may require acknowledgement via <see cref="IModel.BasicAck"/>.
155-
/// The implementation of this method in this class does NOT acknowledge such messages.
153+
/// This is a no-op implementation. It will not acknowledge deliveries via <see cref="IModel.BasicAck"/>
154+
/// if consuming in automatic acknowledgement mode.
155+
/// Subclasses must copy or fully use delivery body before returning.
156+
/// Accessing the body at a later point is unsafe as its memory can
157+
/// be already released.
156158
/// </remarks>
157159
public virtual void HandleBasicDeliver(string consumerTag,
158160
ulong deliveryTag,
@@ -166,10 +168,10 @@ public virtual void HandleBasicDeliver(string consumerTag,
166168
}
167169

168170
/// <summary>
169-
/// Called when the model shuts down.
170-
/// </summary>
171-
/// <param name="model"> Common AMQP model.</param>
172-
/// <param name="reason"> Information about the reason why a particular model, session, or connection was destroyed.</param>
171+
/// Called when the model (channel) this consumer was registered on terminates.
172+
/// </summary>
173+
/// <param name="model">A channel this consumer was registered on.</param>
174+
/// <param name="reason">Shutdown context.</param>
173175
public virtual void HandleModelShutdown(object model, ShutdownEventArgs reason)
174176
{
175177
ShutdownReason = reason;

projects/RabbitMQ.Client/client/events/AsyncEventingBasicConsumer.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,33 @@ public AsyncEventingBasicConsumer(IModel model) : base(model)
1111
{
1212
}
1313

14-
///<summary>Event fired on HandleBasicDeliver.</summary>
14+
///<summary>
15+
/// Event fired when a delivery arrives for the consumer.
16+
/// </summary>
17+
/// <remarks>
18+
/// Handlers must copy or fully use delivery body before returning.
19+
/// Accessing the body at a later point is unsafe as its memory can
20+
/// be already released.
21+
/// </remarks>
1522
public event AsyncEventHandler<BasicDeliverEventArgs> Received;
1623

17-
///<summary>Event fired on HandleBasicConsumeOk.</summary>
24+
///<summary>Fires when the server confirms successful consumer cancelation.</summary>
1825
public event AsyncEventHandler<ConsumerEventArgs> Registered;
1926

20-
///<summary>Event fired on HandleModelShutdown.</summary>
27+
///<summary>Fires on model (channel) shutdown, both client and server initiated.</summary>
2128
public event AsyncEventHandler<ShutdownEventArgs> Shutdown;
2229

23-
///<summary>Event fired on HandleBasicCancelOk.</summary>
30+
///<summary>Fires when the server confirms successful consumer cancelation.</summary>
2431
public event AsyncEventHandler<ConsumerEventArgs> Unregistered;
2532

26-
///<summary>Fires the Unregistered event.</summary>
33+
///<summary>Fires when the server confirms successful consumer cancelation.</summary>
2734
public override async Task HandleBasicCancelOk(string consumerTag)
2835
{
2936
await base.HandleBasicCancelOk(consumerTag).ConfigureAwait(false);
3037
await (Unregistered?.Invoke(this, new ConsumerEventArgs(new[] { consumerTag })) ?? Task.CompletedTask).ConfigureAwait(false);
3138
}
3239

33-
///<summary>Fires the Registered event.</summary>
40+
///<summary>Fires when the server confirms successful consumer registration.</summary>
3441
public override async Task HandleBasicConsumeOk(string consumerTag)
3542
{
3643
await base.HandleBasicConsumeOk(consumerTag).ConfigureAwait(false);

projects/RabbitMQ.Client/client/events/EventingBasicConsumer.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,33 +52,47 @@ public EventingBasicConsumer(IModel model) : base(model)
5252
{
5353
}
5454

55-
///<summary>Event fired on HandleBasicDeliver.</summary>
55+
///<summary>
56+
/// Event fired when a delivery arrives for the consumer.
57+
/// </summary>
58+
/// <remarks>
59+
/// Handlers must copy or fully use delivery body before returning.
60+
/// Accessing the body at a later point is unsafe as its memory can
61+
/// be already released.
62+
/// </remarks>
5663
public event EventHandler<BasicDeliverEventArgs> Received;
5764

58-
///<summary>Event fired on HandleBasicConsumeOk.</summary>
65+
///<summary>Fires when the server confirms successful consumer cancelation.</summary>
5966
public event EventHandler<ConsumerEventArgs> Registered;
6067

61-
///<summary>Event fired on HandleModelShutdown.</summary>
68+
///<summary>Fires on model (channel) shutdown, both client and server initiated.</summary>
6269
public event EventHandler<ShutdownEventArgs> Shutdown;
6370

64-
///<summary>Event fired on HandleBasicCancelOk.</summary>
71+
///<summary>Fires when the server confirms successful consumer cancelation.</summary>
6572
public event EventHandler<ConsumerEventArgs> Unregistered;
6673

67-
///<summary>Fires the Unregistered event.</summary>
74+
///<summary>Fires when the server confirms successful consumer cancelation.</summary>
6875
public override void HandleBasicCancelOk(string consumerTag)
6976
{
7077
base.HandleBasicCancelOk(consumerTag);
7178
Unregistered?.Invoke(this, new ConsumerEventArgs(new[] { consumerTag }));
7279
}
7380

74-
///<summary>Fires the Registered event.</summary>
81+
///<summary>Fires when the server confirms successful consumer cancelation.</summary>
7582
public override void HandleBasicConsumeOk(string consumerTag)
7683
{
7784
base.HandleBasicConsumeOk(consumerTag);
7885
Registered?.Invoke(this, new ConsumerEventArgs(new[] { consumerTag }));
7986
}
8087

81-
///<summary>Fires the Received event.</summary>
88+
///<summary>
89+
/// Invoked when a delivery arrives for the consumer.
90+
/// </summary>
91+
/// <remarks>
92+
/// Handlers must copy or fully use delivery body before returning.
93+
/// Accessing the body at a later point is unsafe as its memory can
94+
/// be already released.
95+
/// </remarks>
8296
public override void HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, IBasicProperties properties, ReadOnlyMemory<byte> body)
8397
{
8498
base.HandleBasicDeliver(consumerTag, deliveryTag, redelivered, exchange, routingKey, properties, body);

0 commit comments

Comments
 (0)