Skip to content

Commit 1a2a9be

Browse files
authored
Merge pull request #1309 from rabbitmq/rabbitmq-dotnet-client-1308-1
Part 1 of #1308 - renaming IModel and related names
2 parents 02bed8b + 6325941 commit 1a2a9be

File tree

82 files changed

+839
-856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+839
-856
lines changed

projects/Benchmarks/ConsumerDispatching/AsyncBasicConsumerFake.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ void IBasicConsumer.HandleBasicDeliver(string consumerTag, ulong deliveryTag, bo
4444

4545
public Task HandleBasicConsumeOk(string consumerTag) => Task.CompletedTask;
4646

47-
public Task HandleModelShutdown(object model, ShutdownEventArgs reason) => Task.CompletedTask;
47+
public Task HandleChannelShutdown(object channel, ShutdownEventArgs reason) => Task.CompletedTask;
4848

49-
public IModel Model { get; }
49+
public IChannel Channel { get; }
5050

5151
event EventHandler<ConsumerEventArgs> IBasicConsumer.ConsumerCancelled
5252
{
@@ -68,7 +68,7 @@ void IBasicConsumer.HandleBasicConsumeOk(string consumerTag)
6868
{
6969
}
7070

71-
void IBasicConsumer.HandleModelShutdown(object model, ShutdownEventArgs reason)
71+
void IBasicConsumer.HandleChannelShutdown(object channel, ShutdownEventArgs reason)
7272
{
7373
}
7474

projects/Benchmarks/Networking/Networking_BasicDeliver_Commons.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ public class Networking_BasicDeliver_Commons
1212
public static async Task Publish_Hello_World(IConnection connection, uint messageCount, byte[] body)
1313
{
1414
var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
15-
using (var model = connection.CreateModel())
15+
using (var channel = connection.CreateChannel())
1616
{
17-
var queue = model.QueueDeclare();
17+
var queue = channel.QueueDeclare();
1818
var consumed = 0;
19-
var consumer = new EventingBasicConsumer(model);
19+
var consumer = new EventingBasicConsumer(channel);
2020
consumer.Received += (s, args) =>
2121
{
2222
if (Interlocked.Increment(ref consumed) == messageCount)
2323
{
2424
tcs.SetResult(true);
2525
}
2626
};
27-
model.BasicConsume(queue.QueueName, true, consumer);
27+
channel.BasicConsume(queue.QueueName, true, consumer);
2828

2929
for (int i = 0; i < messageCount; i++)
3030
{
31-
model.BasicPublish("", queue.QueueName, body);
31+
channel.BasicPublish("", queue.QueueName, body);
3232
}
3333

3434
await tcs.Task;

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

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ public AsyncDefaultBasicConsumer()
1919
}
2020

2121
/// <summary>
22-
/// Constructor which sets the Model property to the given value.
22+
/// Constructor which sets the Channel property to the given value.
2323
/// </summary>
24-
/// <param name="model">Common AMQP model.</param>
25-
public AsyncDefaultBasicConsumer(IModel model)
24+
/// <param name="channel">Common AMQP channel.</param>
25+
public AsyncDefaultBasicConsumer(IChannel channel)
2626
{
27-
Model = model;
27+
Channel = channel;
2828
}
2929

3030
/// <summary>
3131
/// Retrieve the consumer tags this consumer is registered as; to be used when discussing this consumer
32-
/// with the server, for instance with <see cref="IModel.BasicCancel"/>.
32+
/// with the server, for instance with <see cref="IChannel.BasicCancel"/>.
3333
/// </summary>
3434
public string[] ConsumerTags
3535
{
@@ -45,7 +45,7 @@ public string[] ConsumerTags
4545
public bool IsRunning { get; protected set; }
4646

4747
/// <summary>
48-
/// If our <see cref="IModel"/> shuts down, this property will contain a description of the reason for the
48+
/// If our <see cref="IChannel"/> shuts down, this property will contain a description of the reason for the
4949
/// shutdown. Otherwise it will contain null. See <see cref="ShutdownEventArgs"/>.
5050
/// </summary>
5151
public ShutdownEventArgs ShutdownReason { get; protected set; }
@@ -61,10 +61,10 @@ public event AsyncEventHandler<ConsumerEventArgs> ConsumerCancelled
6161
private AsyncEventingWrapper<ConsumerEventArgs> _consumerCancelledWrapper;
6262

6363
/// <summary>
64-
/// Retrieve the <see cref="IModel"/> this consumer is associated with,
64+
/// Retrieve the <see cref="IChannel"/> this consumer is associated with,
6565
/// for use in acknowledging received messages, for instance.
6666
/// </summary>
67-
public IModel Model { get; set; }
67+
public IChannel Channel { get; set; }
6868

6969
/// <summary>
7070
/// Called when the consumer is cancelled for reasons other than by a basicCancel:
@@ -101,7 +101,7 @@ public virtual Task HandleBasicConsumeOk(string consumerTag)
101101
/// Called each time a message is delivered for this consumer.
102102
/// </summary>
103103
/// <remarks>
104-
/// This is a no-op implementation. It will not acknowledge deliveries via <see cref="IModel.BasicAck"/>
104+
/// This is a no-op implementation. It will not acknowledge deliveries via <see cref="IChannel.BasicAck"/>
105105
/// if consuming in automatic acknowledgement mode.
106106
/// Subclasses must copy or fully use delivery body before returning.
107107
/// Accessing the body at a later point is unsafe as its memory can
@@ -120,11 +120,11 @@ public virtual Task HandleBasicDeliver(string consumerTag,
120120
}
121121

122122
/// <summary>
123-
/// Called when the model (channel) this consumer was registered on terminates.
123+
/// Called when the channel (channel) this consumer was registered on terminates.
124124
/// </summary>
125-
/// <param name="model">A channel this consumer was registered on.</param>
125+
/// <param name="channel">A channel this consumer was registered on.</param>
126126
/// <param name="reason">Shutdown context.</param>
127-
public virtual Task HandleModelShutdown(object model, ShutdownEventArgs reason)
127+
public virtual Task HandleChannelShutdown(object channel, ShutdownEventArgs reason)
128128
{
129129
ShutdownReason = reason;
130130
return OnCancel(_consumerTags.ToArray());
@@ -170,7 +170,7 @@ void IBasicConsumer.HandleBasicDeliver(string consumerTag, ulong deliveryTag, bo
170170
throw new InvalidOperationException("Should never be called. Enable 'DispatchConsumersAsync'.");
171171
}
172172

173-
void IBasicConsumer.HandleModelShutdown(object model, ShutdownEventArgs reason)
173+
void IBasicConsumer.HandleChannelShutdown(object channel, ShutdownEventArgs reason)
174174
{
175175
throw new InvalidOperationException("Should never be called. Enable 'DispatchConsumersAsync'.");
176176
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public BasicGetResult(ulong deliveryTag, bool redelivered, string exchange, stri
9999
public ReadOnlyMemory<byte> Body { get; }
100100

101101
/// <summary>
102-
/// Retrieve the delivery tag for this message. See also <see cref="IModel.BasicAck"/>.
102+
/// Retrieve the delivery tag for this message. See also <see cref="IChannel.BasicAck"/>.
103103
/// </summary>
104104
public ulong DeliveryTag { get; }
105105

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace RabbitMQ.Client
55
{
66
/// <summary>
7-
/// Caches a string's byte representation to be used for certain methods like IModel.BasicPublish/>.
7+
/// Caches a string's byte representation to be used for certain methods like IChannel.BasicPublish/>.
88
/// </summary>
99
public sealed class CachedString
1010
{

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ namespace RabbitMQ.Client
6161
/// //
6262
/// IConnection conn = factory.CreateConnection();
6363
/// //
64-
/// IModel ch = conn.CreateModel();
64+
/// IChannel ch = conn.CreateChannel();
6565
/// //
66-
/// // ... use ch's IModel methods ...
66+
/// // ... use ch's IChannel methods ...
6767
/// //
6868
/// ch.Close(Constants.ReplySuccess, "Closing the channel");
6969
/// conn.Close(Constants.ReplySuccess, "Closing the connection");

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

+12-12
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ public DefaultBasicConsumer()
5858
}
5959

6060
/// <summary>
61-
/// Constructor which sets the Model property to the given value.
61+
/// Constructor which sets the Channel property to the given value.
6262
/// </summary>
63-
/// <param name="model">Common AMQP model.</param>
64-
public DefaultBasicConsumer(IModel model)
63+
/// <param name="channel">Common AMQP channel.</param>
64+
public DefaultBasicConsumer(IChannel channel)
6565
{
66-
Model = model;
66+
Channel = channel;
6767
}
6868

6969
/// <summary>
7070
/// Retrieve the consumer tags this consumer is registered as; to be used to identify
71-
/// this consumer, for example, when cancelling it with <see cref="IModel.BasicCancel"/>.
71+
/// this consumer, for example, when cancelling it with <see cref="IChannel.BasicCancel"/>.
7272
/// This value is an array because a single consumer instance can be reused to consume on
7373
/// multiple channels.
7474
/// </summary>
@@ -86,7 +86,7 @@ public string[] ConsumerTags
8686
public bool IsRunning { get; protected set; }
8787

8888
/// <summary>
89-
/// If our <see cref="IModel"/> shuts down, this property will contain a description of the reason for the
89+
/// If our <see cref="IChannel"/> shuts down, this property will contain a description of the reason for the
9090
/// shutdown. Otherwise it will contain null. See <see cref="ShutdownEventArgs"/>.
9191
/// </summary>
9292
public ShutdownEventArgs ShutdownReason { get; protected set; }
@@ -102,10 +102,10 @@ public event EventHandler<ConsumerEventArgs> ConsumerCancelled
102102
private EventingWrapper<ConsumerEventArgs> _consumerCancelledWrapper;
103103

104104
/// <summary>
105-
/// Retrieve the <see cref="IModel"/> this consumer is associated with,
105+
/// Retrieve the <see cref="IChannel"/> this consumer is associated with,
106106
/// for use in acknowledging received messages, for instance.
107107
/// </summary>
108-
public IModel Model { get; set; }
108+
public IChannel Channel { get; set; }
109109

110110
/// <summary>
111111
/// Called when the consumer is cancelled for reasons other than by a basicCancel:
@@ -141,7 +141,7 @@ public virtual void HandleBasicConsumeOk(string consumerTag)
141141
/// Called each time a message is delivered for this consumer.
142142
/// </summary>
143143
/// <remarks>
144-
/// This is a no-op implementation. It will not acknowledge deliveries via <see cref="IModel.BasicAck"/>
144+
/// This is a no-op implementation. It will not acknowledge deliveries via <see cref="IChannel.BasicAck"/>
145145
/// if consuming in automatic acknowledgement mode.
146146
/// Subclasses must copy or fully use delivery body before returning.
147147
/// Accessing the body at a later point is unsafe as its memory can
@@ -159,11 +159,11 @@ public virtual void HandleBasicDeliver(string consumerTag,
159159
}
160160

161161
/// <summary>
162-
/// Called when the model (channel) this consumer was registered on terminates.
162+
/// Called when the channel (channel) this consumer was registered on terminates.
163163
/// </summary>
164-
/// <param name="model">A channel this consumer was registered on.</param>
164+
/// <param name="channel">A channel this consumer was registered on.</param>
165165
/// <param name="reason">Shutdown context.</param>
166-
public virtual void HandleModelShutdown(object model, ShutdownEventArgs reason)
166+
public virtual void HandleChannelShutdown(object channel, ShutdownEventArgs reason)
167167
{
168168
ShutdownReason = reason;
169169
OnCancel(_consumerTags.ToArray());

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace RabbitMQ.Client
3838
/// </summary>
3939
/// <remarks>
4040
/// Use the static members of this class as values for the
41-
/// "exchangeType" arguments for IModel methods such as
41+
/// "exchangeType" arguments for IChannel methods such as
4242
/// ExchangeDeclare. The broker may be extended with additional
4343
/// exchange types that do not appear in this class.
4444
/// </remarks>

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ namespace RabbitMQ.Client
88
public interface IAsyncBasicConsumer
99
{
1010
/// <summary>
11-
/// Retrieve the <see cref="IModel"/> this consumer is associated with,
11+
/// Retrieve the <see cref="IChannel"/> this consumer is associated with,
1212
/// for use in acknowledging received messages, for instance.
1313
/// </summary>
14-
IModel Model { get; }
14+
IChannel Channel { get; }
1515

1616
/// <summary>
1717
/// Signalled when the consumer gets cancelled.
@@ -43,7 +43,7 @@ public interface IAsyncBasicConsumer
4343
/// </summary>
4444
/// <remarks>
4545
/// Does nothing with the passed in information.
46-
/// Note that in particular, some delivered messages may require acknowledgement via <see cref="IModel.BasicAck"/>.
46+
/// Note that in particular, some delivered messages may require acknowledgement via <see cref="IChannel.BasicAck"/>.
4747
/// The implementation of this method in this class does NOT acknowledge such messages.
4848
/// </remarks>
4949
Task HandleBasicDeliver(string consumerTag,
@@ -55,10 +55,10 @@ Task HandleBasicDeliver(string consumerTag,
5555
ReadOnlyMemory<byte> body);
5656

5757
/// <summary>
58-
/// Called when the model shuts down.
58+
/// Called when the channel shuts down.
5959
/// </summary>
60-
/// <param name="model"> Common AMQP model.</param>
61-
/// <param name="reason"> Information about the reason why a particular model, session, or connection was destroyed.</param>
62-
Task HandleModelShutdown(object model, ShutdownEventArgs reason);
60+
/// <param name="channel"> Common AMQP channel.</param>
61+
/// <param name="reason"> Information about the reason why a particular channel, session, or connection was destroyed.</param>
62+
Task HandleChannelShutdown(object channel, ShutdownEventArgs reason);
6363
}
6464
}

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace RabbitMQ.Client
3939
///receive messages from a queue by subscription.</summary>
4040
/// <remarks>
4141
/// <para>
42-
/// See IModel.BasicConsume, IModel.BasicCancel.
42+
/// See IChannel.BasicConsume, IChannel.BasicCancel.
4343
/// </para>
4444
/// <para>
4545
/// Note that the "Handle*" methods run in the connection's
@@ -51,10 +51,10 @@ namespace RabbitMQ.Client
5151
public interface IBasicConsumer
5252
{
5353
/// <summary>
54-
/// Retrieve the <see cref="IModel"/> this consumer is associated with,
54+
/// Retrieve the <see cref="IChannel"/> this consumer is associated with,
5555
/// for use in acknowledging received messages, for instance.
5656
/// </summary>
57-
IModel Model { get; }
57+
IChannel Channel { get; }
5858

5959
/// <summary>
6060
/// Signalled when the consumer gets cancelled.
@@ -86,7 +86,7 @@ public interface IBasicConsumer
8686
/// </summary>
8787
/// <remarks>
8888
/// Does nothing with the passed in information.
89-
/// Note that in particular, some delivered messages may require acknowledgement via <see cref="IModel.BasicAck"/>.
89+
/// Note that in particular, some delivered messages may require acknowledgement via <see cref="IChannel.BasicAck"/>.
9090
/// The implementation of this method in this class does NOT acknowledge such messages.
9191
/// </remarks>
9292
void HandleBasicDeliver(string consumerTag,
@@ -98,10 +98,10 @@ void HandleBasicDeliver(string consumerTag,
9898
ReadOnlyMemory<byte> body);
9999

100100
/// <summary>
101-
/// Called when the model shuts down.
101+
/// Called when the channel shuts down.
102102
/// </summary>
103-
/// <param name="model"> Common AMQP model.</param>
104-
/// <param name="reason"> Information about the reason why a particular model, session, or connection was destroyed.</param>
105-
void HandleModelShutdown(object model, ShutdownEventArgs reason);
103+
/// <param name="channel"> Common AMQP channel.</param>
104+
/// <param name="reason"> Information about the reason why a particular channel, session, or connection was destroyed.</param>
105+
void HandleChannelShutdown(object channel, ShutdownEventArgs reason);
106106
}
107107
}

projects/RabbitMQ.Client/client/api/IModel.cs renamed to projects/RabbitMQ.Client/client/api/IChannel.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace RabbitMQ.Client
4545
/// Extends the <see cref="IDisposable"/> interface, so that the "using"
4646
/// statement can be used to scope the lifetime of a channel when appropriate.
4747
/// </remarks>
48-
public interface IModel : IDisposable
48+
public interface IChannel : IDisposable
4949
{
5050
/// <summary>
5151
/// Channel number, unique per connections.
@@ -83,12 +83,12 @@ public interface IModel : IDisposable
8383
IBasicConsumer DefaultConsumer { get; set; }
8484

8585
/// <summary>
86-
/// Returns true if the model is no longer in a state where it can be used.
86+
/// Returns true if the channel is no longer in a state where it can be used.
8787
/// </summary>
8888
bool IsClosed { get; }
8989

9090
/// <summary>
91-
/// Returns true if the model is still in a state where it can be used.
91+
/// Returns true if the channel is still in a state where it can be used.
9292
/// Identical to checking if <see cref="CloseReason"/> equals null.</summary>
9393
bool IsOpen { get; }
9494

@@ -124,24 +124,24 @@ public interface IModel : IDisposable
124124
event EventHandler<BasicReturnEventArgs> BasicReturn;
125125

126126
/// <summary>
127-
/// Signalled when an exception occurs in a callback invoked by the model.
127+
/// Signalled when an exception occurs in a callback invoked by the channel.
128128
///
129129
/// Examples of cases where this event will be signalled
130130
/// include exceptions thrown in <see cref="IBasicConsumer"/> methods, or
131-
/// exceptions thrown in <see cref="ModelShutdown"/> delegates etc.
131+
/// exceptions thrown in <see cref="ChannelShutdown"/> delegates etc.
132132
/// </summary>
133133
event EventHandler<CallbackExceptionEventArgs> CallbackException;
134134

135135
event EventHandler<FlowControlEventArgs> FlowControl;
136136

137137
/// <summary>
138-
/// Notifies the destruction of the model.
138+
/// Notifies the destruction of the channel.
139139
/// </summary>
140140
/// <remarks>
141-
/// If the model is already destroyed at the time an event
141+
/// If the channel is already destroyed at the time an event
142142
/// handler is added to this event, the event handler will be fired immediately.
143143
/// </remarks>
144-
event EventHandler<ShutdownEventArgs> ModelShutdown;
144+
event EventHandler<ShutdownEventArgs> ChannelShutdown;
145145

146146
/// <summary>
147147
/// Acknowledge one or more delivered message(s).
@@ -172,7 +172,7 @@ string BasicConsume(
172172
/// <summary>
173173
/// Retrieve an individual message, if
174174
/// one is available; returns null if the server answers that
175-
/// no messages are currently available. See also <see cref="IModel.BasicAck"/>.
175+
/// no messages are currently available. See also <see cref="IChannel.BasicAck"/>.
176176
/// </summary>
177177
BasicGetResult BasicGet(string queue, bool autoAck);
178178

0 commit comments

Comments
 (0)