Make ready for release 2.2.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a506630..19202dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [Unreleased]
+## [2.2.0] - 2022-02-04
### Added
diff --git a/samples/Consuming/Program.cs b/samples/Consuming/Program.cs
index 1ac1b20..998af08 100644
--- a/samples/Consuming/Program.cs
+++ b/samples/Consuming/Program.cs
@@ -25,8 +25,6 @@
{
private static async Task Main()
{
- const string myTopic = "persistent://public/default/mytopic";
-
var cts = new CancellationTokenSource();
Console.CancelKeyPress += (sender, args) =>
@@ -35,12 +33,12 @@
args.Cancel = true;
};
- await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
+ await using var client = PulsarClient.Builder().Build(); // Connecting to pulsar://localhost:6650
await using var consumer = client.NewConsumer(Schema.String)
.StateChangedHandler(Monitor)
.SubscriptionName("MySubscription")
- .Topic(myTopic)
+ .Topic("persistent://public/default/mytopic")
.Create();
Console.WriteLine("Press Ctrl+C to exit");
@@ -63,18 +61,8 @@
private static void Monitor(ConsumerStateChanged stateChanged, CancellationToken cancellationToken)
{
- var stateMessage = stateChanged.ConsumerState switch
- {
- ConsumerState.Active => "is active",
- ConsumerState.Inactive => "is inactive",
- ConsumerState.Disconnected => "is disconnected",
- ConsumerState.Closed => "has closed",
- ConsumerState.ReachedEndOfTopic => "has reached end of topic",
- ConsumerState.Faulted => "has faulted",
- _ => $"has an unknown state '{stateChanged.ConsumerState}'"
- };
-
var topic = stateChanged.Consumer.Topic;
- Console.WriteLine($"The consumer for topic '{topic}' {stateMessage}");
+ var state = stateChanged.ConsumerState;
+ Console.WriteLine($"The consumer for topic '{topic}' changed state to '{state}'");
}
}
diff --git a/samples/Processing/Worker.cs b/samples/Processing/Worker.cs
index e753b52..caa9d54 100644
--- a/samples/Processing/Worker.cs
+++ b/samples/Processing/Worker.cs
@@ -28,7 +28,7 @@
{
await using var client = PulsarClient.Builder()
.ExceptionHandler(context => _logger.PulsarClientException(context))
- .Build(); //Connecting to pulsar://localhost:6650
+ .Build(); // Connecting to pulsar://localhost:6650
await using var consumer = client.NewConsumer(Schema.String)
.StateChangedHandler(consumerStateChanged => _logger.ConsumerChangedState(consumerStateChanged))
diff --git a/samples/Producing/Program.cs b/samples/Producing/Program.cs
index 79045a3..48f5760 100644
--- a/samples/Producing/Program.cs
+++ b/samples/Producing/Program.cs
@@ -25,8 +25,6 @@
{
private static async Task Main()
{
- const string myTopic = "persistent://public/default/mytopic";
-
var cts = new CancellationTokenSource();
Console.CancelKeyPress += (sender, args) =>
@@ -35,11 +33,11 @@
args.Cancel = true;
};
- await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
+ await using var client = PulsarClient.Builder().Build(); // Connecting to pulsar://localhost:6650
await using var producer = client.NewProducer(Schema.String)
.StateChangedHandler(Monitor)
- .Topic(myTopic)
+ .Topic("persistent://public/default/mytopic")
.Create();
Console.WriteLine("Press Ctrl+C to exit");
@@ -67,17 +65,8 @@
private static void Monitor(ProducerStateChanged stateChanged, CancellationToken cancellationToken)
{
- var stateMessage = stateChanged.ProducerState switch
- {
- ProducerState.Connected => "is connected",
- ProducerState.Disconnected => "is disconnected",
- ProducerState.PartiallyConnected => "is partially connected",
- ProducerState.Closed => "has closed",
- ProducerState.Faulted => "has faulted",
- _ => $"has an unknown state '{stateChanged.ProducerState}'"
- };
-
var topic = stateChanged.Producer.Topic;
- Console.WriteLine($"The producer for topic '{topic}' {stateMessage}");
+ var state = stateChanged.ProducerState;
+ Console.WriteLine($"The producer for topic '{topic}' changed state to '{state}'");
}
}
diff --git a/samples/Reading/Program.cs b/samples/Reading/Program.cs
index 88b9f7c..0e99433 100644
--- a/samples/Reading/Program.cs
+++ b/samples/Reading/Program.cs
@@ -25,8 +25,6 @@
{
private static async Task Main()
{
- const string myTopic = "persistent://public/default/mytopic";
-
var cts = new CancellationTokenSource();
Console.CancelKeyPress += (sender, args) =>
@@ -35,12 +33,12 @@
args.Cancel = true;
};
- await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
+ await using var client = PulsarClient.Builder().Build(); // Connecting to pulsar://localhost:6650
await using var reader = client.NewReader(Schema.String)
.StartMessageId(MessageId.Earliest)
.StateChangedHandler(Monitor)
- .Topic(myTopic)
+ .Topic("persistent://public/default/mytopic")
.Create();
Console.WriteLine("Press Ctrl+C to exit");
@@ -62,17 +60,8 @@
private static void Monitor(ReaderStateChanged stateChanged, CancellationToken cancellationToken)
{
- var stateMessage = stateChanged.ReaderState switch
- {
- ReaderState.Connected => "is connected",
- ReaderState.Disconnected => "is disconnected",
- ReaderState.Closed => "has closed",
- ReaderState.ReachedEndOfTopic => "has reached end of topic",
- ReaderState.Faulted => "has faulted",
- _ => $"has an unknown state '{stateChanged.ReaderState}'"
- };
-
var topic = stateChanged.Reader.Topic;
- Console.WriteLine($"The reader for topic '{topic}' {stateMessage}");
+ var state = stateChanged.ReaderState;
+ Console.WriteLine($"The reader for topic '{topic}' changed state to '{state}'");
}
}
diff --git a/src/DotPulsar/DotPulsar.csproj b/src/DotPulsar/DotPulsar.csproj
index 56a4b92..5b83fa3 100644
--- a/src/DotPulsar/DotPulsar.csproj
+++ b/src/DotPulsar/DotPulsar.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
- <Version>2.1.0</Version>
+ <Version>2.2.0</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<Authors>ApachePulsar,DanskeCommodities,dblank</Authors>