This is an automated email from the ASF dual-hosted git repository.
blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 65bee00 refactor(producer): Use the producers Topic member in
GetNumberOfPartitions instead of passing it in as an argument (#144)
65bee00 is described below
commit 65bee00748b50b58b134dbb5d38c6e91109de301
Author: Thomas O'Neill <[email protected]>
AuthorDate: Thu Mar 16 04:17:21 2023 -0400
refactor(producer): Use the producers Topic member in GetNumberOfPartitions
instead of passing it in as an argument (#144)
Co-authored-by: Thomas O'Neill <[email protected]>
---
src/DotPulsar/Internal/Producer.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/DotPulsar/Internal/Producer.cs
b/src/DotPulsar/Internal/Producer.cs
index f8e8568..e699d42 100644
--- a/src/DotPulsar/Internal/Producer.cs
+++ b/src/DotPulsar/Internal/Producer.cs
@@ -111,7 +111,7 @@ public sealed class Producer<TMessage> :
IProducer<TMessage>, IRegisterEvent
private async Task Monitor()
{
- var numberOfPartitions = await GetNumberOfPartitions(Topic,
_cts.Token).ConfigureAwait(false);
+ var numberOfPartitions = await
GetNumberOfPartitions(_cts.Token).ConfigureAwait(false);
var isPartitionedTopic = numberOfPartitions != 0;
var monitoringTasks = new Task<ProducerState>[isPartitionedTopic ?
numberOfPartitions : 1];
@@ -183,10 +183,10 @@ public sealed class Producer<TMessage> :
IProducer<TMessage>, IRegisterEvent
return producer;
}
- private async Task<uint> GetNumberOfPartitions(string topic,
CancellationToken cancellationToken)
+ private async Task<uint> GetNumberOfPartitions(CancellationToken
cancellationToken)
{
- var connection = await _connectionPool.FindConnectionForTopic(topic,
cancellationToken).ConfigureAwait(false);
- var commandPartitionedMetadata = new
PulsarApi.CommandPartitionedTopicMetadata { Topic = topic };
+ var connection = await _connectionPool.FindConnectionForTopic(Topic,
cancellationToken).ConfigureAwait(false);
+ var commandPartitionedMetadata = new
PulsarApi.CommandPartitionedTopicMetadata { Topic = Topic };
var response = await connection.Send(commandPartitionedMetadata,
cancellationToken).ConfigureAwait(false);
response.Expect(PulsarApi.BaseCommand.Type.PartitionedMetadataResponse);