Skip to content

Commit 1e4295f

Browse files
committed
Renames
1 parent 8593176 commit 1e4295f

29 files changed

+145
-148
lines changed

projects/RabbitMQ.Client/IConnection.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ Task CloseAsync(ushort reasonCode, string reasonText, TimeSpan timeout, bool abo
240240
/// <summary>
241241
/// Asynchronously create and return a fresh channel, session, and channel.
242242
/// </summary>
243-
/// <param name="publisherConfirmations">
243+
/// <param name="publisherConfirmationsEnabled">
244244
/// Enable or disable publisher confirmations on this channel. Defaults to <c>false</c>
245245
/// </param>
246-
/// <param name="publisherConfirmationTracking">
246+
/// <param name="publisherConfirmationTrackingEnabled">
247247
/// Should this library track publisher confirmations for you? Defaults to <c>false</c>
248248
/// </param>
249249
/// <param name="consumerDispatchConcurrency">
@@ -257,7 +257,8 @@ Task CloseAsync(ushort reasonCode, string reasonText, TimeSpan timeout, bool abo
257257
/// In addition to that consumers need to be thread/concurrency safe.
258258
/// </param>
259259
/// <param name="cancellationToken">Cancellation token</param>
260-
Task<IChannel> CreateChannelAsync(bool publisherConfirmations = false, bool publisherConfirmationTracking = false,
260+
Task<IChannel> CreateChannelAsync(bool publisherConfirmationsEnabled = false,
261+
bool publisherConfirmationTrackingEnabled = false,
261262
ushort? consumerDispatchConcurrency = null,
262263
CancellationToken cancellationToken = default);
263264
}

projects/RabbitMQ.Client/Impl/AutorecoveringChannel.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ internal sealed class AutorecoveringChannel : IChannel, IRecoverable
4949

5050
private ushort _prefetchCountConsumer;
5151
private ushort _prefetchCountGlobal;
52-
private bool _usesPublisherConfirms;
53-
private bool _tracksPublisherConfirmations;
52+
private bool _publisherConfirmationsEnabled = false;
53+
private bool _publisherConfirmationTrackingEnabled = false;
5454
private bool _usesTransactions;
5555
private ushort _consumerDispatchConcurrency;
5656

@@ -161,8 +161,9 @@ internal async Task<bool> AutomaticallyRecoverAsync(AutorecoveringConnection con
161161

162162
_connection = conn;
163163

164-
RecoveryAwareChannel newChannel = await conn.CreateNonRecoveringChannelAsync(_consumerDispatchConcurrency,
165-
cancellationToken: cancellationToken)
164+
RecoveryAwareChannel newChannel = await conn.CreateNonRecoveringChannelAsync(
165+
_publisherConfirmationsEnabled, _publisherConfirmationTrackingEnabled,
166+
_consumerDispatchConcurrency, cancellationToken)
166167
.ConfigureAwait(false);
167168
newChannel.TakeOver(_innerChannel);
168169

@@ -178,9 +179,9 @@ await newChannel.BasicQosAsync(0, _prefetchCountGlobal, true, cancellationToken)
178179
.ConfigureAwait(false);
179180
}
180181

181-
if (_usesPublisherConfirms)
182+
if (_publisherConfirmationsEnabled)
182183
{
183-
await newChannel.ConfirmSelectAsync(_tracksPublisherConfirmations, cancellationToken)
184+
await newChannel.ConfirmSelectAsync(_publisherConfirmationTrackingEnabled, cancellationToken)
184185
.ConfigureAwait(false);
185186
}
186187

@@ -347,12 +348,12 @@ public Task BasicQosAsync(uint prefetchSize, ushort prefetchCount, bool global,
347348
return _innerChannel.BasicQosAsync(prefetchSize, prefetchCount, global, cancellationToken);
348349
}
349350

350-
public async Task ConfirmSelectAsync(bool trackConfirmations = true, CancellationToken cancellationToken = default)
351+
public async Task ConfirmSelectAsync(bool publisherConfirmationTrackingEnabled = false, CancellationToken cancellationToken = default)
351352
{
352-
await InnerChannel.ConfirmSelectAsync(trackConfirmations, cancellationToken)
353+
_publisherConfirmationsEnabled = true;
354+
_publisherConfirmationTrackingEnabled = publisherConfirmationTrackingEnabled;
355+
await InnerChannel.ConfirmSelectAsync(publisherConfirmationTrackingEnabled, cancellationToken)
353356
.ConfigureAwait(false);
354-
_usesPublisherConfirms = true;
355-
_tracksPublisherConfirmations = trackConfirmations;
356357
}
357358

358359
public async Task ExchangeBindAsync(string destination, string source, string routingKey,

projects/RabbitMQ.Client/Impl/AutorecoveringConnection.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,17 @@ public event AsyncEventHandler<RecoveringConsumerEventArgs> RecoveringConsumerAs
184184

185185
public IProtocol Protocol => Endpoint.Protocol;
186186

187-
public async ValueTask<RecoveryAwareChannel> CreateNonRecoveringChannelAsync(ushort consumerDispatchConcurrency,
187+
public async ValueTask<RecoveryAwareChannel> CreateNonRecoveringChannelAsync(
188+
bool publisherConfirmationsEnabled = false,
189+
bool publisherConfirmationTrackingEnabled = false,
190+
ushort? consumerDispatchConcurrency = null,
188191
CancellationToken cancellationToken = default)
189192
{
190193
ISession session = InnerConnection.CreateSession();
191194
var result = new RecoveryAwareChannel(_config, session, consumerDispatchConcurrency);
192-
return (RecoveryAwareChannel)await result.OpenAsync(cancellationToken).ConfigureAwait(false);
195+
return (RecoveryAwareChannel)await result.OpenAsync(
196+
publisherConfirmationsEnabled, publisherConfirmationTrackingEnabled, cancellationToken)
197+
.ConfigureAwait(false);
193198
}
194199

195200
public override string ToString()
@@ -251,27 +256,29 @@ await CloseInnerConnectionAsync()
251256
}
252257
}
253258

254-
public async Task<IChannel> CreateChannelAsync(bool publisherConfirmations = false, bool publisherConfirmationTracking = false,
255-
ushort? consumerDispatchConcurrency = null, CancellationToken cancellationToken = default)
259+
public async Task<IChannel> CreateChannelAsync(bool publisherConfirmationsEnabled = false,
260+
bool publisherConfirmationTrackingEnabled = false,
261+
ushort? consumerDispatchConcurrency = null,
262+
CancellationToken cancellationToken = default)
256263
{
257264
EnsureIsOpen();
258265

259266
ushort cdc = consumerDispatchConcurrency.GetValueOrDefault(_config.ConsumerDispatchConcurrency);
260267

261-
RecoveryAwareChannel recoveryAwareChannel = await CreateNonRecoveringChannelAsync(cdc, cancellationToken)
268+
RecoveryAwareChannel recoveryAwareChannel = await CreateNonRecoveringChannelAsync(
269+
publisherConfirmationsEnabled, publisherConfirmationTrackingEnabled, cdc, cancellationToken)
262270
.ConfigureAwait(false);
263271

264-
AutorecoveringChannel channel = new AutorecoveringChannel(this, recoveryAwareChannel, cdc);
265-
if (publisherConfirmations)
272+
var autorecoveringChannel = new AutorecoveringChannel(this, recoveryAwareChannel, cdc);
273+
if (publisherConfirmationsEnabled)
266274
{
267-
await channel.ConfirmSelectAsync(trackConfirmations: publisherConfirmationTracking,
268-
cancellationToken: cancellationToken).ConfigureAwait(false);
275+
// TODO yes, this is necessary, not sure why
276+
await autorecoveringChannel.ConfirmSelectAsync(publisherConfirmationTrackingEnabled, cancellationToken)
277+
.ConfigureAwait(false);
269278
}
270-
271-
await RecordChannelAsync(channel, channelsSemaphoreHeld: false, cancellationToken: cancellationToken)
279+
await RecordChannelAsync(autorecoveringChannel, channelsSemaphoreHeld: false, cancellationToken: cancellationToken)
272280
.ConfigureAwait(false);
273-
274-
return channel;
281+
return autorecoveringChannel;
275282
}
276283

277284
public void Dispose() => DisposeAsync().AsTask().GetAwaiter().GetResult();

0 commit comments

Comments
 (0)