Moving to .NET 6, C# 10 and file-scoped namespaces
diff --git a/samples/Consuming/Consuming.csproj b/samples/Consuming/Consuming.csproj
index 6e05a4d..e2bb331 100644
--- a/samples/Consuming/Consuming.csproj
+++ b/samples/Consuming/Consuming.csproj
@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
   </PropertyGroup>
 
   <ItemGroup>
diff --git a/samples/Consuming/Program.cs b/samples/Consuming/Program.cs
index d77b178..ed2bb74 100644
--- a/samples/Consuming/Program.cs
+++ b/samples/Consuming/Program.cs
@@ -12,70 +12,69 @@
  * limitations under the License.
  */
 
-namespace Consuming
+namespace Consuming;
+
+using DotPulsar;
+using DotPulsar.Abstractions;
+using DotPulsar.Extensions;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+internal static class Program
 {
-    using DotPulsar;
-    using DotPulsar.Abstractions;
-    using DotPulsar.Extensions;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
-
-    internal static class Program
+    private static async Task Main()
     {
-        private static async Task Main()
+        const string myTopic = "persistent://public/default/mytopic";
+
+        var cts = new CancellationTokenSource();
+
+        Console.CancelKeyPress += (sender, args) =>
         {
-            const string myTopic = "persistent://public/default/mytopic";
+            cts.Cancel();
+            args.Cancel = true;
+        };
 
-            var cts = new CancellationTokenSource();
+        await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
 
-            Console.CancelKeyPress += (sender, args) =>
-            {
-                cts.Cancel();
-                args.Cancel = true;
-            };
+        await using var consumer = client.NewConsumer(Schema.String)
+            .StateChangedHandler(Monitor)
+            .SubscriptionName("MySubscription")
+            .Topic(myTopic)
+            .Create();
 
-            await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
+        Console.WriteLine("Press Ctrl+C to exit");
 
-            await using var consumer = client.NewConsumer(Schema.String)
-                .StateChangedHandler(Monitor)
-                .SubscriptionName("MySubscription")
-                .Topic(myTopic)
-                .Create();
+        await ConsumeMessages(consumer, cts.Token);
+    }
 
-            Console.WriteLine("Press Ctrl+C to exit");
-
-            await ConsumeMessages(consumer, cts.Token);
-        }
-
-        private static async Task ConsumeMessages(IConsumer<string> consumer, CancellationToken cancellationToken)
+    private static async Task ConsumeMessages(IConsumer<string> consumer, CancellationToken cancellationToken)
+    {
+        try
         {
-            try
+            await foreach (var message in consumer.Messages(cancellationToken))
             {
-                await foreach (var message in consumer.Messages(cancellationToken))
-                {
-                    Console.WriteLine("Received: " + message.Value());
-                    await consumer.Acknowledge(message, cancellationToken);
-                }
+                Console.WriteLine("Received: " + message.Value());
+                await consumer.Acknowledge(message, cancellationToken);
             }
-            catch (OperationCanceledException) { }
         }
+        catch (OperationCanceledException) { }
+    }
 
-        private static void Monitor(ConsumerStateChanged stateChanged, CancellationToken cancellationToken)
+    private static void Monitor(ConsumerStateChanged stateChanged, CancellationToken cancellationToken)
+    {
+        var stateMessage = stateChanged.ConsumerState switch
         {
-            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}'"
-            };
+            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 topic = stateChanged.Consumer.Topic;
+        Console.WriteLine($"The consumer for topic '{topic}' " + stateMessage);
     }
 }
diff --git a/samples/Producing/Producing.csproj b/samples/Producing/Producing.csproj
index 6e05a4d..e2bb331 100644
--- a/samples/Producing/Producing.csproj
+++ b/samples/Producing/Producing.csproj
@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
   </PropertyGroup>
 
   <ItemGroup>
diff --git a/samples/Producing/Program.cs b/samples/Producing/Program.cs
index 42a706b..14749b7 100644
--- a/samples/Producing/Program.cs
+++ b/samples/Producing/Program.cs
@@ -12,73 +12,72 @@
  * limitations under the License.
  */
 
-namespace Producing
+namespace Producing;
+
+using DotPulsar;
+using DotPulsar.Abstractions;
+using DotPulsar.Extensions;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+internal static class Program
 {
-    using DotPulsar;
-    using DotPulsar.Abstractions;
-    using DotPulsar.Extensions;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
-
-    internal static class Program
+    private static async Task Main()
     {
-        private static async Task Main()
+        const string myTopic = "persistent://public/default/mytopic";
+
+        var cts = new CancellationTokenSource();
+
+        Console.CancelKeyPress += (sender, args) =>
         {
-            const string myTopic = "persistent://public/default/mytopic";
+            cts.Cancel();
+            args.Cancel = true;
+        };
 
-            var cts = new CancellationTokenSource();
+        await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
 
-            Console.CancelKeyPress += (sender, args) =>
-            {
-                cts.Cancel();
-                args.Cancel = true;
-            };
+        await using var producer = client.NewProducer(Schema.String)
+            .StateChangedHandler(Monitor)
+            .Topic(myTopic)
+            .Create();
 
-            await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
+        Console.WriteLine("Press Ctrl+C to exit");
 
-            await using var producer = client.NewProducer(Schema.String)
-                .StateChangedHandler(Monitor)
-                .Topic(myTopic)
-                .Create();
+        await ProduceMessages(producer, cts.Token);
+    }
 
-            Console.WriteLine("Press Ctrl+C to exit");
+    private static async Task ProduceMessages(IProducer<string> producer, CancellationToken cancellationToken)
+    {
+        var delay = TimeSpan.FromSeconds(5);
 
-            await ProduceMessages(producer, cts.Token);
-        }
-
-        private static async Task ProduceMessages(IProducer<string> producer, CancellationToken cancellationToken)
+        try
         {
-            var delay = TimeSpan.FromSeconds(5);
-
-            try
+            while (!cancellationToken.IsCancellationRequested)
             {
-                while (!cancellationToken.IsCancellationRequested)
-                {
-                    var data = DateTime.UtcNow.ToLongTimeString();
-                    _ = await producer.Send(data, cancellationToken);
-                    Console.WriteLine("Sent: " + data);
-                    await Task.Delay(delay, cancellationToken);
-                }
+                var data = DateTime.UtcNow.ToLongTimeString();
+                _ = await producer.Send(data, cancellationToken);
+                Console.WriteLine("Sent: " + data);
+                await Task.Delay(delay, cancellationToken);
             }
-            catch (OperationCanceledException) // If not using the cancellationToken, then just dispose the producer and catch ObjectDisposedException instead
-            { }
         }
+        catch (OperationCanceledException) // If not using the cancellationToken, then just dispose the producer and catch ObjectDisposedException instead
+        { }
+    }
 
-        private static void Monitor(ProducerStateChanged stateChanged, CancellationToken cancellationToken)
+    private static void Monitor(ProducerStateChanged stateChanged, CancellationToken cancellationToken)
+    {
+        var stateMessage = stateChanged.ProducerState switch
         {
-            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}'"
-            };
+            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 topic = stateChanged.Producer.Topic;
+        Console.WriteLine($"The producer for topic '{topic}' " + stateMessage);
     }
 }
diff --git a/samples/Reading/Program.cs b/samples/Reading/Program.cs
index 627b3e5..b76b1b8 100644
--- a/samples/Reading/Program.cs
+++ b/samples/Reading/Program.cs
@@ -12,68 +12,67 @@
  * limitations under the License.
  */
 
-namespace Reading
+namespace Reading;
+
+using DotPulsar;
+using DotPulsar.Abstractions;
+using DotPulsar.Extensions;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+internal static class Program
 {
-    using DotPulsar;
-    using DotPulsar.Abstractions;
-    using DotPulsar.Extensions;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
-
-    internal static class Program
+    private static async Task Main()
     {
-        private static async Task Main()
+        const string myTopic = "persistent://public/default/mytopic";
+
+        var cts = new CancellationTokenSource();
+
+        Console.CancelKeyPress += (sender, args) =>
         {
-            const string myTopic = "persistent://public/default/mytopic";
+            cts.Cancel();
+            args.Cancel = true;
+        };
 
-            var cts = new CancellationTokenSource();
+        await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
 
-            Console.CancelKeyPress += (sender, args) =>
-            {
-                cts.Cancel();
-                args.Cancel = true;
-            };
+        await using var reader = client.NewReader(Schema.String)
+            .StartMessageId(MessageId.Earliest)
+            .StateChangedHandler(Monitor)
+            .Topic(myTopic)
+            .Create();
 
-            await using var client = PulsarClient.Builder().Build(); //Connecting to pulsar://localhost:6650
+        Console.WriteLine("Press Ctrl+C to exit");
 
-            await using var reader = client.NewReader(Schema.String)
-                .StartMessageId(MessageId.Earliest)
-                .StateChangedHandler(Monitor)
-                .Topic(myTopic)
-                .Create();
+        await ReadMessages(reader, cts.Token);
+    }
 
-            Console.WriteLine("Press Ctrl+C to exit");
-
-            await ReadMessages(reader, cts.Token);
-        }
-
-        private static async Task ReadMessages(IReader<string> reader, CancellationToken cancellationToken)
+    private static async Task ReadMessages(IReader<string> reader, CancellationToken cancellationToken)
+    {
+        try
         {
-            try
+            await foreach (var message in reader.Messages(cancellationToken))
             {
-                await foreach (var message in reader.Messages(cancellationToken))
-                {
-                    Console.WriteLine("Received: " + message.Value());
-                }
+                Console.WriteLine("Received: " + message.Value());
             }
-            catch (OperationCanceledException) { }
         }
+        catch (OperationCanceledException) { }
+    }
 
-        private static void Monitor(ReaderStateChanged stateChanged, CancellationToken cancellationToken)
+    private static void Monitor(ReaderStateChanged stateChanged, CancellationToken cancellationToken)
+    {
+        var stateMessage = stateChanged.ReaderState switch
         {
-            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}'"
-            };
+            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 topic = stateChanged.Reader.Topic;
+        Console.WriteLine($"The reader for topic '{topic}' " + stateMessage);
     }
 }
diff --git a/samples/Reading/Reading.csproj b/samples/Reading/Reading.csproj
index 6e05a4d..e2bb331 100644
--- a/samples/Reading/Reading.csproj
+++ b/samples/Reading/Reading.csproj
@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
   </PropertyGroup>
 
   <ItemGroup>
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 7254a3d..be011ab 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,7 +1,7 @@
 <Project>
 
   <PropertyGroup>
-    <LangVersion>9.0</LangVersion>
+    <LangVersion>10.0</LangVersion>
     <Nullable>enable</Nullable>
   </PropertyGroup>
 
diff --git a/src/DotPulsar/Abstractions/IConsumer.cs b/src/DotPulsar/Abstractions/IConsumer.cs
index 6996825..6628359 100644
--- a/src/DotPulsar/Abstractions/IConsumer.cs
+++ b/src/DotPulsar/Abstractions/IConsumer.cs
@@ -12,56 +12,55 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// A consumer abstraction.
+/// </summary>
+public interface IConsumer : IGetLastMessageId, ISeek, IState<ConsumerState>, IAsyncDisposable
 {
-    using System;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Acknowledge the consumption of a single message using the MessageId.
+    /// </summary>
+    ValueTask Acknowledge(MessageId messageId, CancellationToken cancellationToken = default);
 
     /// <summary>
-    /// A consumer abstraction.
+    /// Acknowledge the consumption of all the messages in the topic up to and including the provided MessageId.
     /// </summary>
-    public interface IConsumer : IGetLastMessageId, ISeek, IState<ConsumerState>, IAsyncDisposable
-    {
-        /// <summary>
-        /// Acknowledge the consumption of a single message using the MessageId.
-        /// </summary>
-        ValueTask Acknowledge(MessageId messageId, CancellationToken cancellationToken = default);
+    ValueTask AcknowledgeCumulative(MessageId messageId, CancellationToken cancellationToken = default);
 
-        /// <summary>
-        /// Acknowledge the consumption of all the messages in the topic up to and including the provided MessageId.
-        /// </summary>
-        ValueTask AcknowledgeCumulative(MessageId messageId, CancellationToken cancellationToken = default);
+    /// <summary>
+    /// The consumer's service url.
+    /// </summary>
+    public Uri ServiceUrl { get; }
 
-        /// <summary>
-        /// The consumer's service url.
-        /// </summary>
-        public Uri ServiceUrl { get; }
+    /// <summary>
+    /// The consumer's subscription name.
+    /// </summary>
+    public string SubscriptionName { get; }
 
-        /// <summary>
-        /// The consumer's subscription name.
-        /// </summary>
-        public string SubscriptionName { get; }
+    /// <summary>
+    /// The consumer's topic.
+    /// </summary>
+    string Topic { get; }
 
-        /// <summary>
-        /// The consumer's topic.
-        /// </summary>
-        string Topic { get; }
+    /// <summary>
+    /// Unsubscribe the consumer.
+    /// </summary>
+    ValueTask Unsubscribe(CancellationToken cancellationToken = default);
 
-        /// <summary>
-        /// Unsubscribe the consumer.
-        /// </summary>
-        ValueTask Unsubscribe(CancellationToken cancellationToken = default);
+    /// <summary>
+    /// Redeliver the pending messages that were pushed to this consumer that are not yet acknowledged.
+    /// </summary>
+    ValueTask RedeliverUnacknowledgedMessages(IEnumerable<MessageId> messageIds, CancellationToken cancellationToken = default);
 
-        /// <summary>
-        /// Redeliver the pending messages that were pushed to this consumer that are not yet acknowledged.
-        /// </summary>
-        ValueTask RedeliverUnacknowledgedMessages(IEnumerable<MessageId> messageIds, CancellationToken cancellationToken = default);
-
-        /// <summary>
-        /// Redeliver all pending messages that were pushed to this consumer that are not yet acknowledged.
-        /// </summary>
-        ValueTask RedeliverUnacknowledgedMessages(CancellationToken cancellationToken = default);
-    }
+    /// <summary>
+    /// Redeliver all pending messages that were pushed to this consumer that are not yet acknowledged.
+    /// </summary>
+    ValueTask RedeliverUnacknowledgedMessages(CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Abstractions/IConsumerBuilder.cs b/src/DotPulsar/Abstractions/IConsumerBuilder.cs
index 8134eca..54d1fbd 100644
--- a/src/DotPulsar/Abstractions/IConsumerBuilder.cs
+++ b/src/DotPulsar/Abstractions/IConsumerBuilder.cs
@@ -12,61 +12,60 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+/// <summary>
+/// A consumer building abstraction.
+/// </summary>
+public interface IConsumerBuilder<TMessage>
 {
     /// <summary>
-    /// A consumer building abstraction.
+    /// Set the consumer name. This is optional.
     /// </summary>
-    public interface IConsumerBuilder<TMessage>
-    {
-        /// <summary>
-        /// Set the consumer name. This is optional.
-        /// </summary>
-        IConsumerBuilder<TMessage> ConsumerName(string name);
+    IConsumerBuilder<TMessage> ConsumerName(string name);
 
-        /// <summary>
-        /// Set initial position for the subscription. The default is 'Latest'.
-        /// </summary>
-        IConsumerBuilder<TMessage> InitialPosition(SubscriptionInitialPosition initialPosition);
+    /// <summary>
+    /// Set initial position for the subscription. The default is 'Latest'.
+    /// </summary>
+    IConsumerBuilder<TMessage> InitialPosition(SubscriptionInitialPosition initialPosition);
 
-        /// <summary>
-        /// Number of messages that will be prefetched. The default is 1000.
-        /// </summary>
-        IConsumerBuilder<TMessage> MessagePrefetchCount(uint count);
+    /// <summary>
+    /// Number of messages that will be prefetched. The default is 1000.
+    /// </summary>
+    IConsumerBuilder<TMessage> MessagePrefetchCount(uint count);
 
-        /// <summary>
-        /// Set the priority level for the shared subscription consumer. The default is 0.
-        /// </summary>
-        IConsumerBuilder<TMessage> PriorityLevel(int priorityLevel);
+    /// <summary>
+    /// Set the priority level for the shared subscription consumer. The default is 0.
+    /// </summary>
+    IConsumerBuilder<TMessage> PriorityLevel(int priorityLevel);
 
-        /// <summary>
-        /// Whether to read from the compacted topic. The default is 'false'.
-        /// </summary>
-        IConsumerBuilder<TMessage> ReadCompacted(bool readCompacted);
+    /// <summary>
+    /// Whether to read from the compacted topic. The default is 'false'.
+    /// </summary>
+    IConsumerBuilder<TMessage> ReadCompacted(bool readCompacted);
 
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        IConsumerBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ConsumerStateChanged> handler);
+    /// <summary>
+    /// Register a state changed handler.
+    /// </summary>
+    IConsumerBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ConsumerStateChanged> handler);
 
-        /// <summary>
-        /// Set the subscription name for this consumer. This is required.
-        /// </summary>
-        IConsumerBuilder<TMessage> SubscriptionName(string name);
+    /// <summary>
+    /// Set the subscription name for this consumer. This is required.
+    /// </summary>
+    IConsumerBuilder<TMessage> SubscriptionName(string name);
 
-        /// <summary>
-        /// Set the subscription type for this consumer. The default is 'Exclusive'.
-        /// </summary>
-        IConsumerBuilder<TMessage> SubscriptionType(SubscriptionType type);
+    /// <summary>
+    /// Set the subscription type for this consumer. The default is 'Exclusive'.
+    /// </summary>
+    IConsumerBuilder<TMessage> SubscriptionType(SubscriptionType type);
 
-        /// <summary>
-        /// Set the topic for this consumer. This is required.
-        /// </summary>
-        IConsumerBuilder<TMessage> Topic(string topic);
+    /// <summary>
+    /// Set the topic for this consumer. This is required.
+    /// </summary>
+    IConsumerBuilder<TMessage> Topic(string topic);
 
-        /// <summary>
-        /// Create the consumer.
-        /// </summary>
-        IConsumer<TMessage> Create();
-    }
+    /// <summary>
+    /// Create the consumer.
+    /// </summary>
+    IConsumer<TMessage> Create();
 }
diff --git a/src/DotPulsar/Abstractions/IConsumerOfT.cs b/src/DotPulsar/Abstractions/IConsumerOfT.cs
index 0affa98..613a154 100644
--- a/src/DotPulsar/Abstractions/IConsumerOfT.cs
+++ b/src/DotPulsar/Abstractions/IConsumerOfT.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
-{
-    /// <summary>
-    /// A generic consumer abstraction.
-    /// </summary>
-    public interface IConsumer<TMessage> : IConsumer, IReceive<IMessage<TMessage>> { }
-}
+namespace DotPulsar.Abstractions;
+
+/// <summary>
+/// A generic consumer abstraction.
+/// </summary>
+public interface IConsumer<TMessage> : IConsumer, IReceive<IMessage<TMessage>> { }
diff --git a/src/DotPulsar/Abstractions/IGetLastMessageId.cs b/src/DotPulsar/Abstractions/IGetLastMessageId.cs
index 0c3059a..5e68735 100644
--- a/src/DotPulsar/Abstractions/IGetLastMessageId.cs
+++ b/src/DotPulsar/Abstractions/IGetLastMessageId.cs
@@ -12,19 +12,18 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
-{
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Abstractions;
 
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// An abstraction for getting the last message id.
+/// </summary>
+public interface IGetLastMessageId
+{
     /// <summary>
-    /// An abstraction for getting the last message id.
+    /// Get the MessageId of the last message on the topic.
     /// </summary>
-    public interface IGetLastMessageId
-    {
-        /// <summary>
-        /// Get the MessageId of the last message on the topic.
-        /// </summary>
-        ValueTask<MessageId> GetLastMessageId(CancellationToken cancellationToken = default);
-    }
+    ValueTask<MessageId> GetLastMessageId(CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Abstractions/IHandleException.cs b/src/DotPulsar/Abstractions/IHandleException.cs
index f4acbcf..caa9941 100644
--- a/src/DotPulsar/Abstractions/IHandleException.cs
+++ b/src/DotPulsar/Abstractions/IHandleException.cs
@@ -12,18 +12,17 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
-{
-    using System.Threading.Tasks;
+namespace DotPulsar.Abstractions;
 
+using System.Threading.Tasks;
+
+/// <summary>
+/// An exception handling abstraction.
+/// </summary>
+public interface IHandleException
+{
     /// <summary>
-    /// An exception handling abstraction.
+    /// Called after an action has thrown an Exception.
     /// </summary>
-    public interface IHandleException
-    {
-        /// <summary>
-        /// Called after an action has thrown an Exception.
-        /// </summary>
-        ValueTask OnException(ExceptionContext exceptionContext);
-    }
+    ValueTask OnException(ExceptionContext exceptionContext);
 }
diff --git a/src/DotPulsar/Abstractions/IHandleStateChanged.cs b/src/DotPulsar/Abstractions/IHandleStateChanged.cs
index 8be3a99..0e016ab 100644
--- a/src/DotPulsar/Abstractions/IHandleStateChanged.cs
+++ b/src/DotPulsar/Abstractions/IHandleStateChanged.cs
@@ -12,24 +12,23 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// An state change handling abstraction.
+/// </summary>
+public interface IHandleStateChanged<TStateChanged>
 {
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Called after a state has changed.
+    /// </summary>
+    ValueTask OnStateChanged(TStateChanged stateChanged, CancellationToken cancellationToken = default);
 
     /// <summary>
-    /// An state change handling abstraction.
+    /// The cancellation token to use when waiting for and handling state changes.
     /// </summary>
-    public interface IHandleStateChanged<TStateChanged>
-    {
-        /// <summary>
-        /// Called after a state has changed.
-        /// </summary>
-        ValueTask OnStateChanged(TStateChanged stateChanged, CancellationToken cancellationToken = default);
-
-        /// <summary>
-        /// The cancellation token to use when waiting for and handling state changes.
-        /// </summary>
-        CancellationToken CancellationToken { get; }
-    }
+    CancellationToken CancellationToken { get; }
 }
diff --git a/src/DotPulsar/Abstractions/IMessage.cs b/src/DotPulsar/Abstractions/IMessage.cs
index c10204c..607e612 100644
--- a/src/DotPulsar/Abstractions/IMessage.cs
+++ b/src/DotPulsar/Abstractions/IMessage.cs
@@ -12,115 +12,114 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+
+/// <summary>
+/// A message abstraction.
+/// </summary>
+public interface IMessage
 {
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
+    /// <summary>
+    /// The id of the message.
+    /// </summary>
+    MessageId MessageId { get; }
 
     /// <summary>
-    /// A message abstraction.
+    /// The raw payload of the message.
     /// </summary>
-    public interface IMessage
-    {
-        /// <summary>
-        /// The id of the message.
-        /// </summary>
-        MessageId MessageId { get; }
+    ReadOnlySequence<byte> Data { get; }
 
-        /// <summary>
-        /// The raw payload of the message.
-        /// </summary>
-        ReadOnlySequence<byte> Data { get; }
+    /// <summary>
+    /// The name of the producer who produced the message.
+    /// </summary>
+    string ProducerName { get; }
 
-        /// <summary>
-        /// The name of the producer who produced the message.
-        /// </summary>
-        string ProducerName { get; }
+    /// <summary>
+    /// The schema version of the message.
+    /// </summary>
+    byte[]? SchemaVersion { get; }
 
-        /// <summary>
-        /// The schema version of the message.
-        /// </summary>
-        byte[]? SchemaVersion { get; }
+    /// <summary>
+    /// The sequence id of the message.
+    /// </summary>
+    ulong SequenceId { get; }
 
-        /// <summary>
-        /// The sequence id of the message.
-        /// </summary>
-        ulong SequenceId { get; }
+    /// <summary>
+    /// The redelivery count (maintained by the broker) of the message.
+    /// </summary>
+    uint RedeliveryCount { get; }
 
-        /// <summary>
-        /// The redelivery count (maintained by the broker) of the message.
-        /// </summary>
-        uint RedeliveryCount { get; }
+    /// <summary>
+    /// Check whether the message has an event time.
+    /// </summary>
+    bool HasEventTime { get; }
 
-        /// <summary>
-        /// Check whether the message has an event time.
-        /// </summary>
-        bool HasEventTime { get; }
+    /// <summary>
+    /// The event time of the message as unix time in milliseconds.
+    /// </summary>
+    ulong EventTime { get; }
 
-        /// <summary>
-        /// The event time of the message as unix time in milliseconds.
-        /// </summary>
-        ulong EventTime { get; }
+    /// <summary>
+    /// The event time of the message as an UTC DateTime.
+    /// </summary>
+    public DateTime EventTimeAsDateTime { get; }
 
-        /// <summary>
-        /// The event time of the message as an UTC DateTime.
-        /// </summary>
-        public DateTime EventTimeAsDateTime { get; }
+    /// <summary>
+    /// The event time of the message as a DateTimeOffset with an offset of 0.
+    /// </summary>
+    public DateTimeOffset EventTimeAsDateTimeOffset { get; }
 
-        /// <summary>
-        /// The event time of the message as a DateTimeOffset with an offset of 0.
-        /// </summary>
-        public DateTimeOffset EventTimeAsDateTimeOffset { get; }
+    /// <summary>
+    /// Check whether the key been base64 encoded.
+    /// </summary>
+    bool HasBase64EncodedKey { get; }
 
-        /// <summary>
-        /// Check whether the key been base64 encoded.
-        /// </summary>
-        bool HasBase64EncodedKey { get; }
+    /// <summary>
+    /// Check whether the message has a key.
+    /// </summary>
+    bool HasKey { get; }
 
-        /// <summary>
-        /// Check whether the message has a key.
-        /// </summary>
-        bool HasKey { get; }
+    /// <summary>
+    /// The key as a string.
+    /// </summary>
+    string? Key { get; }
 
-        /// <summary>
-        /// The key as a string.
-        /// </summary>
-        string? Key { get; }
+    /// <summary>
+    /// The key as bytes.
+    /// </summary>
+    byte[]? KeyBytes { get; }
 
-        /// <summary>
-        /// The key as bytes.
-        /// </summary>
-        byte[]? KeyBytes { get; }
+    /// <summary>
+    /// Check whether the message has an ordering key.
+    /// </summary>
+    bool HasOrderingKey { get; }
 
-        /// <summary>
-        /// Check whether the message has an ordering key.
-        /// </summary>
-        bool HasOrderingKey { get; }
+    /// <summary>
+    /// The ordering key of the message.
+    /// </summary>
+    byte[]? OrderingKey { get; }
 
-        /// <summary>
-        /// The ordering key of the message.
-        /// </summary>
-        byte[]? OrderingKey { get; }
+    /// <summary>
+    /// The publish time of the message as unix time in milliseconds.
+    /// </summary>
+    ulong PublishTime { get; }
 
-        /// <summary>
-        /// The publish time of the message as unix time in milliseconds.
-        /// </summary>
-        ulong PublishTime { get; }
+    /// <summary>
+    /// The publish time of the message as an UTC DateTime.
+    /// </summary>
+    public DateTime PublishTimeAsDateTime { get; }
 
-        /// <summary>
-        /// The publish time of the message as an UTC DateTime.
-        /// </summary>
-        public DateTime PublishTimeAsDateTime { get; }
+    /// <summary>
+    /// The publish time of the message as a DateTimeOffset with an offset of 0.
+    /// </summary>
+    public DateTimeOffset PublishTimeAsDateTimeOffset { get; }
 
-        /// <summary>
-        /// The publish time of the message as a DateTimeOffset with an offset of 0.
-        /// </summary>
-        public DateTimeOffset PublishTimeAsDateTimeOffset { get; }
-
-        /// <summary>
-        /// The properties of the message.
-        /// </summary>
-        public IReadOnlyDictionary<string, string> Properties { get; }
-    }
+    /// <summary>
+    /// The properties of the message.
+    /// </summary>
+    public IReadOnlyDictionary<string, string> Properties { get; }
 }
diff --git a/src/DotPulsar/Abstractions/IMessageBuilder.cs b/src/DotPulsar/Abstractions/IMessageBuilder.cs
index 32c9d94..d59e8be 100644
--- a/src/DotPulsar/Abstractions/IMessageBuilder.cs
+++ b/src/DotPulsar/Abstractions/IMessageBuilder.cs
@@ -12,81 +12,80 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// A message building abstraction.
+/// </summary>
+public interface IMessageBuilder<TMessage>
 {
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Timestamp as unix time in milliseconds indicating when the message should be delivered to consumers.
+    /// </summary>
+    IMessageBuilder<TMessage> DeliverAt(long timestamp);
 
     /// <summary>
-    /// A message building abstraction.
+    /// Timestamp as UTC DateTime indicating when the message should be delivered to consumers.
     /// </summary>
-    public interface IMessageBuilder<TMessage>
-    {
-        /// <summary>
-        /// Timestamp as unix time in milliseconds indicating when the message should be delivered to consumers.
-        /// </summary>
-        IMessageBuilder<TMessage> DeliverAt(long timestamp);
+    IMessageBuilder<TMessage> DeliverAt(DateTime timestamp);
 
-        /// <summary>
-        /// Timestamp as UTC DateTime indicating when the message should be delivered to consumers.
-        /// </summary>
-        IMessageBuilder<TMessage> DeliverAt(DateTime timestamp);
+    /// <summary>
+    /// Timestamp as DateTimeOffset indicating when the message should be delivered to consumers.
+    /// </summary>
+    IMessageBuilder<TMessage> DeliverAt(DateTimeOffset timestamp);
 
-        /// <summary>
-        /// Timestamp as DateTimeOffset indicating when the message should be delivered to consumers.
-        /// </summary>
-        IMessageBuilder<TMessage> DeliverAt(DateTimeOffset timestamp);
+    /// <summary>
+    /// The event time of the message as unix time in milliseconds.
+    /// </summary>
+    IMessageBuilder<TMessage> EventTime(ulong eventTime);
 
-        /// <summary>
-        /// The event time of the message as unix time in milliseconds.
-        /// </summary>
-        IMessageBuilder<TMessage> EventTime(ulong eventTime);
+    /// <summary>
+    /// The event time of the message as an UTC DateTime.
+    /// </summary>
+    IMessageBuilder<TMessage> EventTime(DateTime eventTime);
 
-        /// <summary>
-        /// The event time of the message as an UTC DateTime.
-        /// </summary>
-        IMessageBuilder<TMessage> EventTime(DateTime eventTime);
+    /// <summary>
+    /// The event time of the message as a DateTimeOffset.
+    /// </summary>
+    IMessageBuilder<TMessage> EventTime(DateTimeOffset eventTime);
 
-        /// <summary>
-        /// The event time of the message as a DateTimeOffset.
-        /// </summary>
-        IMessageBuilder<TMessage> EventTime(DateTimeOffset eventTime);
+    /// <summary>
+    /// Set the key of the message for routing policy.
+    /// </summary>
+    IMessageBuilder<TMessage> Key(string key);
 
-        /// <summary>
-        /// Set the key of the message for routing policy.
-        /// </summary>
-        IMessageBuilder<TMessage> Key(string key);
+    /// <summary>
+    /// Set the key of the message for routing policy.
+    /// </summary>
+    IMessageBuilder<TMessage> KeyBytes(byte[] key);
 
-        /// <summary>
-        /// Set the key of the message for routing policy.
-        /// </summary>
-        IMessageBuilder<TMessage> KeyBytes(byte[] key);
+    /// <summary>
+    /// Set the ordering key of the message for message dispatch in SubscriptionType.KeyShared mode.
+    /// The partition key will be used if the ordering key is not specified.
+    /// </summary>
+    IMessageBuilder<TMessage> OrderingKey(byte[] key);
 
-        /// <summary>
-        /// Set the ordering key of the message for message dispatch in SubscriptionType.KeyShared mode.
-        /// The partition key will be used if the ordering key is not specified.
-        /// </summary>
-        IMessageBuilder<TMessage> OrderingKey(byte[] key);
+    /// <summary>
+    /// Add/Set a property key/value on the message.
+    /// </summary>
+    IMessageBuilder<TMessage> Property(string key, string value);
 
-        /// <summary>
-        /// Add/Set a property key/value on the message.
-        /// </summary>
-        IMessageBuilder<TMessage> Property(string key, string value);
+    /// <summary>
+    /// Set the schema version of the message.
+    /// </summary>
+    IMessageBuilder<TMessage> SchemaVersion(byte[] schemaVersion);
 
-        /// <summary>
-        /// Set the schema version of the message.
-        /// </summary>
-        IMessageBuilder<TMessage> SchemaVersion(byte[] schemaVersion);
+    /// <summary>
+    /// Set the sequence id of the message.
+    /// </summary>
+    IMessageBuilder<TMessage> SequenceId(ulong sequenceId);
 
-        /// <summary>
-        /// Set the sequence id of the message.
-        /// </summary>
-        IMessageBuilder<TMessage> SequenceId(ulong sequenceId);
-
-        /// <summary>
-        /// Sends a message.
-        /// </summary>
-        ValueTask<MessageId> Send(TMessage message, CancellationToken cancellationToken = default);
-    }
+    /// <summary>
+    /// Sends a message.
+    /// </summary>
+    ValueTask<MessageId> Send(TMessage message, CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Abstractions/IMessageOfT.cs b/src/DotPulsar/Abstractions/IMessageOfT.cs
index 792791f..8d4303e 100644
--- a/src/DotPulsar/Abstractions/IMessageOfT.cs
+++ b/src/DotPulsar/Abstractions/IMessageOfT.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+/// <summary>
+/// A generic message abstraction.
+/// </summary>
+public interface IMessage<TValue> : IMessage
 {
     /// <summary>
-    /// A generic message abstraction.
+    /// The value of the message.
     /// </summary>
-    public interface IMessage<TValue> : IMessage
-    {
-        /// <summary>
-        /// The value of the message.
-        /// </summary>
-        public TValue Value();
-    }
+    public TValue Value();
 }
diff --git a/src/DotPulsar/Abstractions/IMessageRouter.cs b/src/DotPulsar/Abstractions/IMessageRouter.cs
index d0d873c..d701c8b 100644
--- a/src/DotPulsar/Abstractions/IMessageRouter.cs
+++ b/src/DotPulsar/Abstractions/IMessageRouter.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+/// <summary>
+/// A message routing abstraction
+/// </summary>
+public interface IMessageRouter
 {
     /// <summary>
-    /// A message routing abstraction
+    /// Choose a partition.
     /// </summary>
-    public interface IMessageRouter
-    {
-        /// <summary>
-        /// Choose a partition.
-        /// </summary>
-        int ChoosePartition(MessageMetadata messageMetadata, int numberOfPartitions);
-    }
+    int ChoosePartition(MessageMetadata messageMetadata, int numberOfPartitions);
 }
diff --git a/src/DotPulsar/Abstractions/IProducer.cs b/src/DotPulsar/Abstractions/IProducer.cs
index ac13630..e492f06 100644
--- a/src/DotPulsar/Abstractions/IProducer.cs
+++ b/src/DotPulsar/Abstractions/IProducer.cs
@@ -12,23 +12,22 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System;
+
+/// <summary>
+/// A producer abstraction.
+/// </summary>
+public interface IProducer : IState<ProducerState>, IAsyncDisposable
 {
-    using System;
+    /// <summary>
+    /// The producer's service url.
+    /// </summary>
+    public Uri ServiceUrl { get; }
 
     /// <summary>
-    /// A producer abstraction.
+    /// The producer's topic.
     /// </summary>
-    public interface IProducer : IState<ProducerState>, IAsyncDisposable
-    {
-        /// <summary>
-        /// The producer's service url.
-        /// </summary>
-        public Uri ServiceUrl { get; }
-
-        /// <summary>
-        /// The producer's topic.
-        /// </summary>
-        string Topic { get; }
-    }
+    string Topic { get; }
 }
diff --git a/src/DotPulsar/Abstractions/IProducerBuilder.cs b/src/DotPulsar/Abstractions/IProducerBuilder.cs
index 9650efa..6c27c80 100644
--- a/src/DotPulsar/Abstractions/IProducerBuilder.cs
+++ b/src/DotPulsar/Abstractions/IProducerBuilder.cs
@@ -12,46 +12,45 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+/// <summary>
+/// A producer building abstraction.
+/// </summary>
+public interface IProducerBuilder<TMessage>
 {
     /// <summary>
-    /// A producer building abstraction.
+    /// Set the compression type. The default is 'None'.
     /// </summary>
-    public interface IProducerBuilder<TMessage>
-    {
-        /// <summary>
-        /// Set the compression type. The default is 'None'.
-        /// </summary>
-        IProducerBuilder<TMessage> CompressionType(CompressionType compressionType);
+    IProducerBuilder<TMessage> CompressionType(CompressionType compressionType);
 
-        /// <summary>
-        /// Set the initial sequence id. The default is 0.
-        /// </summary>
-        IProducerBuilder<TMessage> InitialSequenceId(ulong initialSequenceId);
+    /// <summary>
+    /// Set the initial sequence id. The default is 0.
+    /// </summary>
+    IProducerBuilder<TMessage> InitialSequenceId(ulong initialSequenceId);
 
-        /// <summary>
-        /// Set the producer name. This is optional.
-        /// </summary>
-        IProducerBuilder<TMessage> ProducerName(string name);
+    /// <summary>
+    /// Set the producer name. This is optional.
+    /// </summary>
+    IProducerBuilder<TMessage> ProducerName(string name);
 
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        IProducerBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ProducerStateChanged> handler);
+    /// <summary>
+    /// Register a state changed handler.
+    /// </summary>
+    IProducerBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ProducerStateChanged> handler);
 
-        /// <summary>
-        /// Set the topic for this producer. This is required.
-        /// </summary>
-        IProducerBuilder<TMessage> Topic(string topic);
+    /// <summary>
+    /// Set the topic for this producer. This is required.
+    /// </summary>
+    IProducerBuilder<TMessage> Topic(string topic);
 
-        /// <summary>
-        /// Set the message router for this producer. The default is RoundRobinPartitionRouter.
-        /// </summary>
-        IProducerBuilder<TMessage> MessageRouter(IMessageRouter messageRouter);
+    /// <summary>
+    /// Set the message router for this producer. The default is RoundRobinPartitionRouter.
+    /// </summary>
+    IProducerBuilder<TMessage> MessageRouter(IMessageRouter messageRouter);
 
-        /// <summary>
-        /// Create the producer.
-        /// </summary>
-        IProducer<TMessage> Create();
-    }
+    /// <summary>
+    /// Create the producer.
+    /// </summary>
+    IProducer<TMessage> Create();
 }
diff --git a/src/DotPulsar/Abstractions/IProducerOfT.cs b/src/DotPulsar/Abstractions/IProducerOfT.cs
index da42458..811c066 100644
--- a/src/DotPulsar/Abstractions/IProducerOfT.cs
+++ b/src/DotPulsar/Abstractions/IProducerOfT.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
-{
-    /// <summary>
-    /// A generic producer abstraction.
-    /// </summary>
-    public interface IProducer<TMessage> : IProducer, ISend<TMessage> { }
-}
+namespace DotPulsar.Abstractions;
+
+/// <summary>
+/// A generic producer abstraction.
+/// </summary>
+public interface IProducer<TMessage> : IProducer, ISend<TMessage> { }
diff --git a/src/DotPulsar/Abstractions/IPulsarClient.cs b/src/DotPulsar/Abstractions/IPulsarClient.cs
index 64f6add..4a11f65 100644
--- a/src/DotPulsar/Abstractions/IPulsarClient.cs
+++ b/src/DotPulsar/Abstractions/IPulsarClient.cs
@@ -12,33 +12,32 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System;
+
+/// <summary>
+/// A pulsar client abstraction.
+/// </summary>
+public interface IPulsarClient : IAsyncDisposable
 {
-    using System;
+    /// <summary>
+    /// Create a producer.
+    /// </summary>
+    IProducer<TMessage> CreateProducer<TMessage>(ProducerOptions<TMessage> options);
 
     /// <summary>
-    /// A pulsar client abstraction.
+    /// Create a consumer.
     /// </summary>
-    public interface IPulsarClient : IAsyncDisposable
-    {
-        /// <summary>
-        /// Create a producer.
-        /// </summary>
-        IProducer<TMessage> CreateProducer<TMessage>(ProducerOptions<TMessage> options);
+    IConsumer<TMessage> CreateConsumer<TMessage>(ConsumerOptions<TMessage> options);
 
-        /// <summary>
-        /// Create a consumer.
-        /// </summary>
-        IConsumer<TMessage> CreateConsumer<TMessage>(ConsumerOptions<TMessage> options);
+    /// <summary>
+    /// Create a reader.
+    /// </summary>
+    IReader<TMessage> CreateReader<TMessage>(ReaderOptions<TMessage> options);
 
-        /// <summary>
-        /// Create a reader.
-        /// </summary>
-        IReader<TMessage> CreateReader<TMessage>(ReaderOptions<TMessage> options);
-
-        /// <summary>
-        /// The client's service url.
-        /// </summary>
-        public Uri ServiceUrl { get; }
-    }
+    /// <summary>
+    /// The client's service url.
+    /// </summary>
+    public Uri ServiceUrl { get; }
 }
diff --git a/src/DotPulsar/Abstractions/IPulsarClientBuilder.cs b/src/DotPulsar/Abstractions/IPulsarClientBuilder.cs
index cc0db11..7ef079e 100644
--- a/src/DotPulsar/Abstractions/IPulsarClientBuilder.cs
+++ b/src/DotPulsar/Abstractions/IPulsarClientBuilder.cs
@@ -12,79 +12,78 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System;
+using System.Security.Cryptography.X509Certificates;
+
+/// <summary>
+/// A pulsar client building abstraction.
+/// </summary>
+public interface IPulsarClientBuilder
 {
-    using System;
-    using System.Security.Cryptography.X509Certificates;
+    /// <summary>
+    /// Authenticate using a client certificate. This is optional.
+    /// </summary>
+    IPulsarClientBuilder AuthenticateUsingClientCertificate(X509Certificate2 clientCertificate);
 
     /// <summary>
-    /// A pulsar client building abstraction.
+    /// Authenticate using a (JSON Web) token. This is optional.
     /// </summary>
-    public interface IPulsarClientBuilder
-    {
-        /// <summary>
-        /// Authenticate using a client certificate. This is optional.
-        /// </summary>
-        IPulsarClientBuilder AuthenticateUsingClientCertificate(X509Certificate2 clientCertificate);
+    IPulsarClientBuilder AuthenticateUsingToken(string token);
 
-        /// <summary>
-        /// Authenticate using a (JSON Web) token. This is optional.
-        /// </summary>
-        IPulsarClientBuilder AuthenticateUsingToken(string token);
+    /// <summary>
+    /// Set connection encryption policy. The default is 'EnforceUnencrypted' if the ServiceUrl scheme is 'pulsar' and 'EnforceEncrypted' if it's 'pulsar+ssl'.
+    /// </summary>
+    IPulsarClientBuilder ConnectionSecurity(EncryptionPolicy encryptionPolicy);
 
-        /// <summary>
-        /// Set connection encryption policy. The default is 'EnforceUnencrypted' if the ServiceUrl scheme is 'pulsar' and 'EnforceEncrypted' if it's 'pulsar+ssl'.
-        /// </summary>
-        IPulsarClientBuilder ConnectionSecurity(EncryptionPolicy encryptionPolicy);
+    /// <summary>
+    /// Register a custom exception handler that will be invoked before the default exception handler.
+    /// </summary>
+    IPulsarClientBuilder ExceptionHandler(IHandleException exceptionHandler);
 
-        /// <summary>
-        /// Register a custom exception handler that will be invoked before the default exception handler.
-        /// </summary>
-        IPulsarClientBuilder ExceptionHandler(IHandleException exceptionHandler);
+    /// <summary>
+    /// The time to wait before sending a 'ping' if there has been no activity on the connection. The default is 30 seconds.
+    /// </summary>
+    IPulsarClientBuilder KeepAliveInterval(TimeSpan interval);
 
-        /// <summary>
-        /// The time to wait before sending a 'ping' if there has been no activity on the connection. The default is 30 seconds.
-        /// </summary>
-        IPulsarClientBuilder KeepAliveInterval(TimeSpan interval);
+    /// <summary>
+    /// Set the listener name. This is optional.
+    /// </summary>
+    IPulsarClientBuilder ListenerName(string listenerName);
 
-        /// <summary>
-        /// Set the listener name. This is optional.
-        /// </summary>
-        IPulsarClientBuilder ListenerName(string listenerName);
+    /// <summary>
+    /// The time to wait before retrying an operation or a reconnect. The default is 3 seconds.
+    /// </summary>
+    IPulsarClientBuilder RetryInterval(TimeSpan interval);
 
-        /// <summary>
-        /// The time to wait before retrying an operation or a reconnect. The default is 3 seconds.
-        /// </summary>
-        IPulsarClientBuilder RetryInterval(TimeSpan interval);
+    /// <summary>
+    /// The service URL for the Pulsar cluster. The default is "pulsar://localhost:6650".
+    /// </summary>
+    IPulsarClientBuilder ServiceUrl(Uri uri);
 
-        /// <summary>
-        /// The service URL for the Pulsar cluster. The default is "pulsar://localhost:6650".
-        /// </summary>
-        IPulsarClientBuilder ServiceUrl(Uri uri);
+    /// <summary>
+    /// Add a trusted certificate authority. This is optional.
+    /// </summary>
+    IPulsarClientBuilder TrustedCertificateAuthority(X509Certificate2 trustedCertificateAuthority);
 
-        /// <summary>
-        /// Add a trusted certificate authority. This is optional.
-        /// </summary>
-        IPulsarClientBuilder TrustedCertificateAuthority(X509Certificate2 trustedCertificateAuthority);
+    /// <summary>
+    /// Verify the certificate authority. The default is 'true'.
+    /// </summary>
+    IPulsarClientBuilder VerifyCertificateAuthority(bool verifyCertificateAuthority);
 
-        /// <summary>
-        /// Verify the certificate authority. The default is 'true'.
-        /// </summary>
-        IPulsarClientBuilder VerifyCertificateAuthority(bool verifyCertificateAuthority);
+    /// <summary>
+    /// Verify the certificate name with the hostname. The default is 'false'.
+    /// </summary>
+    IPulsarClientBuilder VerifyCertificateName(bool verifyCertificateName);
 
-        /// <summary>
-        /// Verify the certificate name with the hostname. The default is 'false'.
-        /// </summary>
-        IPulsarClientBuilder VerifyCertificateName(bool verifyCertificateName);
+    /// <summary>
+    /// The time to wait before checking for inactive connections that can be closed. The default is 60 seconds.
+    /// </summary>
+    IPulsarClientBuilder CloseInactiveConnectionsInterval(TimeSpan interval);
 
-        /// <summary>
-        /// The time to wait before checking for inactive connections that can be closed. The default is 60 seconds.
-        /// </summary>
-        IPulsarClientBuilder CloseInactiveConnectionsInterval(TimeSpan interval);
-
-        /// <summary>
-        /// Create the client.
-        /// </summary>
-        IPulsarClient Build();
-    }
+    /// <summary>
+    /// Create the client.
+    /// </summary>
+    IPulsarClient Build();
 }
diff --git a/src/DotPulsar/Abstractions/IReader.cs b/src/DotPulsar/Abstractions/IReader.cs
index 3e438ac..a81bca7 100644
--- a/src/DotPulsar/Abstractions/IReader.cs
+++ b/src/DotPulsar/Abstractions/IReader.cs
@@ -12,23 +12,22 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System;
+
+/// <summary>
+/// A reader abstraction.
+/// </summary>
+public interface IReader : IGetLastMessageId, ISeek, IState<ReaderState>, IAsyncDisposable
 {
-    using System;
+    /// <summary>
+    /// The reader's service url.
+    /// </summary>
+    public Uri ServiceUrl { get; }
 
     /// <summary>
-    /// A reader abstraction.
+    /// The reader's topic.
     /// </summary>
-    public interface IReader : IGetLastMessageId, ISeek, IState<ReaderState>, IAsyncDisposable
-    {
-        /// <summary>
-        /// The reader's service url.
-        /// </summary>
-        public Uri ServiceUrl { get; }
-
-        /// <summary>
-        /// The reader's topic.
-        /// </summary>
-        string Topic { get; }
-    }
+    string Topic { get; }
 }
diff --git a/src/DotPulsar/Abstractions/IReaderBuilder.cs b/src/DotPulsar/Abstractions/IReaderBuilder.cs
index 18235a6..184c4b0 100644
--- a/src/DotPulsar/Abstractions/IReaderBuilder.cs
+++ b/src/DotPulsar/Abstractions/IReaderBuilder.cs
@@ -12,46 +12,45 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+/// <summary>
+/// A reader building abstraction.
+/// </summary>
+public interface IReaderBuilder<TMessage>
 {
     /// <summary>
-    /// A reader building abstraction.
+    /// Number of messages that will be prefetched. The default is 1000.
     /// </summary>
-    public interface IReaderBuilder<TMessage>
-    {
-        /// <summary>
-        /// Number of messages that will be prefetched. The default is 1000.
-        /// </summary>
-        IReaderBuilder<TMessage> MessagePrefetchCount(uint count);
+    IReaderBuilder<TMessage> MessagePrefetchCount(uint count);
 
-        /// <summary>
-        /// Whether to read from the compacted topic. The default is 'false'.
-        /// </summary>
-        IReaderBuilder<TMessage> ReadCompacted(bool readCompacted);
+    /// <summary>
+    /// Whether to read from the compacted topic. The default is 'false'.
+    /// </summary>
+    IReaderBuilder<TMessage> ReadCompacted(bool readCompacted);
 
-        /// <summary>
-        /// Set the reader name. This is optional.
-        /// </summary>
-        IReaderBuilder<TMessage> ReaderName(string name);
+    /// <summary>
+    /// Set the reader name. This is optional.
+    /// </summary>
+    IReaderBuilder<TMessage> ReaderName(string name);
 
-        /// <summary>
-        /// The initial reader position is set to the specified message id. This is required.
-        /// </summary>
-        IReaderBuilder<TMessage> StartMessageId(MessageId messageId);
+    /// <summary>
+    /// The initial reader position is set to the specified message id. This is required.
+    /// </summary>
+    IReaderBuilder<TMessage> StartMessageId(MessageId messageId);
 
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        IReaderBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ReaderStateChanged> handler);
+    /// <summary>
+    /// Register a state changed handler.
+    /// </summary>
+    IReaderBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ReaderStateChanged> handler);
 
-        /// <summary>
-        /// Set the topic for this reader. This is required.
-        /// </summary>
-        IReaderBuilder<TMessage> Topic(string topic);
+    /// <summary>
+    /// Set the topic for this reader. This is required.
+    /// </summary>
+    IReaderBuilder<TMessage> Topic(string topic);
 
-        /// <summary>
-        /// Create the reader.
-        /// </summary>
-        IReader<TMessage> Create();
-    }
+    /// <summary>
+    /// Create the reader.
+    /// </summary>
+    IReader<TMessage> Create();
 }
diff --git a/src/DotPulsar/Abstractions/IReaderOfT.cs b/src/DotPulsar/Abstractions/IReaderOfT.cs
index 35f26c9..51c3236 100644
--- a/src/DotPulsar/Abstractions/IReaderOfT.cs
+++ b/src/DotPulsar/Abstractions/IReaderOfT.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
-{
-    /// <summary>
-    /// A generic reader abstraction.
-    /// </summary>
-    public interface IReader<TMessage> : IReader, IReceive<IMessage<TMessage>> { }
-}
+namespace DotPulsar.Abstractions;
+
+/// <summary>
+/// A generic reader abstraction.
+/// </summary>
+public interface IReader<TMessage> : IReader, IReceive<IMessage<TMessage>> { }
diff --git a/src/DotPulsar/Abstractions/IReceive.cs b/src/DotPulsar/Abstractions/IReceive.cs
index 994638a..9cac60d 100644
--- a/src/DotPulsar/Abstractions/IReceive.cs
+++ b/src/DotPulsar/Abstractions/IReceive.cs
@@ -12,19 +12,18 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
-{
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Abstractions;
 
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// An abstraction for receiving a single message.
+/// </summary>
+public interface IReceive<TMessage>
+{
     /// <summary>
-    /// An abstraction for receiving a single message.
+    /// Receive a single message.
     /// </summary>
-    public interface IReceive<TMessage>
-    {
-        /// <summary>
-        /// Receive a single message.
-        /// </summary>
-        ValueTask<TMessage> Receive(CancellationToken cancellationToken = default);
-    }
+    ValueTask<TMessage> Receive(CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Abstractions/ISchema.cs b/src/DotPulsar/Abstractions/ISchema.cs
index 698cad7..0fda8a4 100644
--- a/src/DotPulsar/Abstractions/ISchema.cs
+++ b/src/DotPulsar/Abstractions/ISchema.cs
@@ -12,28 +12,27 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System.Buffers;
+
+/// <summary>
+/// A schema abstraction.
+/// </summary>
+public interface ISchema<T>
 {
-    using System.Buffers;
+    /// <summary>
+    /// Decode the raw bytes.
+    /// </summary>
+    public T Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null);
 
     /// <summary>
-    /// A schema abstraction.
+    /// Encode the message.
     /// </summary>
-    public interface ISchema<T>
-    {
-        /// <summary>
-        /// Decode the raw bytes.
-        /// </summary>
-        public T Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null);
+    public ReadOnlySequence<byte> Encode(T message);
 
-        /// <summary>
-        /// Encode the message.
-        /// </summary>
-        public ReadOnlySequence<byte> Encode(T message);
-
-        /// <summary>
-        /// The schema info.
-        /// </summary>
-        public SchemaInfo SchemaInfo { get; }
-    }
+    /// <summary>
+    /// The schema info.
+    /// </summary>
+    public SchemaInfo SchemaInfo { get; }
 }
diff --git a/src/DotPulsar/Abstractions/ISeek.cs b/src/DotPulsar/Abstractions/ISeek.cs
index 373c619..9079dc2 100644
--- a/src/DotPulsar/Abstractions/ISeek.cs
+++ b/src/DotPulsar/Abstractions/ISeek.cs
@@ -12,24 +12,23 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// An abstraction for seeking.
+/// </summary>
+public interface ISeek
 {
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Reset the cursor associated with the consumer or reader to a specific MessageId.
+    /// </summary>
+    ValueTask Seek(MessageId messageId, CancellationToken cancellationToken = default);
 
     /// <summary>
-    /// An abstraction for seeking.
+    /// Reset the cursor associated with the consumer or reader to a specific message publish time using unix time in milliseconds.
     /// </summary>
-    public interface ISeek
-    {
-        /// <summary>
-        /// Reset the cursor associated with the consumer or reader to a specific MessageId.
-        /// </summary>
-        ValueTask Seek(MessageId messageId, CancellationToken cancellationToken = default);
-
-        /// <summary>
-        /// Reset the cursor associated with the consumer or reader to a specific message publish time using unix time in milliseconds.
-        /// </summary>
-        ValueTask Seek(ulong publishTime, CancellationToken cancellationToken = default);
-    }
+    ValueTask Seek(ulong publishTime, CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Abstractions/ISend.cs b/src/DotPulsar/Abstractions/ISend.cs
index affe029..2f51c29 100644
--- a/src/DotPulsar/Abstractions/ISend.cs
+++ b/src/DotPulsar/Abstractions/ISend.cs
@@ -12,19 +12,18 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
-{
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Abstractions;
 
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// An abstraction for sending a message.
+/// </summary>
+public interface ISend<TMessage>
+{
     /// <summary>
-    /// An abstraction for sending a message.
+    /// Sends a message with metadata.
     /// </summary>
-    public interface ISend<TMessage>
-    {
-        /// <summary>
-        /// Sends a message with metadata.
-        /// </summary>
-        ValueTask<MessageId> Send(MessageMetadata metadata, TMessage message, CancellationToken cancellationToken = default);
-    }
+    ValueTask<MessageId> Send(MessageMetadata metadata, TMessage message, CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Abstractions/IState.cs b/src/DotPulsar/Abstractions/IState.cs
index 48a975e..615fe2d 100644
--- a/src/DotPulsar/Abstractions/IState.cs
+++ b/src/DotPulsar/Abstractions/IState.cs
@@ -12,52 +12,51 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Abstractions
+namespace DotPulsar.Abstractions;
+
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// A state change monitoring abstraction.
+/// </summary>
+public interface IState<TState> where TState : notnull
 {
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Ask whether the current state is final, meaning that it will never change.
+    /// </summary>
+    /// <returns>
+    /// True if it's final and False if it's not.
+    /// </returns>
+    bool IsFinalState();
 
     /// <summary>
-    /// A state change monitoring abstraction.
+    /// Ask whether the provided state is final, meaning that it will never change.
     /// </summary>
-    public interface IState<TState> where TState : notnull
-    {
-        /// <summary>
-        /// Ask whether the current state is final, meaning that it will never change.
-        /// </summary>
-        /// <returns>
-        /// True if it's final and False if it's not.
-        /// </returns>
-        bool IsFinalState();
+    /// <returns>
+    /// True if it's final and False if it's not.
+    /// </returns>
+    bool IsFinalState(TState state);
 
-        /// <summary>
-        /// Ask whether the provided state is final, meaning that it will never change.
-        /// </summary>
-        /// <returns>
-        /// True if it's final and False if it's not.
-        /// </returns>
-        bool IsFinalState(TState state);
+    /// <summary>
+    /// Wait for the state to change to a specific state.
+    /// </summary>
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    ValueTask<TState> OnStateChangeTo(TState state, CancellationToken cancellationToken = default);
 
-        /// <summary>
-        /// Wait for the state to change to a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        ValueTask<TState> OnStateChangeTo(TState state, CancellationToken cancellationToken = default);
-
-        /// <summary>
-        /// Wait for the state to change from a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        ValueTask<TState> OnStateChangeFrom(TState state, CancellationToken cancellationToken = default);
-    }
+    /// <summary>
+    /// Wait for the state to change from a specific state.
+    /// </summary>
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    ValueTask<TState> OnStateChangeFrom(TState state, CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/CompressionType.cs b/src/DotPulsar/CompressionType.cs
index 2e55628..a31a553 100644
--- a/src/DotPulsar/CompressionType.cs
+++ b/src/DotPulsar/CompressionType.cs
@@ -12,36 +12,35 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// The compression types that can be set on a producer.
+/// </summary>
+public enum CompressionType : byte
 {
     /// <summary>
-    /// The compression types that can be set on a producer.
+    /// No compression.
     /// </summary>
-    public enum CompressionType : byte
-    {
-        /// <summary>
-        /// No compression.
-        /// </summary>
-        None = 0,
+    None = 0,
 
-        /// <summary>
-        /// Compress with LZ4.
-        /// </summary>
-        Lz4 = 1,
+    /// <summary>
+    /// Compress with LZ4.
+    /// </summary>
+    Lz4 = 1,
 
-        /// <summary>
-        /// Compress with zlib.
-        /// </summary>
-        Zlib = 2,
+    /// <summary>
+    /// Compress with zlib.
+    /// </summary>
+    Zlib = 2,
 
-        /// <summary>
-        /// Compress with zstd.
-        /// </summary>
-        Zstd = 3,
+    /// <summary>
+    /// Compress with zstd.
+    /// </summary>
+    Zstd = 3,
 
-        /// <summary>
-        /// Compress with Snappy.
-        /// </summary>
-        Snappy = 4
-    }
+    /// <summary>
+    /// Compress with Snappy.
+    /// </summary>
+    Snappy = 4
 }
diff --git a/src/DotPulsar/ConsumerOptions.cs b/src/DotPulsar/ConsumerOptions.cs
index 754f73a..4b30972 100644
--- a/src/DotPulsar/ConsumerOptions.cs
+++ b/src/DotPulsar/ConsumerOptions.cs
@@ -12,103 +12,102 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using DotPulsar.Abstractions;
+
+/// <summary>
+/// The consumer building options.
+/// </summary>
+public sealed class ConsumerOptions<TMessage>
 {
-    using DotPulsar.Abstractions;
+    /// <summary>
+    /// The default initial position.
+    /// </summary>
+    public static readonly SubscriptionInitialPosition DefaultInitialPosition = SubscriptionInitialPosition.Latest;
 
     /// <summary>
-    /// The consumer building options.
+    /// The default message prefetch count.
     /// </summary>
-    public sealed class ConsumerOptions<TMessage>
+    public static readonly uint DefaultMessagePrefetchCount = 1000;
+
+    /// <summary>
+    /// The default priority level.
+    /// </summary>
+    public static readonly int DefaultPriorityLevel = 0;
+
+    /// <summary>
+    /// The default of whether to read compacted.
+    /// </summary>
+    public static readonly bool DefaultReadCompacted = false;
+
+    /// <summary>
+    /// The default subscription type.
+    /// </summary>
+    public static readonly SubscriptionType DefaultSubscriptionType = SubscriptionType.Exclusive;
+
+    /// <summary>
+    /// Initializes a new instance using the specified subscription name and topic.
+    /// </summary>
+    public ConsumerOptions(string subscriptionName, string topic, ISchema<TMessage> schema)
     {
-        /// <summary>
-        /// The default initial position.
-        /// </summary>
-        public static readonly SubscriptionInitialPosition DefaultInitialPosition = SubscriptionInitialPosition.Latest;
-
-        /// <summary>
-        /// The default message prefetch count.
-        /// </summary>
-        public static readonly uint DefaultMessagePrefetchCount = 1000;
-
-        /// <summary>
-        /// The default priority level.
-        /// </summary>
-        public static readonly int DefaultPriorityLevel = 0;
-
-        /// <summary>
-        /// The default of whether to read compacted.
-        /// </summary>
-        public static readonly bool DefaultReadCompacted = false;
-
-        /// <summary>
-        /// The default subscription type.
-        /// </summary>
-        public static readonly SubscriptionType DefaultSubscriptionType = SubscriptionType.Exclusive;
-
-        /// <summary>
-        /// Initializes a new instance using the specified subscription name and topic.
-        /// </summary>
-        public ConsumerOptions(string subscriptionName, string topic, ISchema<TMessage> schema)
-        {
-            InitialPosition = DefaultInitialPosition;
-            PriorityLevel = DefaultPriorityLevel;
-            MessagePrefetchCount = DefaultMessagePrefetchCount;
-            ReadCompacted = DefaultReadCompacted;
-            SubscriptionType = DefaultSubscriptionType;
-            SubscriptionName = subscriptionName;
-            Topic = topic;
-            Schema = schema;
-        }
-
-        /// <summary>
-        /// Set the consumer name. This is optional.
-        /// </summary>
-        public string? ConsumerName { get; set; }
-
-        /// <summary>
-        /// Set initial position for the subscription. The default is 'Latest'.
-        /// </summary>
-        public SubscriptionInitialPosition InitialPosition { get; set; }
-
-        /// <summary>
-        /// Number of messages that will be prefetched. The default is 1000.
-        /// </summary>
-        public uint MessagePrefetchCount { get; set; }
-
-        /// <summary>
-        /// Set the priority level for the shared subscription consumer. The default is 0.
-        /// </summary>
-        public int PriorityLevel { get; set; }
-
-        /// <summary>
-        /// Whether to read from the compacted topic. The default is 'false'.
-        /// </summary>
-        public bool ReadCompacted { get; set; }
-
-        /// <summary>
-        /// Set the schema. This is required.
-        /// </summary>
-        public ISchema<TMessage> Schema { get; set; }
-
-        /// <summary>
-        /// Register a state changed handler. This is optional.
-        /// </summary>
-        public IHandleStateChanged<ConsumerStateChanged>? StateChangedHandler { get; set; }
-
-        /// <summary>
-        /// Set the subscription name for this consumer. This is required.
-        /// </summary>
-        public string SubscriptionName { get; set; }
-
-        /// <summary>
-        /// Set the subscription type for this consumer. The default is 'Exclusive'.
-        /// </summary>
-        public SubscriptionType SubscriptionType { get; set; }
-
-        /// <summary>
-        /// Set the topic for this consumer. This is required.
-        /// </summary>
-        public string Topic { get; set; }
+        InitialPosition = DefaultInitialPosition;
+        PriorityLevel = DefaultPriorityLevel;
+        MessagePrefetchCount = DefaultMessagePrefetchCount;
+        ReadCompacted = DefaultReadCompacted;
+        SubscriptionType = DefaultSubscriptionType;
+        SubscriptionName = subscriptionName;
+        Topic = topic;
+        Schema = schema;
     }
+
+    /// <summary>
+    /// Set the consumer name. This is optional.
+    /// </summary>
+    public string? ConsumerName { get; set; }
+
+    /// <summary>
+    /// Set initial position for the subscription. The default is 'Latest'.
+    /// </summary>
+    public SubscriptionInitialPosition InitialPosition { get; set; }
+
+    /// <summary>
+    /// Number of messages that will be prefetched. The default is 1000.
+    /// </summary>
+    public uint MessagePrefetchCount { get; set; }
+
+    /// <summary>
+    /// Set the priority level for the shared subscription consumer. The default is 0.
+    /// </summary>
+    public int PriorityLevel { get; set; }
+
+    /// <summary>
+    /// Whether to read from the compacted topic. The default is 'false'.
+    /// </summary>
+    public bool ReadCompacted { get; set; }
+
+    /// <summary>
+    /// Set the schema. This is required.
+    /// </summary>
+    public ISchema<TMessage> Schema { get; set; }
+
+    /// <summary>
+    /// Register a state changed handler. This is optional.
+    /// </summary>
+    public IHandleStateChanged<ConsumerStateChanged>? StateChangedHandler { get; set; }
+
+    /// <summary>
+    /// Set the subscription name for this consumer. This is required.
+    /// </summary>
+    public string SubscriptionName { get; set; }
+
+    /// <summary>
+    /// Set the subscription type for this consumer. The default is 'Exclusive'.
+    /// </summary>
+    public SubscriptionType SubscriptionType { get; set; }
+
+    /// <summary>
+    /// Set the topic for this consumer. This is required.
+    /// </summary>
+    public string Topic { get; set; }
 }
diff --git a/src/DotPulsar/ConsumerState.cs b/src/DotPulsar/ConsumerState.cs
index 7c77164..d251e22 100644
--- a/src/DotPulsar/ConsumerState.cs
+++ b/src/DotPulsar/ConsumerState.cs
@@ -12,46 +12,45 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// The possible states a consumer can be in.
+/// </summary>
+public enum ConsumerState : byte
 {
     /// <summary>
-    /// The possible states a consumer can be in.
+    /// The consumer is connected and active. The subscription type is 'Failover' and this consumer is the active consumer.
     /// </summary>
-    public enum ConsumerState : byte
-    {
-        /// <summary>
-        /// The consumer is connected and active. The subscription type is 'Failover' and this consumer is the active consumer.
-        /// </summary>
-        Active,
+    Active,
 
-        /// <summary>
-        /// The consumer is closed. This is a final state.
-        /// </summary>
-        Closed,
+    /// <summary>
+    /// The consumer is closed. This is a final state.
+    /// </summary>
+    Closed,
 
-        /// <summary>
-        /// The consumer is disconnected.
-        /// </summary>
-        Disconnected,
+    /// <summary>
+    /// The consumer is disconnected.
+    /// </summary>
+    Disconnected,
 
-        /// <summary>
-        /// The consumer is faulted. This is a final state.
-        /// </summary>
-        Faulted,
+    /// <summary>
+    /// The consumer is faulted. This is a final state.
+    /// </summary>
+    Faulted,
 
-        /// <summary>
-        /// The consumer is connected and inactive. The subscription type is 'Failover' and this consumer is not the active consumer.
-        /// </summary>
-        Inactive,
+    /// <summary>
+    /// The consumer is connected and inactive. The subscription type is 'Failover' and this consumer is not the active consumer.
+    /// </summary>
+    Inactive,
 
-        /// <summary>
-        /// The consumer has reached the end of the topic. This is a final state.
-        /// </summary>
-        ReachedEndOfTopic,
+    /// <summary>
+    /// The consumer has reached the end of the topic. This is a final state.
+    /// </summary>
+    ReachedEndOfTopic,
 
-        /// <summary>
-        /// The consumer has unsubscribed. This is a final state.
-        /// </summary>
-        Unsubscribed
-    }
+    /// <summary>
+    /// The consumer has unsubscribed. This is a final state.
+    /// </summary>
+    Unsubscribed
 }
diff --git a/src/DotPulsar/ConsumerStateChanged.cs b/src/DotPulsar/ConsumerStateChanged.cs
index 8c78145..24f61ee 100644
--- a/src/DotPulsar/ConsumerStateChanged.cs
+++ b/src/DotPulsar/ConsumerStateChanged.cs
@@ -12,29 +12,28 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using Abstractions;
+
+/// <summary>
+/// Representation of a consumer state change.
+/// </summary>
+public sealed class ConsumerStateChanged
 {
-    using Abstractions;
+    internal ConsumerStateChanged(IConsumer consumer, ConsumerState consumerState)
+    {
+        Consumer = consumer;
+        ConsumerState = consumerState;
+    }
 
     /// <summary>
-    /// Representation of a consumer state change.
+    /// The consumer that changed state.
     /// </summary>
-    public sealed class ConsumerStateChanged
-    {
-        internal ConsumerStateChanged(IConsumer consumer, ConsumerState consumerState)
-        {
-            Consumer = consumer;
-            ConsumerState = consumerState;
-        }
+    public IConsumer Consumer { get; }
 
-        /// <summary>
-        /// The consumer that changed state.
-        /// </summary>
-        public IConsumer Consumer { get; }
-
-        /// <summary>
-        /// The state that it changed to.
-        /// </summary>
-        public ConsumerState ConsumerState { get; }
-    }
+    /// <summary>
+    /// The state that it changed to.
+    /// </summary>
+    public ConsumerState ConsumerState { get; }
 }
diff --git a/src/DotPulsar/DotPulsar.csproj b/src/DotPulsar/DotPulsar.csproj
index 82be6fa..706c096 100644
--- a/src/DotPulsar/DotPulsar.csproj
+++ b/src/DotPulsar/DotPulsar.csproj
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0</TargetFrameworks>
+    <TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
     <Version>1.1.2</Version>
     <AssemblyVersion>$(Version)</AssemblyVersion>
     <FileVersion>$(Version)</FileVersion>
diff --git a/src/DotPulsar/EncryptionPolicy.cs b/src/DotPulsar/EncryptionPolicy.cs
index c4d153a..3cfb9dc 100644
--- a/src/DotPulsar/EncryptionPolicy.cs
+++ b/src/DotPulsar/EncryptionPolicy.cs
@@ -12,31 +12,30 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// Encryption policies.
+/// </summary>
+public enum EncryptionPolicy : byte
 {
     /// <summary>
-    /// Encryption policies.
+    /// Never encrypt the connection.
     /// </summary>
-    public enum EncryptionPolicy : byte
-    {
-        /// <summary>
-        /// Never encrypt the connection.
-        /// </summary>
-        EnforceUnencrypted,
+    EnforceUnencrypted,
 
-        /// <summary>
-        /// Given the option of encrypting or not, prefer not to.
-        /// </summary>
-        PreferUnencrypted,
+    /// <summary>
+    /// Given the option of encrypting or not, prefer not to.
+    /// </summary>
+    PreferUnencrypted,
 
-        /// <summary>
-        /// Given the option of encrypting or not, prefer to do so.
-        /// </summary>
-        PreferEncrypted,
+    /// <summary>
+    /// Given the option of encrypting or not, prefer to do so.
+    /// </summary>
+    PreferEncrypted,
 
-        /// <summary>
-        /// Always encrypt the connection.
-        /// </summary>
-        EnforceEncrypted
-    }
+    /// <summary>
+    /// Always encrypt the connection.
+    /// </summary>
+    EnforceEncrypted
 }
diff --git a/src/DotPulsar/ExceptionContext.cs b/src/DotPulsar/ExceptionContext.cs
index 746b654..45b2cf5 100644
--- a/src/DotPulsar/ExceptionContext.cs
+++ b/src/DotPulsar/ExceptionContext.cs
@@ -12,39 +12,38 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using System;
+using System.Threading;
+
+public sealed class ExceptionContext
 {
-    using System;
-    using System.Threading;
-
-    public sealed class ExceptionContext
+    internal ExceptionContext(Exception exception, CancellationToken cancellationToken)
     {
-        internal ExceptionContext(Exception exception, CancellationToken cancellationToken)
-        {
-            Exception = exception;
-            CancellationToken = cancellationToken;
-            ExceptionHandled = false;
-            Result = FaultAction.Rethrow;
-        }
-
-        /// <summary>
-        /// The exception caught while executing the operation. This exception will be thrown if the fault action Result is set to 'ThrowException'.
-        /// </summary>
-        public Exception Exception { set; get; }
-
-        /// <summary>
-        /// The cancellation token given to the operation.
-        /// </summary>
-        public CancellationToken CancellationToken { get; }
-
-        /// <summary>
-        /// Gets or sets an indication that the exception has been handled. If 'true' no other exception handlers will be invoked.
-        /// </summary>
-        public bool ExceptionHandled { get; set; }
-
-        /// <summary>
-        /// Gets or sets the FaultAction.
-        /// </summary>
-        public FaultAction Result { get; set; }
+        Exception = exception;
+        CancellationToken = cancellationToken;
+        ExceptionHandled = false;
+        Result = FaultAction.Rethrow;
     }
+
+    /// <summary>
+    /// The exception caught while executing the operation. This exception will be thrown if the fault action Result is set to 'ThrowException'.
+    /// </summary>
+    public Exception Exception { set; get; }
+
+    /// <summary>
+    /// The cancellation token given to the operation.
+    /// </summary>
+    public CancellationToken CancellationToken { get; }
+
+    /// <summary>
+    /// Gets or sets an indication that the exception has been handled. If 'true' no other exception handlers will be invoked.
+    /// </summary>
+    public bool ExceptionHandled { get; set; }
+
+    /// <summary>
+    /// Gets or sets the FaultAction.
+    /// </summary>
+    public FaultAction Result { get; set; }
 }
diff --git a/src/DotPulsar/Exceptions/AuthenticationException.cs b/src/DotPulsar/Exceptions/AuthenticationException.cs
index b9634b2..ae60915 100644
--- a/src/DotPulsar/Exceptions/AuthenticationException.cs
+++ b/src/DotPulsar/Exceptions/AuthenticationException.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+using System;
+
+public sealed class AuthenticationException : DotPulsarException
 {
-    using System;
+    public AuthenticationException(string message) : base(message) { }
 
-    public sealed class AuthenticationException : DotPulsarException
-    {
-        public AuthenticationException(string message) : base(message) { }
-
-        public AuthenticationException(string message, Exception innerException) : base(message, innerException) { }
-    }
+    public AuthenticationException(string message, Exception innerException) : base(message, innerException) { }
 }
diff --git a/src/DotPulsar/Exceptions/AuthorizationException.cs b/src/DotPulsar/Exceptions/AuthorizationException.cs
index 5a9683e..211e4ee 100644
--- a/src/DotPulsar/Exceptions/AuthorizationException.cs
+++ b/src/DotPulsar/Exceptions/AuthorizationException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class AuthorizationException : DotPulsarException
 {
-    public sealed class AuthorizationException : DotPulsarException
-    {
-        public AuthorizationException(string message) : base(message) { }
-    }
+    public AuthorizationException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ChecksumException.cs b/src/DotPulsar/Exceptions/ChecksumException.cs
index 64171f0..5fd1690 100644
--- a/src/DotPulsar/Exceptions/ChecksumException.cs
+++ b/src/DotPulsar/Exceptions/ChecksumException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ChecksumException : DotPulsarException
 {
-    public sealed class ChecksumException : DotPulsarException
-    {
-        public ChecksumException(string message) : base(message) { }
-    }
+    public ChecksumException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/CompressionException.cs b/src/DotPulsar/Exceptions/CompressionException.cs
index be6d12a..359ee73 100644
--- a/src/DotPulsar/Exceptions/CompressionException.cs
+++ b/src/DotPulsar/Exceptions/CompressionException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class CompressionException : DotPulsarException
 {
-    public sealed class CompressionException : DotPulsarException
-    {
-        public CompressionException(string message) : base(message) { }
-    }
+    public CompressionException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ConfigurationException.cs b/src/DotPulsar/Exceptions/ConfigurationException.cs
index 5467426..6b90ddb 100644
--- a/src/DotPulsar/Exceptions/ConfigurationException.cs
+++ b/src/DotPulsar/Exceptions/ConfigurationException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ConfigurationException : DotPulsarException
 {
-    public sealed class ConfigurationException : DotPulsarException
-    {
-        public ConfigurationException(string message) : base(message) { }
-    }
+    public ConfigurationException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ConnectionSecurityException.cs b/src/DotPulsar/Exceptions/ConnectionSecurityException.cs
index b7eb698..a8e5f59 100644
--- a/src/DotPulsar/Exceptions/ConnectionSecurityException.cs
+++ b/src/DotPulsar/Exceptions/ConnectionSecurityException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ConnectionSecurityException : DotPulsarException
 {
-    public sealed class ConnectionSecurityException : DotPulsarException
-    {
-        public ConnectionSecurityException(string message) : base(message) { }
-    }
+    public ConnectionSecurityException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ConsumerAssignException.cs b/src/DotPulsar/Exceptions/ConsumerAssignException.cs
index dcbaba5..c8cf2fa 100644
--- a/src/DotPulsar/Exceptions/ConsumerAssignException.cs
+++ b/src/DotPulsar/Exceptions/ConsumerAssignException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ConsumerAssignException : DotPulsarException
 {
-    public sealed class ConsumerAssignException : DotPulsarException
-    {
-        public ConsumerAssignException(string message) : base(message) { }
-    }
+    public ConsumerAssignException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ConsumerBusyException.cs b/src/DotPulsar/Exceptions/ConsumerBusyException.cs
index 3f6214e..9a858e7 100644
--- a/src/DotPulsar/Exceptions/ConsumerBusyException.cs
+++ b/src/DotPulsar/Exceptions/ConsumerBusyException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ConsumerBusyException : DotPulsarException
 {
-    public sealed class ConsumerBusyException : DotPulsarException
-    {
-        public ConsumerBusyException(string message) : base(message) { }
-    }
+    public ConsumerBusyException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ConsumerClosedException.cs b/src/DotPulsar/Exceptions/ConsumerClosedException.cs
index fd61c0f..0cb8e2e 100644
--- a/src/DotPulsar/Exceptions/ConsumerClosedException.cs
+++ b/src/DotPulsar/Exceptions/ConsumerClosedException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ConsumerClosedException : DotPulsarException
 {
-    public sealed class ConsumerClosedException : DotPulsarException
-    {
-        public ConsumerClosedException() : base("Consumer has closed") { }
-    }
+    public ConsumerClosedException() : base("Consumer has closed") { }
 }
diff --git a/src/DotPulsar/Exceptions/ConsumerDisposedException.cs b/src/DotPulsar/Exceptions/ConsumerDisposedException.cs
index 1ebdf11..1af7a18 100644
--- a/src/DotPulsar/Exceptions/ConsumerDisposedException.cs
+++ b/src/DotPulsar/Exceptions/ConsumerDisposedException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
-{
-    using System;
+namespace DotPulsar.Exceptions;
 
-    public sealed class ConsumerDisposedException : ObjectDisposedException
-    {
-        public ConsumerDisposedException(string objectName) : base(objectName) { }
-    }
+using System;
+
+public sealed class ConsumerDisposedException : ObjectDisposedException
+{
+    public ConsumerDisposedException(string objectName) : base(objectName) { }
 }
diff --git a/src/DotPulsar/Exceptions/DotPulsarException.cs b/src/DotPulsar/Exceptions/DotPulsarException.cs
index 158f906..ef64f9d 100644
--- a/src/DotPulsar/Exceptions/DotPulsarException.cs
+++ b/src/DotPulsar/Exceptions/DotPulsarException.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+using System;
+
+public abstract class DotPulsarException : Exception
 {
-    using System;
+    public DotPulsarException(string message) : base(message) { }
 
-    public abstract class DotPulsarException : Exception
-    {
-        public DotPulsarException(string message) : base(message) { }
-
-        public DotPulsarException(string message, Exception innerException) : base(message, innerException) { }
-    }
+    public DotPulsarException(string message, Exception innerException) : base(message, innerException) { }
 }
diff --git a/src/DotPulsar/Exceptions/IncompatibleSchemaException.cs b/src/DotPulsar/Exceptions/IncompatibleSchemaException.cs
index 9271095..2ed83ae 100644
--- a/src/DotPulsar/Exceptions/IncompatibleSchemaException.cs
+++ b/src/DotPulsar/Exceptions/IncompatibleSchemaException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class IncompatibleSchemaException : DotPulsarException
 {
-    public sealed class IncompatibleSchemaException : DotPulsarException
-    {
-        public IncompatibleSchemaException(string message) : base(message) { }
-    }
+    public IncompatibleSchemaException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/InvalidSchemeException.cs b/src/DotPulsar/Exceptions/InvalidSchemeException.cs
index 970ddaf..561acf0 100644
--- a/src/DotPulsar/Exceptions/InvalidSchemeException.cs
+++ b/src/DotPulsar/Exceptions/InvalidSchemeException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class InvalidSchemeException : DotPulsarException
 {
-    public sealed class InvalidSchemeException : DotPulsarException
-    {
-        public InvalidSchemeException(string message) : base(message) { }
-    }
+    public InvalidSchemeException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/InvalidTopicNameException.cs b/src/DotPulsar/Exceptions/InvalidTopicNameException.cs
index 39b0df3..ff84f8b 100644
--- a/src/DotPulsar/Exceptions/InvalidTopicNameException.cs
+++ b/src/DotPulsar/Exceptions/InvalidTopicNameException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class InvalidTopicNameException : DotPulsarException
 {
-    public sealed class InvalidTopicNameException : DotPulsarException
-    {
-        public InvalidTopicNameException(string message) : base(message) { }
-    }
+    public InvalidTopicNameException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/InvalidTransactionStatusException.cs b/src/DotPulsar/Exceptions/InvalidTransactionStatusException.cs
index e106f5e..caba91a 100644
--- a/src/DotPulsar/Exceptions/InvalidTransactionStatusException.cs
+++ b/src/DotPulsar/Exceptions/InvalidTransactionStatusException.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+using System;
+
+public sealed class InvalidTransactionStatusException : DotPulsarException
 {
-    using System;
+    public InvalidTransactionStatusException(string message) : base(message) { }
 
-    public sealed class InvalidTransactionStatusException : DotPulsarException
-    {
-        public InvalidTransactionStatusException(string message) : base(message) { }
-
-        public InvalidTransactionStatusException(string message, Exception innerException) : base(message, innerException) { }
-    }
+    public InvalidTransactionStatusException(string message, Exception innerException) : base(message, innerException) { }
 }
diff --git a/src/DotPulsar/Exceptions/MetadataException.cs b/src/DotPulsar/Exceptions/MetadataException.cs
index 2c3c54c..d8906cd 100644
--- a/src/DotPulsar/Exceptions/MetadataException.cs
+++ b/src/DotPulsar/Exceptions/MetadataException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class MetadataException : DotPulsarException
 {
-    public sealed class MetadataException : DotPulsarException
-    {
-        public MetadataException(string message) : base(message) { }
-    }
+    public MetadataException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/NotAllowedException.cs b/src/DotPulsar/Exceptions/NotAllowedException.cs
index bce6316..8d76b87 100644
--- a/src/DotPulsar/Exceptions/NotAllowedException.cs
+++ b/src/DotPulsar/Exceptions/NotAllowedException.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+using System;
+
+public sealed class NotAllowedException : DotPulsarException
 {
-    using System;
+    public NotAllowedException(string message) : base(message) { }
 
-    public sealed class NotAllowedException : DotPulsarException
-    {
-        public NotAllowedException(string message) : base(message) { }
-
-        public NotAllowedException(string message, Exception innerException) : base(message, innerException) { }
-    }
+    public NotAllowedException(string message, Exception innerException) : base(message, innerException) { }
 }
diff --git a/src/DotPulsar/Exceptions/PersistenceException.cs b/src/DotPulsar/Exceptions/PersistenceException.cs
index bf9b57e..2058aa2 100644
--- a/src/DotPulsar/Exceptions/PersistenceException.cs
+++ b/src/DotPulsar/Exceptions/PersistenceException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class PersistenceException : DotPulsarException
 {
-    public sealed class PersistenceException : DotPulsarException
-    {
-        public PersistenceException(string message) : base(message) { }
-    }
+    public PersistenceException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ProducerBlockedQuotaExceededException.cs b/src/DotPulsar/Exceptions/ProducerBlockedQuotaExceededException.cs
index fed9ea3..d644a49 100644
--- a/src/DotPulsar/Exceptions/ProducerBlockedQuotaExceededException.cs
+++ b/src/DotPulsar/Exceptions/ProducerBlockedQuotaExceededException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ProducerBlockedQuotaExceededException : DotPulsarException
 {
-    public sealed class ProducerBlockedQuotaExceededException : DotPulsarException
-    {
-        public ProducerBlockedQuotaExceededException(string message) : base(message) { }
-    }
+    public ProducerBlockedQuotaExceededException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ProducerBusyException.cs b/src/DotPulsar/Exceptions/ProducerBusyException.cs
index 094e615..5e573af 100644
--- a/src/DotPulsar/Exceptions/ProducerBusyException.cs
+++ b/src/DotPulsar/Exceptions/ProducerBusyException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ProducerBusyException : DotPulsarException
 {
-    public sealed class ProducerBusyException : DotPulsarException
-    {
-        public ProducerBusyException(string message) : base(message) { }
-    }
+    public ProducerBusyException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/ProducerClosedException.cs b/src/DotPulsar/Exceptions/ProducerClosedException.cs
index 2f388dc..0ad4ac9 100644
--- a/src/DotPulsar/Exceptions/ProducerClosedException.cs
+++ b/src/DotPulsar/Exceptions/ProducerClosedException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ProducerClosedException : DotPulsarException
 {
-    public sealed class ProducerClosedException : DotPulsarException
-    {
-        public ProducerClosedException() : base("Producer has closed") { }
-    }
+    public ProducerClosedException() : base("Producer has closed") { }
 }
diff --git a/src/DotPulsar/Exceptions/ProducerDisposedException.cs b/src/DotPulsar/Exceptions/ProducerDisposedException.cs
index f07fb1b..7098cd7 100644
--- a/src/DotPulsar/Exceptions/ProducerDisposedException.cs
+++ b/src/DotPulsar/Exceptions/ProducerDisposedException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
-{
-    using System;
+namespace DotPulsar.Exceptions;
 
-    public sealed class ProducerDisposedException : ObjectDisposedException
-    {
-        public ProducerDisposedException(string objectName) : base(objectName) { }
-    }
+using System;
+
+public sealed class ProducerDisposedException : ObjectDisposedException
+{
+    public ProducerDisposedException(string objectName) : base(objectName) { }
 }
diff --git a/src/DotPulsar/Exceptions/PulsarClientClosedException.cs b/src/DotPulsar/Exceptions/PulsarClientClosedException.cs
index 8a0c70b..4506037 100644
--- a/src/DotPulsar/Exceptions/PulsarClientClosedException.cs
+++ b/src/DotPulsar/Exceptions/PulsarClientClosedException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class PulsarClientClosedException : DotPulsarException
 {
-    public sealed class PulsarClientClosedException : DotPulsarException
-    {
-        public PulsarClientClosedException() : base("Client has closed") { }
-    }
+    public PulsarClientClosedException() : base("Client has closed") { }
 }
diff --git a/src/DotPulsar/Exceptions/PulsarClientDisposedException.cs b/src/DotPulsar/Exceptions/PulsarClientDisposedException.cs
index 3b3ceb6..d5dd996 100644
--- a/src/DotPulsar/Exceptions/PulsarClientDisposedException.cs
+++ b/src/DotPulsar/Exceptions/PulsarClientDisposedException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
-{
-    using System;
+namespace DotPulsar.Exceptions;
 
-    public sealed class PulsarClientDisposedException : ObjectDisposedException
-    {
-        public PulsarClientDisposedException() : base(typeof(PulsarClient).FullName) { }
-    }
+using System;
+
+public sealed class PulsarClientDisposedException : ObjectDisposedException
+{
+    public PulsarClientDisposedException() : base(typeof(PulsarClient).FullName) { }
 }
diff --git a/src/DotPulsar/Exceptions/ReaderClosedException.cs b/src/DotPulsar/Exceptions/ReaderClosedException.cs
index 5ff801e..2022ad8 100644
--- a/src/DotPulsar/Exceptions/ReaderClosedException.cs
+++ b/src/DotPulsar/Exceptions/ReaderClosedException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class ReaderClosedException : DotPulsarException
 {
-    public sealed class ReaderClosedException : DotPulsarException
-    {
-        public ReaderClosedException() : base("Reader has closed") { }
-    }
+    public ReaderClosedException() : base("Reader has closed") { }
 }
diff --git a/src/DotPulsar/Exceptions/ReaderDisposedException.cs b/src/DotPulsar/Exceptions/ReaderDisposedException.cs
index 1ab4b80..3458df7 100644
--- a/src/DotPulsar/Exceptions/ReaderDisposedException.cs
+++ b/src/DotPulsar/Exceptions/ReaderDisposedException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
-{
-    using System;
+namespace DotPulsar.Exceptions;
 
-    public sealed class ReaderDisposedException : ObjectDisposedException
-    {
-        public ReaderDisposedException(string objectName) : base(objectName) { }
-    }
+using System;
+
+public sealed class ReaderDisposedException : ObjectDisposedException
+{
+    public ReaderDisposedException(string objectName) : base(objectName) { }
 }
diff --git a/src/DotPulsar/Exceptions/SchemaSerializationException.cs b/src/DotPulsar/Exceptions/SchemaSerializationException.cs
index 900f8b1..fdb12a0 100644
--- a/src/DotPulsar/Exceptions/SchemaSerializationException.cs
+++ b/src/DotPulsar/Exceptions/SchemaSerializationException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class SchemaSerializationException : DotPulsarException
 {
-    public sealed class SchemaSerializationException : DotPulsarException
-    {
-        public SchemaSerializationException(string message) : base(message) { }
-    }
+    public SchemaSerializationException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/SubscriptionNotFoundException.cs b/src/DotPulsar/Exceptions/SubscriptionNotFoundException.cs
index 37d2d1a..64a7415 100644
--- a/src/DotPulsar/Exceptions/SubscriptionNotFoundException.cs
+++ b/src/DotPulsar/Exceptions/SubscriptionNotFoundException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class SubscriptionNotFoundException : DotPulsarException
 {
-    public sealed class SubscriptionNotFoundException : DotPulsarException
-    {
-        public SubscriptionNotFoundException(string message) : base(message) { }
-    }
+    public SubscriptionNotFoundException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/TopicNotFoundException.cs b/src/DotPulsar/Exceptions/TopicNotFoundException.cs
index 8cb4680..c2585c5 100644
--- a/src/DotPulsar/Exceptions/TopicNotFoundException.cs
+++ b/src/DotPulsar/Exceptions/TopicNotFoundException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class TopicNotFoundException : DotPulsarException
 {
-    public sealed class TopicNotFoundException : DotPulsarException
-    {
-        public TopicNotFoundException(string message) : base(message) { }
-    }
+    public TopicNotFoundException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/TopicTerminatedException.cs b/src/DotPulsar/Exceptions/TopicTerminatedException.cs
index 0a97502..076f0d3 100644
--- a/src/DotPulsar/Exceptions/TopicTerminatedException.cs
+++ b/src/DotPulsar/Exceptions/TopicTerminatedException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class TopicTerminatedException : DotPulsarException
 {
-    public sealed class TopicTerminatedException : DotPulsarException
-    {
-        public TopicTerminatedException(string message) : base(message) { }
-    }
+    public TopicTerminatedException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/TransactionConflictException.cs b/src/DotPulsar/Exceptions/TransactionConflictException.cs
index c358d39..1a83c10 100644
--- a/src/DotPulsar/Exceptions/TransactionConflictException.cs
+++ b/src/DotPulsar/Exceptions/TransactionConflictException.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+using System;
+
+public sealed class TransactionConflictException : DotPulsarException
 {
-    using System;
+    public TransactionConflictException(string message) : base(message) { }
 
-    public sealed class TransactionConflictException : DotPulsarException
-    {
-        public TransactionConflictException(string message) : base(message) { }
-
-        public TransactionConflictException(string message, Exception innerException) : base(message, innerException) { }
-    }
+    public TransactionConflictException(string message, Exception innerException) : base(message, innerException) { }
 }
diff --git a/src/DotPulsar/Exceptions/TransactionCoordinatorNotFoundException.cs b/src/DotPulsar/Exceptions/TransactionCoordinatorNotFoundException.cs
index 33d9158..c79117a 100644
--- a/src/DotPulsar/Exceptions/TransactionCoordinatorNotFoundException.cs
+++ b/src/DotPulsar/Exceptions/TransactionCoordinatorNotFoundException.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+using System;
+
+public sealed class TransactionCoordinatorNotFoundException : DotPulsarException
 {
-    using System;
+    public TransactionCoordinatorNotFoundException(string message) : base(message) { }
 
-    public sealed class TransactionCoordinatorNotFoundException : DotPulsarException
-    {
-        public TransactionCoordinatorNotFoundException(string message) : base(message) { }
-
-        public TransactionCoordinatorNotFoundException(string message, Exception innerException) : base(message, innerException) { }
-    }
+    public TransactionCoordinatorNotFoundException(string message, Exception innerException) : base(message, innerException) { }
 }
diff --git a/src/DotPulsar/Exceptions/UnknownException.cs b/src/DotPulsar/Exceptions/UnknownException.cs
index ff6cb35..af5d7b8 100644
--- a/src/DotPulsar/Exceptions/UnknownException.cs
+++ b/src/DotPulsar/Exceptions/UnknownException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class UnknownException : DotPulsarException
 {
-    public sealed class UnknownException : DotPulsarException
-    {
-        public UnknownException(string message) : base(message) { }
-    }
+    public UnknownException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Exceptions/UnsupportedVersionException.cs b/src/DotPulsar/Exceptions/UnsupportedVersionException.cs
index fe9b5a5..28594a4 100644
--- a/src/DotPulsar/Exceptions/UnsupportedVersionException.cs
+++ b/src/DotPulsar/Exceptions/UnsupportedVersionException.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Exceptions
+namespace DotPulsar.Exceptions;
+
+public sealed class UnsupportedVersionException : DotPulsarException
 {
-    public sealed class UnsupportedVersionException : DotPulsarException
-    {
-        public UnsupportedVersionException(string message) : base(message) { }
-    }
+    public UnsupportedVersionException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Extensions/ConsumerBuilderExtensions.cs b/src/DotPulsar/Extensions/ConsumerBuilderExtensions.cs
index 08fecd7..7ab0354 100644
--- a/src/DotPulsar/Extensions/ConsumerBuilderExtensions.cs
+++ b/src/DotPulsar/Extensions/ConsumerBuilderExtensions.cs
@@ -12,41 +12,40 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Internal;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for IConsumerBuilder.
+/// </summary>
+public static class ConsumerBuilderExtensions
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Register a state changed handler.
+    /// </summary>
+    public static IConsumerBuilder<TMessage> StateChangedHandler<TMessage>(
+        this IConsumerBuilder<TMessage> builder,
+        Action<ConsumerStateChanged, CancellationToken> handler,
+        CancellationToken cancellationToken = default)
+    {
+        builder.StateChangedHandler(new ActionStateChangedHandler<ConsumerStateChanged>(handler, cancellationToken));
+        return builder;
+    }
 
     /// <summary>
-    /// Extensions for IConsumerBuilder.
+    /// Register a state changed handler.
     /// </summary>
-    public static class ConsumerBuilderExtensions
+    public static IConsumerBuilder<TMessage> StateChangedHandler<TMessage>(
+        this IConsumerBuilder<TMessage> builder,
+        Func<ConsumerStateChanged, CancellationToken, ValueTask> handler,
+        CancellationToken cancellationToken = default)
     {
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        public static IConsumerBuilder<TMessage> StateChangedHandler<TMessage>(
-            this IConsumerBuilder<TMessage> builder,
-            Action<ConsumerStateChanged, CancellationToken> handler,
-            CancellationToken cancellationToken = default)
-        {
-            builder.StateChangedHandler(new ActionStateChangedHandler<ConsumerStateChanged>(handler, cancellationToken));
-            return builder;
-        }
-
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        public static IConsumerBuilder<TMessage> StateChangedHandler<TMessage>(
-            this IConsumerBuilder<TMessage> builder,
-            Func<ConsumerStateChanged, CancellationToken, ValueTask> handler,
-            CancellationToken cancellationToken = default)
-        {
-            builder.StateChangedHandler(new FuncStateChangedHandler<ConsumerStateChanged>(handler, cancellationToken));
-            return builder;
-        }
+        builder.StateChangedHandler(new FuncStateChangedHandler<ConsumerStateChanged>(handler, cancellationToken));
+        return builder;
     }
 }
diff --git a/src/DotPulsar/Extensions/ConsumerExtensions.cs b/src/DotPulsar/Extensions/ConsumerExtensions.cs
index 88f12cd..7d38591 100644
--- a/src/DotPulsar/Extensions/ConsumerExtensions.cs
+++ b/src/DotPulsar/Extensions/ConsumerExtensions.cs
@@ -12,111 +12,110 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Internal;
+using DotPulsar.Internal.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for IConsumer.
+/// </summary>
+public static class ConsumerExtensions
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal;
-    using DotPulsar.Internal.Extensions;
-    using System;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Acknowledge the consumption of a single message.
+    /// </summary>
+    public static async ValueTask Acknowledge(this IConsumer consumer, IMessage message, CancellationToken cancellationToken = default)
+        => await consumer.Acknowledge(message.MessageId, cancellationToken).ConfigureAwait(false);
 
     /// <summary>
-    /// Extensions for IConsumer.
+    /// Acknowledge the consumption of all the messages in the topic up to and including the provided message.
     /// </summary>
-    public static class ConsumerExtensions
+    public static async ValueTask AcknowledgeCumulative(this IConsumer consumer, IMessage message, CancellationToken cancellationToken = default)
+        => await consumer.AcknowledgeCumulative(message.MessageId, cancellationToken).ConfigureAwait(false);
+
+    /// <summary>
+    /// Process and auto-acknowledge a message.
+    /// </summary>
+    public static async ValueTask Process<TMessage>(
+        this IConsumer<TMessage> consumer,
+        Func<IMessage<TMessage>, CancellationToken, ValueTask> processor,
+        CancellationToken cancellationToken = default)
     {
-        /// <summary>
-        /// Acknowledge the consumption of a single message.
-        /// </summary>
-        public static async ValueTask Acknowledge(this IConsumer consumer, IMessage message, CancellationToken cancellationToken = default)
-            => await consumer.Acknowledge(message.MessageId, cancellationToken).ConfigureAwait(false);
+        const string operation = "process";
+        var operationName = $"{consumer.Topic} {operation}";
 
-        /// <summary>
-        /// Acknowledge the consumption of all the messages in the topic up to and including the provided message.
-        /// </summary>
-        public static async ValueTask AcknowledgeCumulative(this IConsumer consumer, IMessage message, CancellationToken cancellationToken = default)
-            => await consumer.AcknowledgeCumulative(message.MessageId, cancellationToken).ConfigureAwait(false);
-
-        /// <summary>
-        /// Process and auto-acknowledge a message.
-        /// </summary>
-        public static async ValueTask Process<TMessage>(
-            this IConsumer<TMessage> consumer,
-            Func<IMessage<TMessage>, CancellationToken, ValueTask> processor,
-            CancellationToken cancellationToken = default)
+        var tags = new KeyValuePair<string, object?>[]
         {
-            const string operation = "process";
-            var operationName = $"{consumer.Topic} {operation}";
-
-            var tags = new KeyValuePair<string, object?>[]
-            {
                 new KeyValuePair<string, object?>("messaging.destination", consumer.Topic),
                 new KeyValuePair<string, object?>("messaging.destination_kind", "topic"),
                 new KeyValuePair<string, object?>("messaging.operation", operation),
                 new KeyValuePair<string, object?>("messaging.system", "pulsar"),
                 new KeyValuePair<string, object?>("messaging.url", consumer.ServiceUrl),
                 new KeyValuePair<string, object?>("messaging.pulsar.subscription", consumer.SubscriptionName)
-            };
+        };
 
-            while (!cancellationToken.IsCancellationRequested)
+        while (!cancellationToken.IsCancellationRequested)
+        {
+            var message = await consumer.Receive(cancellationToken).ConfigureAwait(false);
+
+            var activity = DotPulsarActivitySource.StartConsumerActivity(message, operationName, tags);
+
+            if (activity is not null && activity.IsAllDataRequested)
             {
-                var message = await consumer.Receive(cancellationToken).ConfigureAwait(false);
-
-                var activity = DotPulsarActivitySource.StartConsumerActivity(message, operationName, tags);
-
-                if (activity is not null && activity.IsAllDataRequested)
-                {
-                    activity.SetMessageId(message.MessageId);
-                    activity.SetPayloadSize(message.Data.Length);
-                    activity.SetStatusCode("OK");
-                }
-
-                try
-                {
-                    await processor(message, cancellationToken).ConfigureAwait(false);
-                }
-                catch (Exception exception)
-                {
-                    if (activity is not null && activity.IsAllDataRequested)
-                        activity.AddException(exception);
-                }
-
-                activity?.Dispose();
-
-                await consumer.Acknowledge(message.MessageId, cancellationToken).ConfigureAwait(false);
+                activity.SetMessageId(message.MessageId);
+                activity.SetPayloadSize(message.Data.Length);
+                activity.SetStatusCode("OK");
             }
-        }
 
-        /// <summary>
-        /// Wait for the state to change to a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        public static async ValueTask<ConsumerStateChanged> StateChangedTo(this IConsumer consumer, ConsumerState state, CancellationToken cancellationToken = default)
-        {
-            var newState = await consumer.OnStateChangeTo(state, cancellationToken).ConfigureAwait(false);
-            return new ConsumerStateChanged(consumer, newState);
-        }
+            try
+            {
+                await processor(message, cancellationToken).ConfigureAwait(false);
+            }
+            catch (Exception exception)
+            {
+                if (activity is not null && activity.IsAllDataRequested)
+                    activity.AddException(exception);
+            }
 
-        /// <summary>
-        /// Wait for the state to change from a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        public static async ValueTask<ConsumerStateChanged> StateChangedFrom(this IConsumer consumer, ConsumerState state, CancellationToken cancellationToken = default)
-        {
-            var newState = await consumer.OnStateChangeFrom(state, cancellationToken).ConfigureAwait(false);
-            return new ConsumerStateChanged(consumer, newState);
+            activity?.Dispose();
+
+            await consumer.Acknowledge(message.MessageId, cancellationToken).ConfigureAwait(false);
         }
     }
+
+    /// <summary>
+    /// Wait for the state to change to a specific state.
+    /// </summary>
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    public static async ValueTask<ConsumerStateChanged> StateChangedTo(this IConsumer consumer, ConsumerState state, CancellationToken cancellationToken = default)
+    {
+        var newState = await consumer.OnStateChangeTo(state, cancellationToken).ConfigureAwait(false);
+        return new ConsumerStateChanged(consumer, newState);
+    }
+
+    /// <summary>
+    /// Wait for the state to change from a specific state.
+    /// </summary>
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    public static async ValueTask<ConsumerStateChanged> StateChangedFrom(this IConsumer consumer, ConsumerState state, CancellationToken cancellationToken = default)
+    {
+        var newState = await consumer.OnStateChangeFrom(state, cancellationToken).ConfigureAwait(false);
+        return new ConsumerStateChanged(consumer, newState);
+    }
 }
diff --git a/src/DotPulsar/Extensions/MessageBuilderExtensions.cs b/src/DotPulsar/Extensions/MessageBuilderExtensions.cs
index aaf2da3..cf72a32 100644
--- a/src/DotPulsar/Extensions/MessageBuilderExtensions.cs
+++ b/src/DotPulsar/Extensions/MessageBuilderExtensions.cs
@@ -12,29 +12,28 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Buffers;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for IMessageBuilder.
+/// </summary>
+public static class MessageBuilderExtensions
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Sends a message.
+    /// </summary>
+    public static async ValueTask<MessageId> Send(this IMessageBuilder<ReadOnlySequence<byte>> builder, byte[] payload, CancellationToken cancellationToken = default)
+        => await builder.Send(new ReadOnlySequence<byte>(payload), cancellationToken).ConfigureAwait(false);
 
     /// <summary>
-    /// Extensions for IMessageBuilder.
+    /// Sends a message.
     /// </summary>
-    public static class MessageBuilderExtensions
-    {
-        /// <summary>
-        /// Sends a message.
-        /// </summary>
-        public static async ValueTask<MessageId> Send(this IMessageBuilder<ReadOnlySequence<byte>> builder, byte[] payload, CancellationToken cancellationToken = default)
-            => await builder.Send(new ReadOnlySequence<byte>(payload), cancellationToken).ConfigureAwait(false);
-
-        /// <summary>
-        /// Sends a message.
-        /// </summary>
-        public static async ValueTask<MessageId> Send(this IMessageBuilder<ReadOnlySequence<byte>> builder, ReadOnlyMemory<byte> payload, CancellationToken cancellationToken = default)
-            => await builder.Send(new ReadOnlySequence<byte>(payload), cancellationToken).ConfigureAwait(false);
-    }
+    public static async ValueTask<MessageId> Send(this IMessageBuilder<ReadOnlySequence<byte>> builder, ReadOnlyMemory<byte> payload, CancellationToken cancellationToken = default)
+        => await builder.Send(new ReadOnlySequence<byte>(payload), cancellationToken).ConfigureAwait(false);
 }
diff --git a/src/DotPulsar/Extensions/ProducerBuilderExtensions.cs b/src/DotPulsar/Extensions/ProducerBuilderExtensions.cs
index 2c11133..907e770 100644
--- a/src/DotPulsar/Extensions/ProducerBuilderExtensions.cs
+++ b/src/DotPulsar/Extensions/ProducerBuilderExtensions.cs
@@ -12,41 +12,40 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Internal;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for IProducerBuilder.
+/// </summary>
+public static class ProducerBuilderExtensions
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Register a state changed handler.
+    /// </summary>
+    public static IProducerBuilder<TMessage> StateChangedHandler<TMessage>(
+        this IProducerBuilder<TMessage> builder,
+        Action<ProducerStateChanged, CancellationToken> handler,
+        CancellationToken cancellationToken = default)
+    {
+        builder.StateChangedHandler(new ActionStateChangedHandler<ProducerStateChanged>(handler, cancellationToken));
+        return builder;
+    }
 
     /// <summary>
-    /// Extensions for IProducerBuilder.
+    /// Register a state changed handler.
     /// </summary>
-    public static class ProducerBuilderExtensions
+    public static IProducerBuilder<TMessage> StateChangedHandler<TMessage>(
+        this IProducerBuilder<TMessage> builder,
+        Func<ProducerStateChanged, CancellationToken, ValueTask> handler,
+        CancellationToken cancellationToken = default)
     {
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        public static IProducerBuilder<TMessage> StateChangedHandler<TMessage>(
-            this IProducerBuilder<TMessage> builder,
-            Action<ProducerStateChanged, CancellationToken> handler,
-            CancellationToken cancellationToken = default)
-        {
-            builder.StateChangedHandler(new ActionStateChangedHandler<ProducerStateChanged>(handler, cancellationToken));
-            return builder;
-        }
-
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        public static IProducerBuilder<TMessage> StateChangedHandler<TMessage>(
-            this IProducerBuilder<TMessage> builder,
-            Func<ProducerStateChanged, CancellationToken, ValueTask> handler,
-            CancellationToken cancellationToken = default)
-        {
-            builder.StateChangedHandler(new FuncStateChangedHandler<ProducerStateChanged>(handler, cancellationToken));
-            return builder;
-        }
+        builder.StateChangedHandler(new FuncStateChangedHandler<ProducerStateChanged>(handler, cancellationToken));
+        return builder;
     }
 }
diff --git a/src/DotPulsar/Extensions/ProducerExtensions.cs b/src/DotPulsar/Extensions/ProducerExtensions.cs
index 130941e..71ea70d 100644
--- a/src/DotPulsar/Extensions/ProducerExtensions.cs
+++ b/src/DotPulsar/Extensions/ProducerExtensions.cs
@@ -12,52 +12,51 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using Abstractions;
+using Internal;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for IProducer.
+/// </summary>
+public static class ProducerExtensions
 {
-    using Abstractions;
-    using Internal;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Get a builder that can be used to configure and build a Message.
+    /// </summary>
+    public static IMessageBuilder<TMessage> NewMessage<TMessage>(this IProducer<TMessage> producer)
+        => new MessageBuilder<TMessage>(producer);
 
     /// <summary>
-    /// Extensions for IProducer.
+    /// Wait for the state to change to a specific state.
     /// </summary>
-    public static class ProducerExtensions
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    public static async ValueTask<ProducerStateChanged> StateChangedTo(this IProducer producer, ProducerState state, CancellationToken cancellationToken = default)
     {
-        /// <summary>
-        /// Get a builder that can be used to configure and build a Message.
-        /// </summary>
-        public static IMessageBuilder<TMessage> NewMessage<TMessage>(this IProducer<TMessage> producer)
-            => new MessageBuilder<TMessage>(producer);
+        var newState = await producer.OnStateChangeTo(state, cancellationToken).ConfigureAwait(false);
+        return new ProducerStateChanged(producer, newState);
+    }
 
-        /// <summary>
-        /// Wait for the state to change to a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        public static async ValueTask<ProducerStateChanged> StateChangedTo(this IProducer producer, ProducerState state, CancellationToken cancellationToken = default)
-        {
-            var newState = await producer.OnStateChangeTo(state, cancellationToken).ConfigureAwait(false);
-            return new ProducerStateChanged(producer, newState);
-        }
-
-        /// <summary>
-        /// Wait for the state to change from a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        public static async ValueTask<ProducerStateChanged> StateChangedFrom(this IProducer producer, ProducerState state, CancellationToken cancellationToken = default)
-        {
-            var newState = await producer.OnStateChangeFrom(state, cancellationToken).ConfigureAwait(false);
-            return new ProducerStateChanged(producer, newState);
-        }
+    /// <summary>
+    /// Wait for the state to change from a specific state.
+    /// </summary>
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    public static async ValueTask<ProducerStateChanged> StateChangedFrom(this IProducer producer, ProducerState state, CancellationToken cancellationToken = default)
+    {
+        var newState = await producer.OnStateChangeFrom(state, cancellationToken).ConfigureAwait(false);
+        return new ProducerStateChanged(producer, newState);
     }
 }
diff --git a/src/DotPulsar/Extensions/PulsarClientBuilderExtensions.cs b/src/DotPulsar/Extensions/PulsarClientBuilderExtensions.cs
index 863872d..33bc5a9 100644
--- a/src/DotPulsar/Extensions/PulsarClientBuilderExtensions.cs
+++ b/src/DotPulsar/Extensions/PulsarClientBuilderExtensions.cs
@@ -12,34 +12,33 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Internal;
+using System;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for IPulsarClientBuilder.
+/// </summary>
+public static class PulsarClientBuilderExtensions
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal;
-    using System;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Register a custom exception handler that will be invoked before the default exception handler.
+    /// </summary>
+    public static IPulsarClientBuilder ExceptionHandler(this IPulsarClientBuilder builder, Action<ExceptionContext> exceptionHandler)
+    {
+        builder.ExceptionHandler(new ActionExceptionHandler(exceptionHandler));
+        return builder;
+    }
 
     /// <summary>
-    /// Extensions for IPulsarClientBuilder.
+    /// Register a custom exception handler that will be invoked before the default exception handler.
     /// </summary>
-    public static class PulsarClientBuilderExtensions
+    public static IPulsarClientBuilder ExceptionHandler(this IPulsarClientBuilder builder, Func<ExceptionContext, ValueTask> exceptionHandler)
     {
-        /// <summary>
-        /// Register a custom exception handler that will be invoked before the default exception handler.
-        /// </summary>
-        public static IPulsarClientBuilder ExceptionHandler(this IPulsarClientBuilder builder, Action<ExceptionContext> exceptionHandler)
-        {
-            builder.ExceptionHandler(new ActionExceptionHandler(exceptionHandler));
-            return builder;
-        }
-
-        /// <summary>
-        /// Register a custom exception handler that will be invoked before the default exception handler.
-        /// </summary>
-        public static IPulsarClientBuilder ExceptionHandler(this IPulsarClientBuilder builder, Func<ExceptionContext, ValueTask> exceptionHandler)
-        {
-            builder.ExceptionHandler(new FuncExceptionHandler(exceptionHandler));
-            return builder;
-        }
+        builder.ExceptionHandler(new FuncExceptionHandler(exceptionHandler));
+        return builder;
     }
 }
diff --git a/src/DotPulsar/Extensions/PulsarClientExtensions.cs b/src/DotPulsar/Extensions/PulsarClientExtensions.cs
index 0f836a6..9750024 100644
--- a/src/DotPulsar/Extensions/PulsarClientExtensions.cs
+++ b/src/DotPulsar/Extensions/PulsarClientExtensions.cs
@@ -12,51 +12,50 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using Abstractions;
+using Internal;
+using System.Buffers;
+
+/// <summary>
+/// Extensions for IPulsarClient.
+/// </summary>
+public static class PulsarClientExtensions
 {
-    using Abstractions;
-    using Internal;
-    using System.Buffers;
+    /// <summary>
+    /// Get a builder that can be used to configure and build a Producer instance.
+    /// </summary>
+    public static IProducerBuilder<ReadOnlySequence<byte>> NewProducer(this IPulsarClient pulsarClient)
+        => new ProducerBuilder<ReadOnlySequence<byte>>(pulsarClient, Schema.ByteSequence);
 
     /// <summary>
-    /// Extensions for IPulsarClient.
+    /// Get a builder that can be used to configure and build a Consumer instance.
     /// </summary>
-    public static class PulsarClientExtensions
-    {
-        /// <summary>
-        /// Get a builder that can be used to configure and build a Producer instance.
-        /// </summary>
-        public static IProducerBuilder<ReadOnlySequence<byte>> NewProducer(this IPulsarClient pulsarClient)
-            => new ProducerBuilder<ReadOnlySequence<byte>>(pulsarClient, Schema.ByteSequence);
+    public static IConsumerBuilder<ReadOnlySequence<byte>> NewConsumer(this IPulsarClient pulsarClient)
+        => new ConsumerBuilder<ReadOnlySequence<byte>>(pulsarClient, Schema.ByteSequence);
 
-        /// <summary>
-        /// Get a builder that can be used to configure and build a Consumer instance.
-        /// </summary>
-        public static IConsumerBuilder<ReadOnlySequence<byte>> NewConsumer(this IPulsarClient pulsarClient)
-            => new ConsumerBuilder<ReadOnlySequence<byte>>(pulsarClient, Schema.ByteSequence);
+    /// <summary>
+    /// Get a builder that can be used to configure and build a Reader instance.
+    /// </summary>
+    public static IReaderBuilder<ReadOnlySequence<byte>> NewReader(this IPulsarClient pulsarClient)
+        => new ReaderBuilder<ReadOnlySequence<byte>>(pulsarClient, Schema.ByteSequence);
 
-        /// <summary>
-        /// Get a builder that can be used to configure and build a Reader instance.
-        /// </summary>
-        public static IReaderBuilder<ReadOnlySequence<byte>> NewReader(this IPulsarClient pulsarClient)
-            => new ReaderBuilder<ReadOnlySequence<byte>>(pulsarClient, Schema.ByteSequence);
+    /// <summary>
+    /// Get a builder that can be used to configure and build a Producer instance.
+    /// </summary>
+    public static IProducerBuilder<TMessage> NewProducer<TMessage>(this IPulsarClient pulsarClient, ISchema<TMessage> schema)
+        => new ProducerBuilder<TMessage>(pulsarClient, schema);
 
-        /// <summary>
-        /// Get a builder that can be used to configure and build a Producer instance.
-        /// </summary>
-        public static IProducerBuilder<TMessage> NewProducer<TMessage>(this IPulsarClient pulsarClient, ISchema<TMessage> schema)
-            => new ProducerBuilder<TMessage>(pulsarClient, schema);
+    /// <summary>
+    /// Get a builder that can be used to configure and build a Consumer instance.
+    /// </summary>
+    public static IConsumerBuilder<TMessage> NewConsumer<TMessage>(this IPulsarClient pulsarClient, ISchema<TMessage> schema)
+        => new ConsumerBuilder<TMessage>(pulsarClient, schema);
 
-        /// <summary>
-        /// Get a builder that can be used to configure and build a Consumer instance.
-        /// </summary>
-        public static IConsumerBuilder<TMessage> NewConsumer<TMessage>(this IPulsarClient pulsarClient, ISchema<TMessage> schema)
-            => new ConsumerBuilder<TMessage>(pulsarClient, schema);
-
-        /// <summary>
-        /// Get a builder that can be used to configure and build a Reader instance.
-        /// </summary>
-        public static IReaderBuilder<TMessage> NewReader<TMessage>(this IPulsarClient pulsarClient, ISchema<TMessage> schema)
-            => new ReaderBuilder<TMessage>(pulsarClient, schema);
-    }
+    /// <summary>
+    /// Get a builder that can be used to configure and build a Reader instance.
+    /// </summary>
+    public static IReaderBuilder<TMessage> NewReader<TMessage>(this IPulsarClient pulsarClient, ISchema<TMessage> schema)
+        => new ReaderBuilder<TMessage>(pulsarClient, schema);
 }
diff --git a/src/DotPulsar/Extensions/ReaderBuilderExtensions.cs b/src/DotPulsar/Extensions/ReaderBuilderExtensions.cs
index 7f86286..32f7505 100644
--- a/src/DotPulsar/Extensions/ReaderBuilderExtensions.cs
+++ b/src/DotPulsar/Extensions/ReaderBuilderExtensions.cs
@@ -12,41 +12,40 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Internal;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for IReaderBuilder.
+/// </summary>
+public static class ReaderBuilderExtensions
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Register a state changed handler.
+    /// </summary>
+    public static IReaderBuilder<TMessage> StateChangedHandler<TMessage>(
+        this IReaderBuilder<TMessage> builder,
+        Action<ReaderStateChanged, CancellationToken> handler,
+        CancellationToken cancellationToken = default)
+    {
+        builder.StateChangedHandler(new ActionStateChangedHandler<ReaderStateChanged>(handler, cancellationToken));
+        return builder;
+    }
 
     /// <summary>
-    /// Extensions for IReaderBuilder.
+    /// Register a state changed handler.
     /// </summary>
-    public static class ReaderBuilderExtensions
+    public static IReaderBuilder<TMessage> StateChangedHandler<TMessage>(
+        this IReaderBuilder<TMessage> builder,
+        Func<ReaderStateChanged, CancellationToken, ValueTask> handler,
+        CancellationToken cancellationToken = default)
     {
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        public static IReaderBuilder<TMessage> StateChangedHandler<TMessage>(
-            this IReaderBuilder<TMessage> builder,
-            Action<ReaderStateChanged, CancellationToken> handler,
-            CancellationToken cancellationToken = default)
-        {
-            builder.StateChangedHandler(new ActionStateChangedHandler<ReaderStateChanged>(handler, cancellationToken));
-            return builder;
-        }
-
-        /// <summary>
-        /// Register a state changed handler.
-        /// </summary>
-        public static IReaderBuilder<TMessage> StateChangedHandler<TMessage>(
-            this IReaderBuilder<TMessage> builder,
-            Func<ReaderStateChanged, CancellationToken, ValueTask> handler,
-            CancellationToken cancellationToken = default)
-        {
-            builder.StateChangedHandler(new FuncStateChangedHandler<ReaderStateChanged>(handler, cancellationToken));
-            return builder;
-        }
+        builder.StateChangedHandler(new FuncStateChangedHandler<ReaderStateChanged>(handler, cancellationToken));
+        return builder;
     }
 }
diff --git a/src/DotPulsar/Extensions/ReaderExtensions.cs b/src/DotPulsar/Extensions/ReaderExtensions.cs
index 86d093b..661c5be 100644
--- a/src/DotPulsar/Extensions/ReaderExtensions.cs
+++ b/src/DotPulsar/Extensions/ReaderExtensions.cs
@@ -12,45 +12,44 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using DotPulsar.Abstractions;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for IReader.
+/// </summary>
+public static class ReaderExtensions
 {
-    using DotPulsar.Abstractions;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Wait for the state to change to a specific state.
+    /// </summary>
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    public static async ValueTask<ReaderStateChanged> StateChangedTo(this IReader reader, ReaderState state, CancellationToken cancellationToken = default)
+    {
+        var newState = await reader.OnStateChangeTo(state, cancellationToken).ConfigureAwait(false);
+        return new ReaderStateChanged(reader, newState);
+    }
 
     /// <summary>
-    /// Extensions for IReader.
+    /// Wait for the state to change from a specific state.
     /// </summary>
-    public static class ReaderExtensions
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    public static async ValueTask<ReaderStateChanged> StateChangedFrom(this IReader reader, ReaderState state, CancellationToken cancellationToken = default)
     {
-        /// <summary>
-        /// Wait for the state to change to a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        public static async ValueTask<ReaderStateChanged> StateChangedTo(this IReader reader, ReaderState state, CancellationToken cancellationToken = default)
-        {
-            var newState = await reader.OnStateChangeTo(state, cancellationToken).ConfigureAwait(false);
-            return new ReaderStateChanged(reader, newState);
-        }
-
-        /// <summary>
-        /// Wait for the state to change from a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        public static async ValueTask<ReaderStateChanged> StateChangedFrom(this IReader reader, ReaderState state, CancellationToken cancellationToken = default)
-        {
-            var newState = await reader.OnStateChangeFrom(state, cancellationToken).ConfigureAwait(false);
-            return new ReaderStateChanged(reader, newState);
-        }
+        var newState = await reader.OnStateChangeFrom(state, cancellationToken).ConfigureAwait(false);
+        return new ReaderStateChanged(reader, newState);
     }
 }
diff --git a/src/DotPulsar/Extensions/ReceiveExtensions.cs b/src/DotPulsar/Extensions/ReceiveExtensions.cs
index 5a165a6..bac5a22 100644
--- a/src/DotPulsar/Extensions/ReceiveExtensions.cs
+++ b/src/DotPulsar/Extensions/ReceiveExtensions.cs
@@ -12,25 +12,24 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
-{
-    using DotPulsar.Abstractions;
-    using System.Collections.Generic;
-    using System.Runtime.CompilerServices;
-    using System.Threading;
+namespace DotPulsar.Extensions;
 
+using DotPulsar.Abstractions;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+/// <summary>
+/// Extensions for IReceive.
+/// </summary>
+public static class ReceiveExtensions
+{
     /// <summary>
-    /// Extensions for IReceive.
+    /// Get an IAsyncEnumerable for receiving messages.
     /// </summary>
-    public static class ReceiveExtensions
+    public static async IAsyncEnumerable<TMessage> Messages<TMessage>(this IReceive<TMessage> receiver, [EnumeratorCancellation] CancellationToken cancellationToken = default)
     {
-        /// <summary>
-        /// Get an IAsyncEnumerable for receiving messages.
-        /// </summary>
-        public static async IAsyncEnumerable<TMessage> Messages<TMessage>(this IReceive<TMessage> receiver, [EnumeratorCancellation] CancellationToken cancellationToken = default)
-        {
-            while (!cancellationToken.IsCancellationRequested)
-                yield return await receiver.Receive(cancellationToken).ConfigureAwait(false);
-        }
+        while (!cancellationToken.IsCancellationRequested)
+            yield return await receiver.Receive(cancellationToken).ConfigureAwait(false);
     }
 }
diff --git a/src/DotPulsar/Extensions/SeekExtensions.cs b/src/DotPulsar/Extensions/SeekExtensions.cs
index b4f0d2c..d2dfdec 100644
--- a/src/DotPulsar/Extensions/SeekExtensions.cs
+++ b/src/DotPulsar/Extensions/SeekExtensions.cs
@@ -12,28 +12,27 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for ISeek.
+/// </summary>
+public static class SeekExtensions
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Reset the cursor associated with the consumer or reader to a specific message publish time using an UTC DateTime.
+    /// </summary>
+    public static async ValueTask Seek(this ISeek seeker, DateTime publishTime, CancellationToken cancellationToken = default)
+        => await seeker.Seek((ulong) new DateTimeOffset(publishTime).ToUnixTimeMilliseconds(), cancellationToken).ConfigureAwait(false);
 
     /// <summary>
-    /// Extensions for ISeek.
+    /// Reset the cursor associated with the consumer or reader to a specific message publish time using a DateTimeOffset.
     /// </summary>
-    public static class SeekExtensions
-    {
-        /// <summary>
-        /// Reset the cursor associated with the consumer or reader to a specific message publish time using an UTC DateTime.
-        /// </summary>
-        public static async ValueTask Seek(this ISeek seeker, DateTime publishTime, CancellationToken cancellationToken = default)
-            => await seeker.Seek((ulong) new DateTimeOffset(publishTime).ToUnixTimeMilliseconds(), cancellationToken).ConfigureAwait(false);
-
-        /// <summary>
-        /// Reset the cursor associated with the consumer or reader to a specific message publish time using a DateTimeOffset.
-        /// </summary>
-        public static async ValueTask Seek(this ISeek seeker, DateTimeOffset publishTime, CancellationToken cancellationToken = default)
-            => await seeker.Seek((ulong) publishTime.ToUnixTimeMilliseconds(), cancellationToken).ConfigureAwait(false);
-    }
+    public static async ValueTask Seek(this ISeek seeker, DateTimeOffset publishTime, CancellationToken cancellationToken = default)
+        => await seeker.Seek((ulong) publishTime.ToUnixTimeMilliseconds(), cancellationToken).ConfigureAwait(false);
 }
diff --git a/src/DotPulsar/Extensions/SendExtensions.cs b/src/DotPulsar/Extensions/SendExtensions.cs
index 479fe69..0c3a2bf 100644
--- a/src/DotPulsar/Extensions/SendExtensions.cs
+++ b/src/DotPulsar/Extensions/SendExtensions.cs
@@ -12,68 +12,67 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Extensions
+namespace DotPulsar.Extensions;
+
+using Abstractions;
+using Microsoft.Extensions.ObjectPool;
+using System;
+using System.Buffers;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Extensions for ISend.
+/// </summary>
+public static class SendExtensions
 {
-    using Abstractions;
-    using Microsoft.Extensions.ObjectPool;
-    using System;
-    using System.Buffers;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private static readonly ObjectPool<MessageMetadata> _messageMetadataPool;
+
+    static SendExtensions()
+    {
+        var messageMetadataPolicy = new DefaultPooledObjectPolicy<MessageMetadata>();
+        _messageMetadataPool = new DefaultObjectPool<MessageMetadata>(messageMetadataPolicy);
+    }
 
     /// <summary>
-    /// Extensions for ISend.
+    /// Sends a message.
     /// </summary>
-    public static class SendExtensions
+    public static async ValueTask<MessageId> Send(this ISend<ReadOnlySequence<byte>> sender, byte[] data, CancellationToken cancellationToken = default)
+        => await Send(sender, new ReadOnlySequence<byte>(data), cancellationToken).ConfigureAwait(false);
+
+    /// <summary>
+    /// Sends a message.
+    /// </summary>
+    public static async ValueTask<MessageId> Send(this ISend<ReadOnlySequence<byte>> sender, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)
+        => await Send(sender, new ReadOnlySequence<byte>(data), cancellationToken).ConfigureAwait(false);
+
+    /// <summary>
+    /// Sends a message with metadata.
+    /// </summary>
+    public static async ValueTask<MessageId> Send(this ISend<ReadOnlySequence<byte>> sender, MessageMetadata metadata, byte[] data, CancellationToken cancellationToken = default)
+        => await sender.Send(metadata, new ReadOnlySequence<byte>(data), cancellationToken).ConfigureAwait(false);
+
+    /// <summary>
+    /// Sends a message with metadata.
+    /// </summary>
+    public static async ValueTask<MessageId> Send(this ISend<ReadOnlySequence<byte>> sender, MessageMetadata metadata, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)
+        => await sender.Send(metadata, new ReadOnlySequence<byte>(data), cancellationToken).ConfigureAwait(false);
+
+    /// <summary>
+    /// Sends a message without metadata.
+    /// </summary>
+    public static async ValueTask<MessageId> Send<TMessage>(this ISend<TMessage> sender, TMessage message, CancellationToken cancellationToken = default)
     {
-        private static readonly ObjectPool<MessageMetadata> _messageMetadataPool;
+        var metadata = _messageMetadataPool.Get();
 
-        static SendExtensions()
+        try
         {
-            var messageMetadataPolicy = new DefaultPooledObjectPolicy<MessageMetadata>();
-            _messageMetadataPool = new DefaultObjectPool<MessageMetadata>(messageMetadataPolicy);
+            return await sender.Send(metadata, message, cancellationToken).ConfigureAwait(false);
         }
-
-        /// <summary>
-        /// Sends a message.
-        /// </summary>
-        public static async ValueTask<MessageId> Send(this ISend<ReadOnlySequence<byte>> sender, byte[] data, CancellationToken cancellationToken = default)
-            => await Send(sender, new ReadOnlySequence<byte>(data), cancellationToken).ConfigureAwait(false);
-
-        /// <summary>
-        /// Sends a message.
-        /// </summary>
-        public static async ValueTask<MessageId> Send(this ISend<ReadOnlySequence<byte>> sender, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)
-            => await Send(sender, new ReadOnlySequence<byte>(data), cancellationToken).ConfigureAwait(false);
-
-        /// <summary>
-        /// Sends a message with metadata.
-        /// </summary>
-        public static async ValueTask<MessageId> Send(this ISend<ReadOnlySequence<byte>> sender, MessageMetadata metadata, byte[] data, CancellationToken cancellationToken = default)
-            => await sender.Send(metadata, new ReadOnlySequence<byte>(data), cancellationToken).ConfigureAwait(false);
-
-        /// <summary>
-        /// Sends a message with metadata.
-        /// </summary>
-        public static async ValueTask<MessageId> Send(this ISend<ReadOnlySequence<byte>> sender, MessageMetadata metadata, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default)
-            => await sender.Send(metadata, new ReadOnlySequence<byte>(data), cancellationToken).ConfigureAwait(false);
-
-        /// <summary>
-        /// Sends a message without metadata.
-        /// </summary>
-        public static async ValueTask<MessageId> Send<TMessage>(this ISend<TMessage> sender, TMessage message, CancellationToken cancellationToken = default)
+        finally
         {
-            var metadata = _messageMetadataPool.Get();
-
-            try
-            {
-                return await sender.Send(metadata, message, cancellationToken).ConfigureAwait(false);
-            }
-            finally
-            {
-                metadata.Metadata.Properties.Clear();
-                _messageMetadataPool.Return(metadata);
-            }
+            metadata.Metadata.Properties.Clear();
+            _messageMetadataPool.Return(metadata);
         }
     }
 }
diff --git a/src/DotPulsar/FaultAction.cs b/src/DotPulsar/FaultAction.cs
index c6475a8..fc58e5f 100644
--- a/src/DotPulsar/FaultAction.cs
+++ b/src/DotPulsar/FaultAction.cs
@@ -12,26 +12,25 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// Actions to take when an exception has been caught while executing an operation.
+/// </summary>
+public enum FaultAction : byte
 {
     /// <summary>
-    /// Actions to take when an exception has been caught while executing an operation.
+    /// Rethrow the exception.
     /// </summary>
-    public enum FaultAction : byte
-    {
-        /// <summary>
-        /// Rethrow the exception.
-        /// </summary>
-        Rethrow,
+    Rethrow,
 
-        /// <summary>
-        /// Throw the exception from the ExceptionContext.
-        /// </summary>
-        ThrowException,
+    /// <summary>
+    /// Throw the exception from the ExceptionContext.
+    /// </summary>
+    ThrowException,
 
-        /// <summary>
-        /// Retry the operation.
-        /// </summary>
-        Retry
-    }
+    /// <summary>
+    /// Retry the operation.
+    /// </summary>
+    Retry
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IChannel.cs b/src/DotPulsar/Internal/Abstractions/IChannel.cs
index d9409dd..2549e7f 100644
--- a/src/DotPulsar/Internal/Abstractions/IChannel.cs
+++ b/src/DotPulsar/Internal/Abstractions/IChannel.cs
@@ -12,20 +12,19 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IChannel
-    {
-        void Received(MessagePackage message);
-        void Activated();
-        void ClosedByServer();
-        void Connected();
-        void Deactivated();
-        void Disconnected();
-        void ReachedEndOfTopic();
-        void Unsubscribed();
-        IDisposable SenderLock();
-    }
+using System;
+
+public interface IChannel
+{
+    void Received(MessagePackage message);
+    void Activated();
+    void ClosedByServer();
+    void Connected();
+    void Deactivated();
+    void Disconnected();
+    void ReachedEndOfTopic();
+    void Unsubscribed();
+    IDisposable SenderLock();
 }
diff --git a/src/DotPulsar/Internal/Abstractions/ICompress.cs b/src/DotPulsar/Internal/Abstractions/ICompress.cs
index 39ea5a0..de7fe49 100644
--- a/src/DotPulsar/Internal/Abstractions/ICompress.cs
+++ b/src/DotPulsar/Internal/Abstractions/ICompress.cs
@@ -12,13 +12,12 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System;
-    using System.Buffers;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface ICompress : IDisposable
-    {
-        ReadOnlySequence<byte> Compress(ReadOnlySequence<byte> data);
-    }
+using System;
+using System.Buffers;
+
+public interface ICompress : IDisposable
+{
+    ReadOnlySequence<byte> Compress(ReadOnlySequence<byte> data);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/ICompressorFactory.cs b/src/DotPulsar/Internal/Abstractions/ICompressorFactory.cs
index f658e24..90249f0 100644
--- a/src/DotPulsar/Internal/Abstractions/ICompressorFactory.cs
+++ b/src/DotPulsar/Internal/Abstractions/ICompressorFactory.cs
@@ -12,13 +12,12 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using DotPulsar.Internal.PulsarApi;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface ICompressorFactory
-    {
-        CompressionType CompressionType { get; }
-        ICompress Create();
-    }
+using DotPulsar.Internal.PulsarApi;
+
+public interface ICompressorFactory
+{
+    CompressionType CompressionType { get; }
+    ICompress Create();
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IConnection.cs b/src/DotPulsar/Internal/Abstractions/IConnection.cs
index f6c7092..e6e81d8 100644
--- a/src/DotPulsar/Internal/Abstractions/IConnection.cs
+++ b/src/DotPulsar/Internal/Abstractions/IConnection.cs
@@ -12,35 +12,34 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
+namespace DotPulsar.Internal.Abstractions;
+
+using PulsarApi;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IConnection : IAsyncDisposable
 {
-    using PulsarApi;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    ValueTask<bool> HasChannels(CancellationToken cancellationToken);
 
-    public interface IConnection : IAsyncDisposable
-    {
-        ValueTask<bool> HasChannels(CancellationToken cancellationToken);
+    Task<ProducerResponse> Send(CommandProducer command, IChannel channel, CancellationToken cancellationToken);
+    Task<SubscribeResponse> Send(CommandSubscribe command, IChannel channel, CancellationToken cancellationToken);
 
-        Task<ProducerResponse> Send(CommandProducer command, IChannel channel, CancellationToken cancellationToken);
-        Task<SubscribeResponse> Send(CommandSubscribe command, IChannel channel, CancellationToken cancellationToken);
+    Task Send(CommandPing command, CancellationToken cancellationToken);
+    Task Send(CommandPong command, CancellationToken cancellationToken);
+    Task Send(CommandAck command, CancellationToken cancellationToken);
+    Task Send(CommandFlow command, CancellationToken cancellationToken);
+    Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken);
 
-        Task Send(CommandPing command, CancellationToken cancellationToken);
-        Task Send(CommandPong command, CancellationToken cancellationToken);
-        Task Send(CommandAck command, CancellationToken cancellationToken);
-        Task Send(CommandFlow command, CancellationToken cancellationToken);
-        Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken);
-
-        Task<BaseCommand> Send(CommandUnsubscribe command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(CommandConnect command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(CommandLookupTopic command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(CommandSeek command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(CommandGetLastMessageId command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(CommandCloseProducer command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(CommandCloseConsumer command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(SendPackage command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(CommandGetOrCreateSchema command, CancellationToken cancellationToken);
-        Task<BaseCommand> Send(CommandPartitionedTopicMetadata command, CancellationToken cancellationToken);
-    }
+    Task<BaseCommand> Send(CommandUnsubscribe command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(CommandConnect command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(CommandLookupTopic command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(CommandSeek command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(CommandGetLastMessageId command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(CommandCloseProducer command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(CommandCloseConsumer command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(SendPackage command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(CommandGetOrCreateSchema command, CancellationToken cancellationToken);
+    Task<BaseCommand> Send(CommandPartitionedTopicMetadata command, CancellationToken cancellationToken);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IConnectionPool.cs b/src/DotPulsar/Internal/Abstractions/IConnectionPool.cs
index ad313b1..f7e82d9 100644
--- a/src/DotPulsar/Internal/Abstractions/IConnectionPool.cs
+++ b/src/DotPulsar/Internal/Abstractions/IConnectionPool.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IConnectionPool : IAsyncDisposable
-    {
-        ValueTask<IConnection> FindConnectionForTopic(string topic, CancellationToken cancellationToken = default);
-    }
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IConnectionPool : IAsyncDisposable
+{
+    ValueTask<IConnection> FindConnectionForTopic(string topic, CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IConsumerChannel.cs b/src/DotPulsar/Internal/Abstractions/IConsumerChannel.cs
index a359508..b984fe5 100644
--- a/src/DotPulsar/Internal/Abstractions/IConsumerChannel.cs
+++ b/src/DotPulsar/Internal/Abstractions/IConsumerChannel.cs
@@ -12,22 +12,21 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using DotPulsar.Abstractions;
-    using PulsarApi;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IConsumerChannel<TMessage> : IAsyncDisposable
-    {
-        Task Send(CommandAck command, CancellationToken cancellationToken);
-        Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken);
-        Task Send(CommandUnsubscribe command, CancellationToken cancellationToken);
-        Task Send(CommandSeek command, CancellationToken cancellationToken);
-        Task<MessageId> Send(CommandGetLastMessageId command, CancellationToken cancellationToken);
-        ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken);
-        ValueTask ClosedByClient(CancellationToken cancellationToken);
-    }
+using DotPulsar.Abstractions;
+using PulsarApi;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IConsumerChannel<TMessage> : IAsyncDisposable
+{
+    Task Send(CommandAck command, CancellationToken cancellationToken);
+    Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken);
+    Task Send(CommandUnsubscribe command, CancellationToken cancellationToken);
+    Task Send(CommandSeek command, CancellationToken cancellationToken);
+    Task<MessageId> Send(CommandGetLastMessageId command, CancellationToken cancellationToken);
+    ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken);
+    ValueTask ClosedByClient(CancellationToken cancellationToken);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IConsumerChannelFactory.cs b/src/DotPulsar/Internal/Abstractions/IConsumerChannelFactory.cs
index 76fb932..99e196b 100644
--- a/src/DotPulsar/Internal/Abstractions/IConsumerChannelFactory.cs
+++ b/src/DotPulsar/Internal/Abstractions/IConsumerChannelFactory.cs
@@ -12,13 +12,12 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IConsumerChannelFactory<TMessage>
-    {
-        Task<IConsumerChannel<TMessage>> Create(CancellationToken cancellationToken = default);
-    }
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IConsumerChannelFactory<TMessage>
+{
+    Task<IConsumerChannel<TMessage>> Create(CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IDecompress.cs b/src/DotPulsar/Internal/Abstractions/IDecompress.cs
index 0584a26..14f8ebd 100644
--- a/src/DotPulsar/Internal/Abstractions/IDecompress.cs
+++ b/src/DotPulsar/Internal/Abstractions/IDecompress.cs
@@ -12,13 +12,12 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System;
-    using System.Buffers;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IDecompress : IDisposable
-    {
-        ReadOnlySequence<byte> Decompress(ReadOnlySequence<byte> data, int decompressedSize);
-    }
+using System;
+using System.Buffers;
+
+public interface IDecompress : IDisposable
+{
+    ReadOnlySequence<byte> Decompress(ReadOnlySequence<byte> data, int decompressedSize);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IDecompressorFactory.cs b/src/DotPulsar/Internal/Abstractions/IDecompressorFactory.cs
index 7cbbd96..bccbf10 100644
--- a/src/DotPulsar/Internal/Abstractions/IDecompressorFactory.cs
+++ b/src/DotPulsar/Internal/Abstractions/IDecompressorFactory.cs
@@ -12,13 +12,12 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using DotPulsar.Internal.PulsarApi;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IDecompressorFactory
-    {
-        CompressionType CompressionType { get; }
-        IDecompress Create();
-    }
+using DotPulsar.Internal.PulsarApi;
+
+public interface IDecompressorFactory
+{
+    CompressionType CompressionType { get; }
+    IDecompress Create();
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IDequeue.cs b/src/DotPulsar/Internal/Abstractions/IDequeue.cs
index f99da40..3bf46d8 100644
--- a/src/DotPulsar/Internal/Abstractions/IDequeue.cs
+++ b/src/DotPulsar/Internal/Abstractions/IDequeue.cs
@@ -12,13 +12,12 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IDequeue<T>
-    {
-        ValueTask<T> Dequeue(CancellationToken cancellationToken = default);
-    }
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IDequeue<T>
+{
+    ValueTask<T> Dequeue(CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IEnqueue.cs b/src/DotPulsar/Internal/Abstractions/IEnqueue.cs
index c5794b7..6617d16 100644
--- a/src/DotPulsar/Internal/Abstractions/IEnqueue.cs
+++ b/src/DotPulsar/Internal/Abstractions/IEnqueue.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
+namespace DotPulsar.Internal.Abstractions;
+
+public interface IEnqueue<T>
 {
-    public interface IEnqueue<T>
-    {
-        void Enqueue(T item);
-    }
+    void Enqueue(T item);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IEstablishNewChannel.cs b/src/DotPulsar/Internal/Abstractions/IEstablishNewChannel.cs
index bcf8723..972fe77 100644
--- a/src/DotPulsar/Internal/Abstractions/IEstablishNewChannel.cs
+++ b/src/DotPulsar/Internal/Abstractions/IEstablishNewChannel.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IEstablishNewChannel : IAsyncDisposable
-    {
-        Task EstablishNewChannel(CancellationToken cancellationToken);
-    }
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IEstablishNewChannel : IAsyncDisposable
+{
+    Task EstablishNewChannel(CancellationToken cancellationToken);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IEvent.cs b/src/DotPulsar/Internal/Abstractions/IEvent.cs
index f399d4e..52e8372 100644
--- a/src/DotPulsar/Internal/Abstractions/IEvent.cs
+++ b/src/DotPulsar/Internal/Abstractions/IEvent.cs
@@ -1,4 +1,4 @@
-/*
+/*
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IEvent
-    {
-        Guid CorrelationId { get; }
-    }
+using System;
+
+public interface IEvent
+{
+    Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IExecute.cs b/src/DotPulsar/Internal/Abstractions/IExecute.cs
index 1b4ec62..ad9b07f 100644
--- a/src/DotPulsar/Internal/Abstractions/IExecute.cs
+++ b/src/DotPulsar/Internal/Abstractions/IExecute.cs
@@ -12,24 +12,23 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
+namespace DotPulsar.Internal.Abstractions;
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IExecute
 {
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    ValueTask Execute(Action action, CancellationToken cancellationToken = default);
 
-    public interface IExecute
-    {
-        ValueTask Execute(Action action, CancellationToken cancellationToken = default);
+    ValueTask Execute(Func<Task> func, CancellationToken cancellationToken = default);
 
-        ValueTask Execute(Func<Task> func, CancellationToken cancellationToken = default);
+    ValueTask Execute(Func<ValueTask> func, CancellationToken cancellationToken = default);
 
-        ValueTask Execute(Func<ValueTask> func, CancellationToken cancellationToken = default);
+    ValueTask<TResult> Execute<TResult>(Func<TResult> func, CancellationToken cancellationToken = default);
 
-        ValueTask<TResult> Execute<TResult>(Func<TResult> func, CancellationToken cancellationToken = default);
+    ValueTask<TResult> Execute<TResult>(Func<Task<TResult>> func, CancellationToken cancellationToken = default);
 
-        ValueTask<TResult> Execute<TResult>(Func<Task<TResult>> func, CancellationToken cancellationToken = default);
-
-        ValueTask<TResult> Execute<TResult>(Func<ValueTask<TResult>> func, CancellationToken cancellationToken = default);
-    }
+    ValueTask<TResult> Execute<TResult>(Func<ValueTask<TResult>> func, CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IMessageFactory.cs b/src/DotPulsar/Internal/Abstractions/IMessageFactory.cs
index ebdb3ee..59009cd 100644
--- a/src/DotPulsar/Internal/Abstractions/IMessageFactory.cs
+++ b/src/DotPulsar/Internal/Abstractions/IMessageFactory.cs
@@ -12,14 +12,13 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal.PulsarApi;
-    using System.Buffers;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IMessageFactory<TValue>
-    {
-        IMessage<TValue> Create(MessageId messageId, uint redeliveryCount, ReadOnlySequence<byte> data, MessageMetadata metadata, SingleMessageMetadata? singleMetadata = null);
-    }
+using DotPulsar.Abstractions;
+using DotPulsar.Internal.PulsarApi;
+using System.Buffers;
+
+public interface IMessageFactory<TValue>
+{
+    IMessage<TValue> Create(MessageId messageId, uint redeliveryCount, ReadOnlySequence<byte> data, MessageMetadata metadata, SingleMessageMetadata? singleMetadata = null);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IProcess.cs b/src/DotPulsar/Internal/Abstractions/IProcess.cs
index 4c48c39..831f456 100644
--- a/src/DotPulsar/Internal/Abstractions/IProcess.cs
+++ b/src/DotPulsar/Internal/Abstractions/IProcess.cs
@@ -12,15 +12,14 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
+namespace DotPulsar.Internal.Abstractions;
+
+using System;
+
+public interface IProcess : IAsyncDisposable
 {
-    using System;
+    Guid CorrelationId { get; }
 
-    public interface IProcess : IAsyncDisposable
-    {
-        Guid CorrelationId { get; }
-
-        void Start();
-        void Handle(IEvent @event);
-    }
+    void Start();
+    void Handle(IEvent @event);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IProducerChannel.cs b/src/DotPulsar/Internal/Abstractions/IProducerChannel.cs
index b214237..df6b291 100644
--- a/src/DotPulsar/Internal/Abstractions/IProducerChannel.cs
+++ b/src/DotPulsar/Internal/Abstractions/IProducerChannel.cs
@@ -12,17 +12,16 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using PulsarApi;
-    using System;
-    using System.Buffers;
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IProducerChannel : IAsyncDisposable
-    {
-        Task<CommandSendReceipt> Send(MessageMetadata metadata, ReadOnlySequence<byte> payload, CancellationToken cancellationToken);
-        ValueTask ClosedByClient(CancellationToken cancellationToken);
-    }
+using PulsarApi;
+using System;
+using System.Buffers;
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IProducerChannel : IAsyncDisposable
+{
+    Task<CommandSendReceipt> Send(MessageMetadata metadata, ReadOnlySequence<byte> payload, CancellationToken cancellationToken);
+    ValueTask ClosedByClient(CancellationToken cancellationToken);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IProducerChannelFactory.cs b/src/DotPulsar/Internal/Abstractions/IProducerChannelFactory.cs
index 2f84785..eb7085a 100644
--- a/src/DotPulsar/Internal/Abstractions/IProducerChannelFactory.cs
+++ b/src/DotPulsar/Internal/Abstractions/IProducerChannelFactory.cs
@@ -12,13 +12,12 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IProducerChannelFactory
-    {
-        Task<IProducerChannel> Create(CancellationToken cancellationToken = default);
-    }
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IProducerChannelFactory
+{
+    Task<IProducerChannel> Create(CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IPulsarStream.cs b/src/DotPulsar/Internal/Abstractions/IPulsarStream.cs
index 0ce67ef..c562528 100644
--- a/src/DotPulsar/Internal/Abstractions/IPulsarStream.cs
+++ b/src/DotPulsar/Internal/Abstractions/IPulsarStream.cs
@@ -12,17 +12,16 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IPulsarStream : IAsyncDisposable
-    {
-        Task Send(ReadOnlySequence<byte> sequence);
-        IAsyncEnumerable<ReadOnlySequence<byte>> Frames(CancellationToken cancellationToken = default);
-    }
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+public interface IPulsarStream : IAsyncDisposable
+{
+    Task Send(ReadOnlySequence<byte> sequence);
+    IAsyncEnumerable<ReadOnlySequence<byte>> Frames(CancellationToken cancellationToken = default);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IRegisterEvent.cs b/src/DotPulsar/Internal/Abstractions/IRegisterEvent.cs
index ef3b427..2470ccd 100644
--- a/src/DotPulsar/Internal/Abstractions/IRegisterEvent.cs
+++ b/src/DotPulsar/Internal/Abstractions/IRegisterEvent.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
+namespace DotPulsar.Internal.Abstractions;
+
+public interface IRegisterEvent
 {
-    public interface IRegisterEvent
-    {
-        void Register(IEvent @event);
-    }
+    void Register(IEvent @event);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IRequest.cs b/src/DotPulsar/Internal/Abstractions/IRequest.cs
index 0841e26..1f8508d 100644
--- a/src/DotPulsar/Internal/Abstractions/IRequest.cs
+++ b/src/DotPulsar/Internal/Abstractions/IRequest.cs
@@ -12,15 +12,14 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
-{
-    using DotPulsar.Internal.PulsarApi;
-    using System;
+namespace DotPulsar.Internal.Abstractions;
 
-    public interface IRequest : IEquatable<IRequest>
-    {
-        bool SenderIsProducer(ulong producerId);
-        bool SenderIsConsumer(ulong consumerId);
-        bool IsCommandType(BaseCommand.Type commandType);
-    }
+using DotPulsar.Internal.PulsarApi;
+using System;
+
+public interface IRequest : IEquatable<IRequest>
+{
+    bool SenderIsProducer(ulong producerId);
+    bool SenderIsConsumer(ulong consumerId);
+    bool IsCommandType(BaseCommand.Type commandType);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IStateChanged.cs b/src/DotPulsar/Internal/Abstractions/IStateChanged.cs
index da45aa0..a1de336 100644
--- a/src/DotPulsar/Internal/Abstractions/IStateChanged.cs
+++ b/src/DotPulsar/Internal/Abstractions/IStateChanged.cs
@@ -12,52 +12,51 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
+namespace DotPulsar.Internal.Abstractions;
+
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// A state change monitoring abstraction.
+/// </summary>
+public interface IStateChanged<TState> where TState : notnull
 {
-    using System.Threading;
-    using System.Threading.Tasks;
+    /// <summary>
+    /// Wait for the state to change to a specific state.
+    /// </summary>
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    ValueTask<TState> StateChangedTo(TState state, CancellationToken cancellationToken = default);
 
     /// <summary>
-    /// A state change monitoring abstraction.
+    /// Wait for the state to change from a specific state.
     /// </summary>
-    public interface IStateChanged<TState> where TState : notnull
-    {
-        /// <summary>
-        /// Wait for the state to change to a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        ValueTask<TState> StateChangedTo(TState state, CancellationToken cancellationToken = default);
+    /// <returns>
+    /// The current state.
+    /// </returns>
+    /// <remarks>
+    /// If the state change to a final state, then all awaiting tasks will complete.
+    /// </remarks>
+    ValueTask<TState> StateChangedFrom(TState state, CancellationToken cancellationToken = default);
 
-        /// <summary>
-        /// Wait for the state to change from a specific state.
-        /// </summary>
-        /// <returns>
-        /// The current state.
-        /// </returns>
-        /// <remarks>
-        /// If the state change to a final state, then all awaiting tasks will complete.
-        /// </remarks>
-        ValueTask<TState> StateChangedFrom(TState state, CancellationToken cancellationToken = default);
+    /// <summary>
+    /// Ask whether the current state is final, meaning that it will never change.
+    /// </summary>
+    /// <returns>
+    /// True if it's final and False if it's not.
+    /// </returns>
+    bool IsFinalState();
 
-        /// <summary>
-        /// Ask whether the current state is final, meaning that it will never change.
-        /// </summary>
-        /// <returns>
-        /// True if it's final and False if it's not.
-        /// </returns>
-        bool IsFinalState();
-
-        /// <summary>
-        /// Ask whether the provided state is final, meaning that it will never change.
-        /// </summary>
-        /// <returns>
-        /// True if it's final and False if it's not.
-        /// </returns>
-        bool IsFinalState(TState state);
-    }
+    /// <summary>
+    /// Ask whether the provided state is final, meaning that it will never change.
+    /// </summary>
+    /// <returns>
+    /// True if it's final and False if it's not.
+    /// </returns>
+    bool IsFinalState(TState state);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/IStateManager.cs b/src/DotPulsar/Internal/Abstractions/IStateManager.cs
index 19e616c..135a2ac 100644
--- a/src/DotPulsar/Internal/Abstractions/IStateManager.cs
+++ b/src/DotPulsar/Internal/Abstractions/IStateManager.cs
@@ -12,11 +12,10 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
+namespace DotPulsar.Internal.Abstractions;
+
+public interface IStateManager<TState> : IStateChanged<TState> where TState : notnull
 {
-    public interface IStateManager<TState> : IStateChanged<TState> where TState : notnull
-    {
-        TState CurrentState { get; }
-        TState SetState(TState state);
-    }
+    TState CurrentState { get; }
+    TState SetState(TState state);
 }
diff --git a/src/DotPulsar/Internal/Abstractions/Process.cs b/src/DotPulsar/Internal/Abstractions/Process.cs
index 056471a..85d1582 100644
--- a/src/DotPulsar/Internal/Abstractions/Process.cs
+++ b/src/DotPulsar/Internal/Abstractions/Process.cs
@@ -12,67 +12,66 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Abstractions
+namespace DotPulsar.Internal.Abstractions;
+
+using Events;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public abstract class Process : IProcess
 {
-    using Events;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    protected readonly CancellationTokenSource CancellationTokenSource;
+    protected ChannelState ChannelState;
+    protected ExecutorState ExecutorState;
 
-    public abstract class Process : IProcess
+    protected Process(Guid correlationId)
     {
-        protected readonly CancellationTokenSource CancellationTokenSource;
-        protected ChannelState ChannelState;
-        protected ExecutorState ExecutorState;
-
-        protected Process(Guid correlationId)
-        {
-            CancellationTokenSource = new CancellationTokenSource();
-            ChannelState = ChannelState.Disconnected;
-            ExecutorState = ExecutorState.Ok;
-            CorrelationId = correlationId;
-        }
-
-        public Guid CorrelationId { get; }
-
-        public void Start()
-            => CalculateState();
-
-        public abstract ValueTask DisposeAsync();
-
-        public void Handle(IEvent e)
-        {
-            switch (e)
-            {
-                case ExecutorFaulted _:
-                    ExecutorState = ExecutorState.Faulted;
-                    break;
-                case ChannelActivated _:
-                    ChannelState = ChannelState.Active;
-                    break;
-                case ChannelClosedByServer _:
-                    ChannelState = ChannelState.ClosedByServer;
-                    break;
-                case ChannelConnected _:
-                    ChannelState = ChannelState.Connected;
-                    break;
-                case ChannelDeactivated _:
-                    ChannelState = ChannelState.Inactive;
-                    break;
-                case ChannelDisconnected _:
-                    ChannelState = ChannelState.Disconnected;
-                    break;
-                case ChannelReachedEndOfTopic _:
-                    ChannelState = ChannelState.ReachedEndOfTopic;
-                    break;
-                case ChannelUnsubscribed _:
-                    ChannelState = ChannelState.Unsubscribed;
-                    break;
-            }
-
-            CalculateState();
-        }
-
-        protected abstract void CalculateState();
+        CancellationTokenSource = new CancellationTokenSource();
+        ChannelState = ChannelState.Disconnected;
+        ExecutorState = ExecutorState.Ok;
+        CorrelationId = correlationId;
     }
+
+    public Guid CorrelationId { get; }
+
+    public void Start()
+        => CalculateState();
+
+    public abstract ValueTask DisposeAsync();
+
+    public void Handle(IEvent e)
+    {
+        switch (e)
+        {
+            case ExecutorFaulted _:
+                ExecutorState = ExecutorState.Faulted;
+                break;
+            case ChannelActivated _:
+                ChannelState = ChannelState.Active;
+                break;
+            case ChannelClosedByServer _:
+                ChannelState = ChannelState.ClosedByServer;
+                break;
+            case ChannelConnected _:
+                ChannelState = ChannelState.Connected;
+                break;
+            case ChannelDeactivated _:
+                ChannelState = ChannelState.Inactive;
+                break;
+            case ChannelDisconnected _:
+                ChannelState = ChannelState.Disconnected;
+                break;
+            case ChannelReachedEndOfTopic _:
+                ChannelState = ChannelState.ReachedEndOfTopic;
+                break;
+            case ChannelUnsubscribed _:
+                ChannelState = ChannelState.Unsubscribed;
+                break;
+        }
+
+        CalculateState();
+    }
+
+    protected abstract void CalculateState();
 }
diff --git a/src/DotPulsar/Internal/ActionExceptionHandler.cs b/src/DotPulsar/Internal/ActionExceptionHandler.cs
index 0327153..1c8ce6f 100644
--- a/src/DotPulsar/Internal/ActionExceptionHandler.cs
+++ b/src/DotPulsar/Internal/ActionExceptionHandler.cs
@@ -12,23 +12,22 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Threading.Tasks;
+
+public sealed class ActionExceptionHandler : IHandleException
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Threading.Tasks;
+    private readonly Action<ExceptionContext> _exceptionHandler;
 
-    public sealed class ActionExceptionHandler : IHandleException
+    public ActionExceptionHandler(Action<ExceptionContext> exceptionHandler)
+        => _exceptionHandler = exceptionHandler;
+
+    public ValueTask OnException(ExceptionContext exceptionContext)
     {
-        private readonly Action<ExceptionContext> _exceptionHandler;
-
-        public ActionExceptionHandler(Action<ExceptionContext> exceptionHandler)
-            => _exceptionHandler = exceptionHandler;
-
-        public ValueTask OnException(ExceptionContext exceptionContext)
-        {
-            _exceptionHandler(exceptionContext);
-            return new ValueTask();
-        }
+        _exceptionHandler(exceptionContext);
+        return new ValueTask();
     }
 }
diff --git a/src/DotPulsar/Internal/ActionStateChangedHandler.cs b/src/DotPulsar/Internal/ActionStateChangedHandler.cs
index 804d7b3..274441d 100644
--- a/src/DotPulsar/Internal/ActionStateChangedHandler.cs
+++ b/src/DotPulsar/Internal/ActionStateChangedHandler.cs
@@ -12,29 +12,28 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class ActionStateChangedHandler<TStateChanged> : IHandleStateChanged<TStateChanged>
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly Action<TStateChanged, CancellationToken> _stateChangedHandler;
 
-    public sealed class ActionStateChangedHandler<TStateChanged> : IHandleStateChanged<TStateChanged>
+    public ActionStateChangedHandler(Action<TStateChanged, CancellationToken> stateChangedHandler, CancellationToken cancellationToken)
     {
-        private readonly Action<TStateChanged, CancellationToken> _stateChangedHandler;
+        _stateChangedHandler = stateChangedHandler;
+        CancellationToken = cancellationToken;
+    }
 
-        public ActionStateChangedHandler(Action<TStateChanged, CancellationToken> stateChangedHandler, CancellationToken cancellationToken)
-        {
-            _stateChangedHandler = stateChangedHandler;
-            CancellationToken = cancellationToken;
-        }
+    public CancellationToken CancellationToken { get; }
 
-        public CancellationToken CancellationToken { get; }
-
-        public ValueTask OnStateChanged(TStateChanged stateChanged, CancellationToken cancellationToken)
-        {
-            _stateChangedHandler(stateChanged, CancellationToken);
-            return new ValueTask();
-        }
+    public ValueTask OnStateChanged(TStateChanged stateChanged, CancellationToken cancellationToken)
+    {
+        _stateChangedHandler(stateChanged, CancellationToken);
+        return new ValueTask();
     }
 }
diff --git a/src/DotPulsar/Internal/AsyncLock.cs b/src/DotPulsar/Internal/AsyncLock.cs
index 432eb37..a572dde 100644
--- a/src/DotPulsar/Internal/AsyncLock.cs
+++ b/src/DotPulsar/Internal/AsyncLock.cs
@@ -12,122 +12,121 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Exceptions;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class AsyncLock : IAsyncDisposable
 {
-    using Exceptions;
-    using System;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly LinkedList<CancelableCompletionSource<IDisposable>> _pending;
+    private readonly SemaphoreSlim _semaphoreSlim;
+    private readonly Releaser _releaser;
+    private readonly Task<IDisposable> _completedTask;
+    private int _isDisposed;
 
-    public sealed class AsyncLock : IAsyncDisposable
+    public AsyncLock()
     {
-        private readonly LinkedList<CancelableCompletionSource<IDisposable>> _pending;
-        private readonly SemaphoreSlim _semaphoreSlim;
-        private readonly Releaser _releaser;
-        private readonly Task<IDisposable> _completedTask;
-        private int _isDisposed;
+        _pending = new LinkedList<CancelableCompletionSource<IDisposable>>();
+        _semaphoreSlim = new SemaphoreSlim(1, 1);
+        _releaser = new Releaser(Release);
+        _completedTask = Task.FromResult((IDisposable) _releaser);
+    }
 
-        public AsyncLock()
+    public Task<IDisposable> Lock(CancellationToken cancellationToken)
+    {
+        LinkedListNode<CancelableCompletionSource<IDisposable>>? node = null;
+
+        lock (_pending)
         {
-            _pending = new LinkedList<CancelableCompletionSource<IDisposable>>();
-            _semaphoreSlim = new SemaphoreSlim(1, 1);
-            _releaser = new Releaser(Release);
-            _completedTask = Task.FromResult((IDisposable) _releaser);
-        }
+            ThrowIfDisposed();
 
-        public Task<IDisposable> Lock(CancellationToken cancellationToken)
-        {
-            LinkedListNode<CancelableCompletionSource<IDisposable>>? node = null;
-
-            lock (_pending)
+            if (_semaphoreSlim.CurrentCount == 1) //Lock is free
             {
-                ThrowIfDisposed();
-
-                if (_semaphoreSlim.CurrentCount == 1) //Lock is free
-                {
-                    _semaphoreSlim.Wait(cancellationToken); //Will never block
-                    return _completedTask;
-                }
-
-                //Lock was not free
-                var ccs = new CancelableCompletionSource<IDisposable>();
-                node = _pending.AddLast(ccs);
+                _semaphoreSlim.Wait(cancellationToken); //Will never block
+                return _completedTask;
             }
 
-            cancellationToken.Register(() => Cancel(node));
-
-            return node.Value.Task;
+            //Lock was not free
+            var ccs = new CancelableCompletionSource<IDisposable>();
+            node = _pending.AddLast(ccs);
         }
 
-        public async ValueTask DisposeAsync()
+        cancellationToken.Register(() => Cancel(node));
+
+        return node.Value.Task;
+    }
+
+    public async ValueTask DisposeAsync()
+    {
+        lock (_pending)
         {
-            lock (_pending)
+            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+                return;
+
+            foreach (var pending in _pending)
+                pending.Dispose();
+
+            _pending.Clear();
+        }
+
+        await _semaphoreSlim.WaitAsync().ConfigureAwait(false); //Wait for possible lock-holder to finish
+
+        _semaphoreSlim.Release();
+        _semaphoreSlim.Dispose();
+    }
+
+    private void Cancel(LinkedListNode<CancelableCompletionSource<IDisposable>> node)
+    {
+        lock (_pending)
+        {
+            try
             {
-                if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
-                    return;
-
-                foreach (var pending in _pending)
-                    pending.Dispose();
-
-                _pending.Clear();
+                _pending.Remove(node);
+                node.Value.Dispose();
             }
-
-            await _semaphoreSlim.WaitAsync().ConfigureAwait(false); //Wait for possible lock-holder to finish
-
-            _semaphoreSlim.Release();
-            _semaphoreSlim.Dispose();
-        }
-
-        private void Cancel(LinkedListNode<CancelableCompletionSource<IDisposable>> node)
-        {
-            lock (_pending)
+            catch
             {
-                try
-                {
-                    _pending.Remove(node);
-                    node.Value.Dispose();
-                }
-                catch
-                {
-                    // Ignore
-                }
+                // Ignore
             }
         }
+    }
 
-        private void Release()
+    private void Release()
+    {
+        lock (_pending)
         {
-            lock (_pending)
+            var node = _pending.First;
+            if (node is not null)
             {
-                var node = _pending.First;
-                if (node is not null)
-                {
-                    node.Value.SetResult(_releaser);
-                    node.Value.Dispose();
-                    _pending.RemoveFirst();
-                    return;
-                }
-
-                if (_semaphoreSlim.CurrentCount == 0)
-                    _semaphoreSlim.Release();
+                node.Value.SetResult(_releaser);
+                node.Value.Dispose();
+                _pending.RemoveFirst();
+                return;
             }
+
+            if (_semaphoreSlim.CurrentCount == 0)
+                _semaphoreSlim.Release();
         }
+    }
 
-        private void ThrowIfDisposed()
-        {
-            if (_isDisposed != 0)
-                throw new AsyncLockDisposedException();
-        }
+    private void ThrowIfDisposed()
+    {
+        if (_isDisposed != 0)
+            throw new AsyncLockDisposedException();
+    }
 
-        private class Releaser : IDisposable
-        {
-            private readonly Action _release;
+    private class Releaser : IDisposable
+    {
+        private readonly Action _release;
 
-            public Releaser(Action release)
-                => _release = release;
+        public Releaser(Action release)
+            => _release = release;
 
-            public void Dispose()
-                => _release();
-        }
+        public void Dispose()
+            => _release();
     }
 }
diff --git a/src/DotPulsar/Internal/AsyncQueue.cs b/src/DotPulsar/Internal/AsyncQueue.cs
index 5c22c43..cca67cf 100644
--- a/src/DotPulsar/Internal/AsyncQueue.cs
+++ b/src/DotPulsar/Internal/AsyncQueue.cs
@@ -12,100 +12,99 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using Exceptions;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class AsyncQueue<T> : IEnqueue<T>, IDequeue<T>, IDisposable
 {
-    using Abstractions;
-    using Exceptions;
-    using System;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly object _lock;
+    private readonly Queue<T> _queue;
+    private readonly LinkedList<CancelableCompletionSource<T>> _pendingDequeues;
+    private int _isDisposed;
 
-    public sealed class AsyncQueue<T> : IEnqueue<T>, IDequeue<T>, IDisposable
+    public AsyncQueue()
     {
-        private readonly object _lock;
-        private readonly Queue<T> _queue;
-        private readonly LinkedList<CancelableCompletionSource<T>> _pendingDequeues;
-        private int _isDisposed;
+        _lock = new object();
+        _queue = new Queue<T>();
+        _pendingDequeues = new LinkedList<CancelableCompletionSource<T>>();
+    }
 
-        public AsyncQueue()
+    public void Enqueue(T item)
+    {
+        lock (_lock)
         {
-            _lock = new object();
-            _queue = new Queue<T>();
-            _pendingDequeues = new LinkedList<CancelableCompletionSource<T>>();
+            ThrowIfDisposed();
+
+            var node = _pendingDequeues.First;
+            if (node is not null)
+            {
+                node.Value.SetResult(item);
+                node.Value.Dispose();
+                _pendingDequeues.RemoveFirst();
+            }
+            else
+                _queue.Enqueue(item);
+        }
+    }
+
+    public ValueTask<T> Dequeue(CancellationToken cancellationToken = default)
+    {
+        LinkedListNode<CancelableCompletionSource<T>>? node = null;
+
+        lock (_lock)
+        {
+            ThrowIfDisposed();
+
+            if (_queue.Count > 0)
+                return new ValueTask<T>(_queue.Dequeue());
+
+            node = _pendingDequeues.AddLast(new CancelableCompletionSource<T>());
         }
 
-        public void Enqueue(T item)
-        {
-            lock (_lock)
-            {
-                ThrowIfDisposed();
+        node.Value.SetupCancellation(() => Cancel(node), cancellationToken);
+        return new ValueTask<T>(node.Value.Task);
+    }
 
-                var node = _pendingDequeues.First;
-                if (node is not null)
-                {
-                    node.Value.SetResult(item);
-                    node.Value.Dispose();
-                    _pendingDequeues.RemoveFirst();
-                }
-                else
-                    _queue.Enqueue(item);
+    public void Dispose()
+    {
+        lock (_lock)
+        {
+            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+                return;
+
+            foreach (var pendingDequeue in _pendingDequeues)
+                pendingDequeue.Dispose();
+
+            _pendingDequeues.Clear();
+            _queue.Clear();
+        }
+    }
+
+    private void Cancel(LinkedListNode<CancelableCompletionSource<T>> node)
+    {
+        lock (_lock)
+        {
+            try
+            {
+                node.Value.Dispose();
+                _pendingDequeues.Remove(node);
+            }
+            catch
+            {
+                // ignored
             }
         }
+    }
 
-        public ValueTask<T> Dequeue(CancellationToken cancellationToken = default)
-        {
-            LinkedListNode<CancelableCompletionSource<T>>? node = null;
-
-            lock (_lock)
-            {
-                ThrowIfDisposed();
-
-                if (_queue.Count > 0)
-                    return new ValueTask<T>(_queue.Dequeue());
-
-                node = _pendingDequeues.AddLast(new CancelableCompletionSource<T>());
-            }
-
-            node.Value.SetupCancellation(() => Cancel(node), cancellationToken);
-            return new ValueTask<T>(node.Value.Task);
-        }
-
-        public void Dispose()
-        {
-            lock (_lock)
-            {
-                if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
-                    return;
-
-                foreach (var pendingDequeue in _pendingDequeues)
-                    pendingDequeue.Dispose();
-
-                _pendingDequeues.Clear();
-                _queue.Clear();
-            }
-        }
-
-        private void Cancel(LinkedListNode<CancelableCompletionSource<T>> node)
-        {
-            lock (_lock)
-            {
-                try
-                {
-                    node.Value.Dispose();
-                    _pendingDequeues.Remove(node);
-                }
-                catch
-                {
-                    // ignored
-                }
-            }
-        }
-
-        private void ThrowIfDisposed()
-        {
-            if (_isDisposed != 0)
-                throw new AsyncQueueDisposedException();
-        }
+    private void ThrowIfDisposed()
+    {
+        if (_isDisposed != 0)
+            throw new AsyncQueueDisposedException();
     }
 }
diff --git a/src/DotPulsar/Internal/Awaiter.cs b/src/DotPulsar/Internal/Awaiter.cs
index 6cec51c..c7360c7 100644
--- a/src/DotPulsar/Internal/Awaiter.cs
+++ b/src/DotPulsar/Internal/Awaiter.cs
@@ -12,47 +12,46 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+public sealed class Awaiter<T, TResult> : IDisposable where T : notnull
 {
-    using System;
-    using System.Collections.Concurrent;
-    using System.Collections.Generic;
-    using System.Threading.Tasks;
+    private readonly ConcurrentDictionary<T, TaskCompletionSource<TResult>> _items;
 
-    public sealed class Awaiter<T, TResult> : IDisposable where T : notnull
+    public Awaiter()
+        => _items = new ConcurrentDictionary<T, TaskCompletionSource<TResult>>();
+
+    public Task<TResult> CreateTask(T item)
     {
-        private readonly ConcurrentDictionary<T, TaskCompletionSource<TResult>> _items;
+        var tcs = new TaskCompletionSource<TResult>(TaskCreationOptions.RunContinuationsAsynchronously);
+        _ = _items.TryAdd(item, tcs);
+        return tcs.Task;
+    }
 
-        public Awaiter()
-            => _items = new ConcurrentDictionary<T, TaskCompletionSource<TResult>>();
+    public void SetResult(T item, TResult result)
+    {
+        if (_items.TryRemove(item, out var tcs))
+            tcs.SetResult(result);
+    }
 
-        public Task<TResult> CreateTask(T item)
-        {
-            var tcs = new TaskCompletionSource<TResult>(TaskCreationOptions.RunContinuationsAsynchronously);
-            _ = _items.TryAdd(item, tcs);
-            return tcs.Task;
-        }
+    public void Cancel(T item)
+    {
+        if (_items.TryRemove(item, out var tcs))
+            tcs.SetCanceled();
+    }
 
-        public void SetResult(T item, TResult result)
-        {
-            if (_items.TryRemove(item, out var tcs))
-                tcs.SetResult(result);
-        }
+    public IEnumerable<T> Keys => _items.Keys;
 
-        public void Cancel(T item)
-        {
-            if (_items.TryRemove(item, out var tcs))
-                tcs.SetCanceled();
-        }
+    public void Dispose()
+    {
+        foreach (var item in _items.Values)
+            item.SetCanceled();
 
-        public IEnumerable<T> Keys => _items.Keys;
-
-        public void Dispose()
-        {
-            foreach (var item in _items.Values)
-                item.SetCanceled();
-
-            _items.Clear();
-        }
+        _items.Clear();
     }
 }
diff --git a/src/DotPulsar/Internal/BatchHandler.cs b/src/DotPulsar/Internal/BatchHandler.cs
index 60d2e9e..7ec382a 100644
--- a/src/DotPulsar/Internal/BatchHandler.cs
+++ b/src/DotPulsar/Internal/BatchHandler.cs
@@ -12,131 +12,130 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Internal.Abstractions;
+using Extensions;
+using PulsarApi;
+using System.Buffers;
+using System.Collections;
+using System.Collections.Generic;
+
+public sealed class BatchHandler<TMessage>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal.Abstractions;
-    using Extensions;
-    using PulsarApi;
-    using System.Buffers;
-    using System.Collections;
-    using System.Collections.Generic;
+    private readonly object _lock;
+    private readonly bool _trackBatches;
+    private readonly IMessageFactory<TMessage> _messageFactory;
+    private readonly Queue<IMessage<TMessage>> _messages;
+    private readonly LinkedList<Batch> _batches;
 
-    public sealed class BatchHandler<TMessage>
+    public BatchHandler(bool trackBatches, IMessageFactory<TMessage> messageFactory)
     {
-        private readonly object _lock;
-        private readonly bool _trackBatches;
-        private readonly IMessageFactory<TMessage> _messageFactory;
-        private readonly Queue<IMessage<TMessage>> _messages;
-        private readonly LinkedList<Batch> _batches;
+        _lock = new object();
+        _trackBatches = trackBatches;
+        _messageFactory = messageFactory;
+        _messages = new Queue<IMessage<TMessage>>();
+        _batches = new LinkedList<Batch>();
+    }
 
-        public BatchHandler(bool trackBatches, IMessageFactory<TMessage> messageFactory)
+    public IMessage<TMessage> Add(MessageIdData messageId, uint redeliveryCount, MessageMetadata metadata, ReadOnlySequence<byte> data)
+    {
+        var messages = new List<IMessage<TMessage>>(metadata.NumMessagesInBatch);
+
+        long index = 0;
+
+        for (var i = 0; i < metadata.NumMessagesInBatch; ++i)
         {
-            _lock = new object();
-            _trackBatches = trackBatches;
-            _messageFactory = messageFactory;
-            _messages = new Queue<IMessage<TMessage>>();
-            _batches = new LinkedList<Batch>();
+            var singleMetadataSize = data.ReadUInt32(index, true);
+            index += 4;
+            var singleMetadata = Serializer.Deserialize<SingleMessageMetadata>(data.Slice(index, singleMetadataSize));
+            index += singleMetadataSize;
+            var singleMessageId = new MessageId(messageId.LedgerId, messageId.EntryId, messageId.Partition, i);
+            var message = _messageFactory.Create(singleMessageId, redeliveryCount, data.Slice(index, singleMetadata.PayloadSize), metadata, singleMetadata);
+            messages.Add(message);
+            index += (uint) singleMetadata.PayloadSize;
         }
 
-        public IMessage<TMessage> Add(MessageIdData messageId, uint redeliveryCount, MessageMetadata metadata, ReadOnlySequence<byte> data)
+        lock (_lock)
         {
-            var messages = new List<IMessage<TMessage>>(metadata.NumMessagesInBatch);
+            if (_trackBatches)
+                _batches.AddLast(new Batch(messageId, metadata.NumMessagesInBatch));
 
-            long index = 0;
-
-            for (var i = 0; i < metadata.NumMessagesInBatch; ++i)
+            foreach (var message in messages)
             {
-                var singleMetadataSize = data.ReadUInt32(index, true);
-                index += 4;
-                var singleMetadata = Serializer.Deserialize<SingleMessageMetadata>(data.Slice(index, singleMetadataSize));
-                index += singleMetadataSize;
-                var singleMessageId = new MessageId(messageId.LedgerId, messageId.EntryId, messageId.Partition, i);
-                var message = _messageFactory.Create(singleMessageId, redeliveryCount, data.Slice(index, singleMetadata.PayloadSize), metadata, singleMetadata);
-                messages.Add(message);
-                index += (uint) singleMetadata.PayloadSize;
+                _messages.Enqueue(message);
             }
 
-            lock (_lock)
-            {
-                if (_trackBatches)
-                    _batches.AddLast(new Batch(messageId, metadata.NumMessagesInBatch));
+            return _messages.Dequeue();
+        }
+    }
 
-                foreach (var message in messages)
+    public IMessage<TMessage>? GetNext()
+    {
+        lock (_lock)
+            return _messages.Count == 0 ? null : _messages.Dequeue();
+    }
+
+    public void Clear()
+    {
+        lock (_lock)
+        {
+            _messages.Clear();
+            _batches.Clear();
+        }
+    }
+
+    public MessageIdData? Acknowledge(MessageIdData messageId)
+    {
+        lock (_lock)
+        {
+            foreach (var batch in _batches)
+            {
+                if (messageId.LedgerId != batch.MessageId.LedgerId ||
+                    messageId.EntryId != batch.MessageId.EntryId ||
+                    messageId.Partition != batch.MessageId.Partition)
+                    continue;
+
+                batch.Acknowledge(messageId.BatchIndex);
+
+                if (batch.IsAcknowledged())
                 {
-                    _messages.Enqueue(message);
+                    _batches.Remove(batch);
+                    return batch.MessageId;
                 }
 
-                return _messages.Dequeue();
+                break;
             }
+
+            return null;
+        }
+    }
+
+    private sealed class Batch
+    {
+        private readonly BitArray _acknowledgementIndex;
+
+        public Batch(MessageIdData messageId, int numberOfMessages)
+        {
+            MessageId = messageId;
+            _acknowledgementIndex = new BitArray(numberOfMessages, false);
         }
 
-        public IMessage<TMessage>? GetNext()
-        {
-            lock (_lock)
-                return _messages.Count == 0 ? null : _messages.Dequeue();
-        }
+        public MessageIdData MessageId { get; }
 
-        public void Clear()
+        public void Acknowledge(int batchIndex)
+            => _acknowledgementIndex.Set(batchIndex, true);
+
+        public bool IsAcknowledged()
         {
-            lock (_lock)
+            for (var i = 0; i < _acknowledgementIndex.Length; i++)
             {
-                _messages.Clear();
-                _batches.Clear();
-            }
-        }
-
-        public MessageIdData? Acknowledge(MessageIdData messageId)
-        {
-            lock (_lock)
-            {
-                foreach (var batch in _batches)
-                {
-                    if (messageId.LedgerId != batch.MessageId.LedgerId ||
-                        messageId.EntryId != batch.MessageId.EntryId ||
-                        messageId.Partition != batch.MessageId.Partition)
-                        continue;
-
-                    batch.Acknowledge(messageId.BatchIndex);
-
-                    if (batch.IsAcknowledged())
-                    {
-                        _batches.Remove(batch);
-                        return batch.MessageId;
-                    }
-
-                    break;
-                }
-
-                return null;
-            }
-        }
-
-        private sealed class Batch
-        {
-            private readonly BitArray _acknowledgementIndex;
-
-            public Batch(MessageIdData messageId, int numberOfMessages)
-            {
-                MessageId = messageId;
-                _acknowledgementIndex = new BitArray(numberOfMessages, false);
+                if (!_acknowledgementIndex[i])
+                    return false;
             }
 
-            public MessageIdData MessageId { get; }
-
-            public void Acknowledge(int batchIndex)
-                => _acknowledgementIndex.Set(batchIndex, true);
-
-            public bool IsAcknowledged()
-            {
-                for (var i = 0; i < _acknowledgementIndex.Length; i++)
-                {
-                    if (!_acknowledgementIndex[i])
-                        return false;
-                }
-
-                return true;
-            }
+            return true;
         }
     }
 }
diff --git a/src/DotPulsar/Internal/CancelableCompletionSource.cs b/src/DotPulsar/Internal/CancelableCompletionSource.cs
index ff66a9a..f706427 100644
--- a/src/DotPulsar/Internal/CancelableCompletionSource.cs
+++ b/src/DotPulsar/Internal/CancelableCompletionSource.cs
@@ -12,35 +12,34 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class CancelableCompletionSource<T> : IDisposable
 {
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly TaskCompletionSource<T> _source;
+    private CancellationTokenRegistration? _registration;
 
-    public sealed class CancelableCompletionSource<T> : IDisposable
+    public CancelableCompletionSource()
+        => _source = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
+
+    public void SetupCancellation(Action callback, CancellationToken token)
+        => _registration = token.Register(callback);
+
+    public void SetResult(T result)
+        => _ = _source.TrySetResult(result);
+
+    public void SetException(Exception exception)
+        => _ = _source.TrySetException(exception);
+
+    public Task<T> Task => _source.Task;
+
+    public void Dispose()
     {
-        private readonly TaskCompletionSource<T> _source;
-        private CancellationTokenRegistration? _registration;
-
-        public CancelableCompletionSource()
-            => _source = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
-
-        public void SetupCancellation(Action callback, CancellationToken token)
-            => _registration = token.Register(callback);
-
-        public void SetResult(T result)
-            => _ = _source.TrySetResult(result);
-
-        public void SetException(Exception exception)
-            => _ = _source.TrySetException(exception);
-
-        public Task<T> Task => _source.Task;
-
-        public void Dispose()
-        {
-            _ = _source.TrySetCanceled();
-            _registration?.Dispose();
-        }
+        _ = _source.TrySetCanceled();
+        _registration?.Dispose();
     }
 }
diff --git a/src/DotPulsar/Internal/Channel.cs b/src/DotPulsar/Internal/Channel.cs
index eb67755..361b838 100644
--- a/src/DotPulsar/Internal/Channel.cs
+++ b/src/DotPulsar/Internal/Channel.cs
@@ -12,101 +12,100 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using Events;
+using System;
+using System.Threading;
+
+public sealed class Channel : IChannel
 {
-    using Abstractions;
-    using Events;
-    using System;
-    using System.Threading;
+    private readonly Lock _senderLock;
+    private readonly Guid _correlationId;
+    private readonly IRegisterEvent _eventRegister;
+    private readonly IEnqueue<MessagePackage> _enqueue;
 
-    public sealed class Channel : IChannel
+    public Channel(Guid correlationId, IRegisterEvent eventRegister, IEnqueue<MessagePackage> enqueue)
     {
-        private readonly Lock _senderLock;
-        private readonly Guid _correlationId;
-        private readonly IRegisterEvent _eventRegister;
-        private readonly IEnqueue<MessagePackage> _enqueue;
+        _senderLock = new Lock();
+        _correlationId = correlationId;
+        _eventRegister = eventRegister;
+        _enqueue = enqueue;
+    }
 
-        public Channel(Guid correlationId, IRegisterEvent eventRegister, IEnqueue<MessagePackage> enqueue)
+    public void Received(MessagePackage message)
+    {
+        try
         {
-            _senderLock = new Lock();
-            _correlationId = correlationId;
-            _eventRegister = eventRegister;
-            _enqueue = enqueue;
+            _enqueue.Enqueue(message);
+        }
+        catch
+        {
+            // Ignore
+        }
+    }
+
+    public void Activated()
+        => _eventRegister.Register(new ChannelActivated(_correlationId));
+
+    public void ClosedByServer()
+    {
+        _senderLock.Disable();
+        _eventRegister.Register(new ChannelClosedByServer(_correlationId));
+    }
+
+    public void Connected()
+        => _eventRegister.Register(new ChannelConnected(_correlationId));
+
+    public void Deactivated()
+        => _eventRegister.Register(new ChannelDeactivated(_correlationId));
+
+    public void Disconnected()
+    {
+        _senderLock.Disable();
+        _eventRegister.Register(new ChannelDisconnected(_correlationId));
+    }
+
+    public void ReachedEndOfTopic()
+        => _eventRegister.Register(new ChannelReachedEndOfTopic(_correlationId));
+
+    public void Unsubscribed()
+        => _eventRegister.Register(new ChannelUnsubscribed(_correlationId));
+
+    public IDisposable SenderLock()
+        => _senderLock.Enter();
+
+    private sealed class Lock : IDisposable
+    {
+        private readonly object _lock;
+        private bool _canSend;
+
+        public Lock()
+        {
+            _lock = new object();
+            _canSend = true;
         }
 
-        public void Received(MessagePackage message)
+        public void Disable()
         {
-            try
-            {
-                _enqueue.Enqueue(message);
-            }
-            catch
-            {
-                // Ignore
-            }
+            Monitor.Enter(_lock);
+            _canSend = false;
+            Monitor.Exit(_lock);
         }
 
-        public void Activated()
-            => _eventRegister.Register(new ChannelActivated(_correlationId));
-
-        public void ClosedByServer()
+        public IDisposable Enter()
         {
-            _senderLock.Disable();
-            _eventRegister.Register(new ChannelClosedByServer(_correlationId));
+            Monitor.Enter(_lock);
+
+            if (_canSend)
+                return this;
+
+            Monitor.Exit(_lock);
+            throw new OperationCanceledException();
         }
 
-        public void Connected()
-            => _eventRegister.Register(new ChannelConnected(_correlationId));
-
-        public void Deactivated()
-            => _eventRegister.Register(new ChannelDeactivated(_correlationId));
-
-        public void Disconnected()
-        {
-            _senderLock.Disable();
-            _eventRegister.Register(new ChannelDisconnected(_correlationId));
-        }
-
-        public void ReachedEndOfTopic()
-            => _eventRegister.Register(new ChannelReachedEndOfTopic(_correlationId));
-
-        public void Unsubscribed()
-            => _eventRegister.Register(new ChannelUnsubscribed(_correlationId));
-
-        public IDisposable SenderLock()
-            => _senderLock.Enter();
-
-        private sealed class Lock : IDisposable
-        {
-            private readonly object _lock;
-            private bool _canSend;
-
-            public Lock()
-            {
-                _lock = new object();
-                _canSend = true;
-            }
-
-            public void Disable()
-            {
-                Monitor.Enter(_lock);
-                _canSend = false;
-                Monitor.Exit(_lock);
-            }
-
-            public IDisposable Enter()
-            {
-                Monitor.Enter(_lock);
-
-                if (_canSend)
-                    return this;
-
-                Monitor.Exit(_lock);
-                throw new OperationCanceledException();
-            }
-
-            public void Dispose()
-                => Monitor.Exit(_lock);
-        }
+        public void Dispose()
+            => Monitor.Exit(_lock);
     }
 }
diff --git a/src/DotPulsar/Internal/ChannelManager.cs b/src/DotPulsar/Internal/ChannelManager.cs
index b28ba5b..afc3343 100644
--- a/src/DotPulsar/Internal/ChannelManager.cs
+++ b/src/DotPulsar/Internal/ChannelManager.cs
@@ -12,246 +12,245 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using Extensions;
+using PulsarApi;
+using System;
+using System.Buffers;
+using System.Threading.Tasks;
+
+public sealed class ChannelManager : IDisposable
 {
-    using Abstractions;
-    using Extensions;
-    using PulsarApi;
-    using System;
-    using System.Buffers;
-    using System.Threading.Tasks;
+    private readonly RequestResponseHandler _requestResponseHandler;
+    private readonly IdLookup<IChannel> _consumerChannels;
+    private readonly IdLookup<IChannel> _producerChannels;
+    private readonly EnumLookup<BaseCommand.Type, Action<BaseCommand>> _incoming;
 
-    public sealed class ChannelManager : IDisposable
+    public ChannelManager()
     {
-        private readonly RequestResponseHandler _requestResponseHandler;
-        private readonly IdLookup<IChannel> _consumerChannels;
-        private readonly IdLookup<IChannel> _producerChannels;
-        private readonly EnumLookup<BaseCommand.Type, Action<BaseCommand>> _incoming;
+        _requestResponseHandler = new RequestResponseHandler();
+        _consumerChannels = new IdLookup<IChannel>();
+        _producerChannels = new IdLookup<IChannel>();
+        _incoming = new EnumLookup<BaseCommand.Type, Action<BaseCommand>>(cmd => _requestResponseHandler.Incoming(cmd));
+        _incoming.Set(BaseCommand.Type.CloseConsumer, cmd => Incoming(cmd.CloseConsumer));
+        _incoming.Set(BaseCommand.Type.CloseProducer, cmd => Incoming(cmd.CloseProducer));
+        _incoming.Set(BaseCommand.Type.ActiveConsumerChange, cmd => Incoming(cmd.ActiveConsumerChange));
+        _incoming.Set(BaseCommand.Type.ReachedEndOfTopic, cmd => Incoming(cmd.ReachedEndOfTopic));
+    }
 
-        public ChannelManager()
+    public bool HasChannels()
+        => !_consumerChannels.IsEmpty() || !_producerChannels.IsEmpty();
+
+    public Task<ProducerResponse> Outgoing(CommandProducer command, IChannel channel)
+    {
+        var producerId = _producerChannels.Add(channel);
+        command.ProducerId = producerId;
+        var response = _requestResponseHandler.Outgoing(command);
+
+        return response.ContinueWith(result =>
         {
-            _requestResponseHandler = new RequestResponseHandler();
-            _consumerChannels = new IdLookup<IChannel>();
-            _producerChannels = new IdLookup<IChannel>();
-            _incoming = new EnumLookup<BaseCommand.Type, Action<BaseCommand>>(cmd => _requestResponseHandler.Incoming(cmd));
-            _incoming.Set(BaseCommand.Type.CloseConsumer, cmd => Incoming(cmd.CloseConsumer));
-            _incoming.Set(BaseCommand.Type.CloseProducer, cmd => Incoming(cmd.CloseProducer));
-            _incoming.Set(BaseCommand.Type.ActiveConsumerChange, cmd => Incoming(cmd.ActiveConsumerChange));
-            _incoming.Set(BaseCommand.Type.ReachedEndOfTopic, cmd => Incoming(cmd.ReachedEndOfTopic));
-        }
-
-        public bool HasChannels()
-            => !_consumerChannels.IsEmpty() || !_producerChannels.IsEmpty();
-
-        public Task<ProducerResponse> Outgoing(CommandProducer command, IChannel channel)
-        {
-            var producerId = _producerChannels.Add(channel);
-            command.ProducerId = producerId;
-            var response = _requestResponseHandler.Outgoing(command);
-
-            return response.ContinueWith(result =>
+            if (result.Result.CommandType == BaseCommand.Type.Error)
             {
-                if (result.Result.CommandType == BaseCommand.Type.Error)
-                {
-                    _ = _producerChannels.Remove(producerId);
-                    result.Result.Error.Throw();
-                }
-
-                channel.Connected();
-
-                return new ProducerResponse(producerId, result.Result.ProducerSuccess.ProducerName);
-            }, TaskContinuationOptions.OnlyOnRanToCompletion);
-        }
-
-        public Task<SubscribeResponse> Outgoing(CommandSubscribe command, IChannel channel)
-        {
-            var consumerId = _consumerChannels.Add(channel);
-            command.ConsumerId = consumerId;
-            var response = _requestResponseHandler.Outgoing(command);
-
-            return response.ContinueWith(result =>
-            {
-                if (result.Result.CommandType == BaseCommand.Type.Error)
-                {
-                    _ = _consumerChannels.Remove(consumerId);
-                    result.Result.Error.Throw();
-                }
-
-                channel.Connected();
-
-                return new SubscribeResponse(consumerId);
-            }, TaskContinuationOptions.OnlyOnRanToCompletion);
-        }
-
-        public Task<BaseCommand> Outgoing(CommandCloseConsumer command)
-        {
-            var consumerId = command.ConsumerId;
-
-            Task<BaseCommand> response;
-
-            using (TakeConsumerSenderLock(consumerId))
-            {
-                response = _requestResponseHandler.Outgoing(command);
+                _ = _producerChannels.Remove(producerId);
+                result.Result.Error.Throw();
             }
 
-            _ = response.ContinueWith(result =>
-            {
-                if (result.Result.CommandType == BaseCommand.Type.Success)
-                    _ = _consumerChannels.Remove(consumerId);
-            }, TaskContinuationOptions.OnlyOnRanToCompletion);
+            channel.Connected();
 
-            return response;
-        }
+            return new ProducerResponse(producerId, result.Result.ProducerSuccess.ProducerName);
+        }, TaskContinuationOptions.OnlyOnRanToCompletion);
+    }
 
-        public Task<BaseCommand> Outgoing(CommandCloseProducer command)
+    public Task<SubscribeResponse> Outgoing(CommandSubscribe command, IChannel channel)
+    {
+        var consumerId = _consumerChannels.Add(channel);
+        command.ConsumerId = consumerId;
+        var response = _requestResponseHandler.Outgoing(command);
+
+        return response.ContinueWith(result =>
         {
-            var producerId = command.ProducerId;
-
-            Task<BaseCommand> response;
-
-            using (TakeProducerSenderLock(producerId))
+            if (result.Result.CommandType == BaseCommand.Type.Error)
             {
-                response = _requestResponseHandler.Outgoing(command);
+                _ = _consumerChannels.Remove(consumerId);
+                result.Result.Error.Throw();
             }
 
-            _ = response.ContinueWith(result =>
-            {
-                if (result.Result.CommandType == BaseCommand.Type.Success)
-                    _ = _producerChannels.Remove(producerId);
-            }, TaskContinuationOptions.OnlyOnRanToCompletion);
+            channel.Connected();
 
-            return response;
-        }
+            return new SubscribeResponse(consumerId);
+        }, TaskContinuationOptions.OnlyOnRanToCompletion);
+    }
 
-        public Task<BaseCommand> Outgoing(CommandUnsubscribe command)
+    public Task<BaseCommand> Outgoing(CommandCloseConsumer command)
+    {
+        var consumerId = command.ConsumerId;
+
+        Task<BaseCommand> response;
+
+        using (TakeConsumerSenderLock(consumerId))
         {
-            var consumerId = command.ConsumerId;
-
-            Task<BaseCommand> response;
-
-            using (TakeConsumerSenderLock(consumerId))
-            {
-                response = _requestResponseHandler.Outgoing(command);
-            }
-
-            _ = response.ContinueWith(result =>
-            {
-                if (result.Result.CommandType == BaseCommand.Type.Success)
-                    _consumerChannels.Remove(consumerId)?.Unsubscribed();
-            }, TaskContinuationOptions.OnlyOnRanToCompletion);
-
-            return response;
+            response = _requestResponseHandler.Outgoing(command);
         }
 
-        public Task<BaseCommand> Outgoing(CommandSend command)
+        _ = response.ContinueWith(result =>
         {
-            using (TakeProducerSenderLock(command.ProducerId))
-            {
-                return _requestResponseHandler.Outgoing(command);
-            }
-        }
+            if (result.Result.CommandType == BaseCommand.Type.Success)
+                _ = _consumerChannels.Remove(consumerId);
+        }, TaskContinuationOptions.OnlyOnRanToCompletion);
 
-        public Task<BaseCommand> Outgoing(CommandGetOrCreateSchema command)
-            => _requestResponseHandler.Outgoing(command);
+        return response;
+    }
 
-        public Task<BaseCommand> Outgoing(CommandConnect command)
-            => _requestResponseHandler.Outgoing(command);
+    public Task<BaseCommand> Outgoing(CommandCloseProducer command)
+    {
+        var producerId = command.ProducerId;
 
-        public Task<BaseCommand> Outgoing(CommandLookupTopic command)
-            => _requestResponseHandler.Outgoing(command);
+        Task<BaseCommand> response;
 
-        public Task<BaseCommand> Outgoing(CommandPartitionedTopicMetadata command)
-            => _requestResponseHandler.Outgoing(command);
-
-        public Task<BaseCommand> Outgoing(CommandSeek command)
+        using (TakeProducerSenderLock(producerId))
         {
-            using (TakeConsumerSenderLock(command.ConsumerId))
-            {
-                return _requestResponseHandler.Outgoing(command);
-            }
+            response = _requestResponseHandler.Outgoing(command);
         }
 
-        public Task<BaseCommand> Outgoing(CommandGetLastMessageId command)
+        _ = response.ContinueWith(result =>
         {
-            using (TakeConsumerSenderLock(command.ConsumerId))
-            {
-                return _requestResponseHandler.Outgoing(command);
-            }
-        }
+            if (result.Result.CommandType == BaseCommand.Type.Success)
+                _ = _producerChannels.Remove(producerId);
+        }, TaskContinuationOptions.OnlyOnRanToCompletion);
 
-        public void Incoming(BaseCommand command)
-            => _incoming.Get(command.CommandType)(command);
+        return response;
+    }
 
-        public void Incoming(CommandMessage command, ReadOnlySequence<byte> data)
-            => _consumerChannels[command.ConsumerId]?.Received(new MessagePackage(command.MessageId, command.RedeliveryCount, data));
+    public Task<BaseCommand> Outgoing(CommandUnsubscribe command)
+    {
+        var consumerId = command.ConsumerId;
 
-        public void Dispose()
+        Task<BaseCommand> response;
+
+        using (TakeConsumerSenderLock(consumerId))
         {
-            _requestResponseHandler.Dispose();
-
-            foreach (var channel in _consumerChannels.RemoveAll())
-                channel.Disconnected();
-
-            foreach (var channel in _producerChannels.RemoveAll())
-                channel.Disconnected();
+            response = _requestResponseHandler.Outgoing(command);
         }
 
-        private void Incoming(CommandReachedEndOfTopic command)
-            => _consumerChannels[command.ConsumerId]?.ReachedEndOfTopic();
-
-        private void Incoming(CommandCloseConsumer command)
+        _ = response.ContinueWith(result =>
         {
-            var channel = _consumerChannels[command.ConsumerId];
+            if (result.Result.CommandType == BaseCommand.Type.Success)
+                _consumerChannels.Remove(consumerId)?.Unsubscribed();
+        }, TaskContinuationOptions.OnlyOnRanToCompletion);
 
-            if (channel is null)
-                return;
+        return response;
+    }
 
-            _ = _consumerChannels.Remove(command.ConsumerId);
-            _requestResponseHandler.Incoming(command);
-            channel.ClosedByServer();
-        }
-
-        private void Incoming(CommandCloseProducer command)
+    public Task<BaseCommand> Outgoing(CommandSend command)
+    {
+        using (TakeProducerSenderLock(command.ProducerId))
         {
-            var channel = _producerChannels[command.ProducerId];
-
-            if (channel is null)
-                return;
-
-            _ = _producerChannels.Remove(command.ProducerId);
-            _requestResponseHandler.Incoming(command);
-            channel.ClosedByServer();
+            return _requestResponseHandler.Outgoing(command);
         }
+    }
 
-        private void Incoming(CommandActiveConsumerChange command)
+    public Task<BaseCommand> Outgoing(CommandGetOrCreateSchema command)
+        => _requestResponseHandler.Outgoing(command);
+
+    public Task<BaseCommand> Outgoing(CommandConnect command)
+        => _requestResponseHandler.Outgoing(command);
+
+    public Task<BaseCommand> Outgoing(CommandLookupTopic command)
+        => _requestResponseHandler.Outgoing(command);
+
+    public Task<BaseCommand> Outgoing(CommandPartitionedTopicMetadata command)
+        => _requestResponseHandler.Outgoing(command);
+
+    public Task<BaseCommand> Outgoing(CommandSeek command)
+    {
+        using (TakeConsumerSenderLock(command.ConsumerId))
         {
-            var channel = _consumerChannels[command.ConsumerId];
-
-            if (channel is null)
-                return;
-
-            if (command.IsActive)
-                channel.Activated();
-            else
-                channel.Deactivated();
+            return _requestResponseHandler.Outgoing(command);
         }
+    }
 
-        private IDisposable TakeConsumerSenderLock(ulong consumerId)
+    public Task<BaseCommand> Outgoing(CommandGetLastMessageId command)
+    {
+        using (TakeConsumerSenderLock(command.ConsumerId))
         {
-            var channel = _consumerChannels[consumerId];
-            if (channel is null)
-                throw new OperationCanceledException();
-
-            return channel.SenderLock();
+            return _requestResponseHandler.Outgoing(command);
         }
+    }
 
-        private IDisposable TakeProducerSenderLock(ulong producerId)
-        {
-            var channel = _producerChannels[producerId];
-            if (channel is null)
-                throw new OperationCanceledException();
+    public void Incoming(BaseCommand command)
+        => _incoming.Get(command.CommandType)(command);
 
-            return channel.SenderLock();
-        }
+    public void Incoming(CommandMessage command, ReadOnlySequence<byte> data)
+        => _consumerChannels[command.ConsumerId]?.Received(new MessagePackage(command.MessageId, command.RedeliveryCount, data));
+
+    public void Dispose()
+    {
+        _requestResponseHandler.Dispose();
+
+        foreach (var channel in _consumerChannels.RemoveAll())
+            channel.Disconnected();
+
+        foreach (var channel in _producerChannels.RemoveAll())
+            channel.Disconnected();
+    }
+
+    private void Incoming(CommandReachedEndOfTopic command)
+        => _consumerChannels[command.ConsumerId]?.ReachedEndOfTopic();
+
+    private void Incoming(CommandCloseConsumer command)
+    {
+        var channel = _consumerChannels[command.ConsumerId];
+
+        if (channel is null)
+            return;
+
+        _ = _consumerChannels.Remove(command.ConsumerId);
+        _requestResponseHandler.Incoming(command);
+        channel.ClosedByServer();
+    }
+
+    private void Incoming(CommandCloseProducer command)
+    {
+        var channel = _producerChannels[command.ProducerId];
+
+        if (channel is null)
+            return;
+
+        _ = _producerChannels.Remove(command.ProducerId);
+        _requestResponseHandler.Incoming(command);
+        channel.ClosedByServer();
+    }
+
+    private void Incoming(CommandActiveConsumerChange command)
+    {
+        var channel = _consumerChannels[command.ConsumerId];
+
+        if (channel is null)
+            return;
+
+        if (command.IsActive)
+            channel.Activated();
+        else
+            channel.Deactivated();
+    }
+
+    private IDisposable TakeConsumerSenderLock(ulong consumerId)
+    {
+        var channel = _consumerChannels[consumerId];
+        if (channel is null)
+            throw new OperationCanceledException();
+
+        return channel.SenderLock();
+    }
+
+    private IDisposable TakeProducerSenderLock(ulong producerId)
+    {
+        var channel = _producerChannels[producerId];
+        if (channel is null)
+            throw new OperationCanceledException();
+
+        return channel.SenderLock();
     }
 }
diff --git a/src/DotPulsar/Internal/ChannelState.cs b/src/DotPulsar/Internal/ChannelState.cs
index 28e7507..ccac012 100644
--- a/src/DotPulsar/Internal/ChannelState.cs
+++ b/src/DotPulsar/Internal/ChannelState.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+public enum ChannelState : byte
 {
-    public enum ChannelState : byte
-    {
-        ClosedByServer,
-        Connected,
-        Disconnected,
-        ReachedEndOfTopic,
-        Active,
-        Inactive,
-        Unsubscribed
-    }
+    ClosedByServer,
+    Connected,
+    Disconnected,
+    ReachedEndOfTopic,
+    Active,
+    Inactive,
+    Unsubscribed
 }
diff --git a/src/DotPulsar/Internal/ChunkingPipeline.cs b/src/DotPulsar/Internal/ChunkingPipeline.cs
index 2768f69..3528964 100644
--- a/src/DotPulsar/Internal/ChunkingPipeline.cs
+++ b/src/DotPulsar/Internal/ChunkingPipeline.cs
@@ -12,99 +12,98 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System;
+using System.Buffers;
+using System.IO;
+using System.Threading.Tasks;
+
+public sealed class ChunkingPipeline
 {
-    using System;
-    using System.Buffers;
-    using System.IO;
-    using System.Threading.Tasks;
+    private readonly Stream _stream;
+    private readonly int _chunkSize;
+    private readonly byte[] _buffer;
+    private int _bufferCount;
 
-    public sealed class ChunkingPipeline
+    public ChunkingPipeline(Stream stream, int chunkSize)
     {
-        private readonly Stream _stream;
-        private readonly int _chunkSize;
-        private readonly byte[] _buffer;
-        private int _bufferCount;
+        _stream = stream;
+        _chunkSize = chunkSize;
+        _buffer = new byte[_chunkSize];
+    }
 
-        public ChunkingPipeline(Stream stream, int chunkSize)
+    private void CopyToBuffer(ReadOnlySequence<byte> sequence) => sequence.CopyTo(_buffer.AsSpan());
+
+    private void CopyToBuffer(ReadOnlyMemory<byte> memory) => memory.CopyTo(_buffer.AsMemory(_bufferCount));
+
+    public async ValueTask Send(ReadOnlySequence<byte> sequence)
+    {
+        var sequenceLength = sequence.Length;
+
+        if (sequenceLength <= _chunkSize)
         {
-            _stream = stream;
-            _chunkSize = chunkSize;
-            _buffer = new byte[_chunkSize];
-        }
-
-        private void CopyToBuffer(ReadOnlySequence<byte> sequence) => sequence.CopyTo(_buffer.AsSpan());
-
-        private void CopyToBuffer(ReadOnlyMemory<byte> memory) => memory.CopyTo(_buffer.AsMemory(_bufferCount));
-
-        public async ValueTask Send(ReadOnlySequence<byte> sequence)
-        {
-            var sequenceLength = sequence.Length;
-
-            if (sequenceLength <= _chunkSize)
-            {
-                CopyToBuffer(sequence);
-                _bufferCount = (int) sequenceLength;
-                await SendBuffer().ConfigureAwait(false);
-                return;
-            }
-
-            var enumerator = sequence.GetEnumerator();
-            var hasNext = true;
-
-            while (hasNext)
-            {
-                var current = enumerator.Current;
-                var currentLength = current.Length;
-                hasNext = enumerator.MoveNext();
-
-                if (currentLength > _chunkSize)
-                {
-                    await Send(current).ConfigureAwait(false);
-                    continue;
-                }
-
-                var total = currentLength + _bufferCount;
-
-                if (total > _chunkSize)
-                    await SendBuffer().ConfigureAwait(false);
-
-                if (_bufferCount != 0 || (hasNext && enumerator.Current.Length + total <= _chunkSize))
-                {
-                    CopyToBuffer(current);
-                    _bufferCount = total;
-                    continue;
-                }
-
-                await Send(current).ConfigureAwait(false);
-            }
-
+            CopyToBuffer(sequence);
+            _bufferCount = (int) sequenceLength;
             await SendBuffer().ConfigureAwait(false);
+            return;
         }
 
-        private async ValueTask SendBuffer()
+        var enumerator = sequence.GetEnumerator();
+        var hasNext = true;
+
+        while (hasNext)
         {
-            if (_bufferCount != 0)
+            var current = enumerator.Current;
+            var currentLength = current.Length;
+            hasNext = enumerator.MoveNext();
+
+            if (currentLength > _chunkSize)
             {
+                await Send(current).ConfigureAwait(false);
+                continue;
+            }
+
+            var total = currentLength + _bufferCount;
+
+            if (total > _chunkSize)
+                await SendBuffer().ConfigureAwait(false);
+
+            if (_bufferCount != 0 || (hasNext && enumerator.Current.Length + total <= _chunkSize))
+            {
+                CopyToBuffer(current);
+                _bufferCount = total;
+                continue;
+            }
+
+            await Send(current).ConfigureAwait(false);
+        }
+
+        await SendBuffer().ConfigureAwait(false);
+    }
+
+    private async ValueTask SendBuffer()
+    {
+        if (_bufferCount != 0)
+        {
 #if NETSTANDARD2_0
-                await _stream.WriteAsync(_buffer, 0, _bufferCount).ConfigureAwait(false);
+            await _stream.WriteAsync(_buffer, 0, _bufferCount).ConfigureAwait(false);
 #else
                 await _stream.WriteAsync(_buffer.AsMemory(0, _bufferCount)).ConfigureAwait(false);
 #endif
-                _bufferCount = 0;
-            }
+            _bufferCount = 0;
         }
+    }
 
-        private async ValueTask Send(ReadOnlyMemory<byte> memory)
-        {
-            await SendBuffer().ConfigureAwait(false);
+    private async ValueTask Send(ReadOnlyMemory<byte> memory)
+    {
+        await SendBuffer().ConfigureAwait(false);
 
 #if NETSTANDARD2_0
-            var data = memory.ToArray();
-            await _stream.WriteAsync(data, 0, data.Length).ConfigureAwait(false);
+        var data = memory.ToArray();
+        await _stream.WriteAsync(data, 0, data.Length).ConfigureAwait(false);
 #else
             await _stream.WriteAsync(memory).ConfigureAwait(false);
 #endif
-        }
     }
 }
diff --git a/src/DotPulsar/Internal/Compression/CompressionFactories.cs b/src/DotPulsar/Internal/Compression/CompressionFactories.cs
index a2da330..b9eb1ef 100644
--- a/src/DotPulsar/Internal/Compression/CompressionFactories.cs
+++ b/src/DotPulsar/Internal/Compression/CompressionFactories.cs
@@ -12,45 +12,44 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Internal.Abstractions;
+using System.Collections.Generic;
+
+public static class CompressionFactories
 {
-    using DotPulsar.Internal.Abstractions;
-    using System.Collections.Generic;
+    private static readonly List<ICompressorFactory> _compressorFactories;
+    private static readonly List<IDecompressorFactory> _decompressorFactories;
 
-    public static class CompressionFactories
+    static CompressionFactories()
     {
-        private static readonly List<ICompressorFactory> _compressorFactories;
-        private static readonly List<IDecompressorFactory> _decompressorFactories;
-
-        static CompressionFactories()
-        {
-            _compressorFactories = new List<ICompressorFactory>();
-            _decompressorFactories = new List<IDecompressorFactory>();
+        _compressorFactories = new List<ICompressorFactory>();
+        _decompressorFactories = new List<IDecompressorFactory>();
 
 
-            if (Lz4Compression.TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory))
-                Add(compressorFactory, decompressorFactory);
+        if (Lz4Compression.TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory))
+            Add(compressorFactory, decompressorFactory);
 
-            if (SnappyCompression.TryLoading(out compressorFactory, out decompressorFactory))
-                Add(compressorFactory, decompressorFactory);
+        if (SnappyCompression.TryLoading(out compressorFactory, out decompressorFactory))
+            Add(compressorFactory, decompressorFactory);
 
-            if (ZlibCompression.TryLoading(out compressorFactory, out decompressorFactory))
-                Add(compressorFactory, decompressorFactory);
+        if (ZlibCompression.TryLoading(out compressorFactory, out decompressorFactory))
+            Add(compressorFactory, decompressorFactory);
 
-            if (ZstdCompression.TryLoading(out compressorFactory, out decompressorFactory))
-                Add(compressorFactory, decompressorFactory);
-        }
-
-        private static void Add(ICompressorFactory? compressorFactory, IDecompressorFactory? decompressorFactory)
-        {
-            _compressorFactories.Add(compressorFactory!);
-            _decompressorFactories.Add(decompressorFactory!);
-        }
-
-        public static IEnumerable<ICompressorFactory> CompressorFactories()
-            => _compressorFactories;
-
-        public static IEnumerable<IDecompressorFactory> DecompressorFactories()
-            => _decompressorFactories;
+        if (ZstdCompression.TryLoading(out compressorFactory, out decompressorFactory))
+            Add(compressorFactory, decompressorFactory);
     }
+
+    private static void Add(ICompressorFactory? compressorFactory, IDecompressorFactory? decompressorFactory)
+    {
+        _compressorFactories.Add(compressorFactory!);
+        _decompressorFactories.Add(decompressorFactory!);
+    }
+
+    public static IEnumerable<ICompressorFactory> CompressorFactories()
+        => _compressorFactories;
+
+    public static IEnumerable<IDecompressorFactory> DecompressorFactories()
+        => _decompressorFactories;
 }
diff --git a/src/DotPulsar/Internal/Compression/Compressor.cs b/src/DotPulsar/Internal/Compression/Compressor.cs
index 51ffaf9..5449f3c 100644
--- a/src/DotPulsar/Internal/Compression/Compressor.cs
+++ b/src/DotPulsar/Internal/Compression/Compressor.cs
@@ -12,30 +12,29 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Internal.Abstractions;
+using System;
+using System.Buffers;
+
+public sealed class Compressor : ICompress
 {
-    using DotPulsar.Internal.Abstractions;
-    using System;
-    using System.Buffers;
+    private readonly IDisposable? _disposable;
+    private readonly Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> _compress;
 
-    public sealed class Compressor : ICompress
+    public Compressor(Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> compress, IDisposable? disposable = null)
     {
-        private readonly IDisposable? _disposable;
-        private readonly Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> _compress;
-
-        public Compressor(Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> compress, IDisposable? disposable = null)
-        {
-            _disposable = disposable;
-            _compress = compress;
-        }
-
-        public Compressor(Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> compress)
-            => _compress = compress;
-
-        public ReadOnlySequence<byte> Compress(ReadOnlySequence<byte> data)
-            => _compress(data);
-
-        public void Dispose()
-            => _disposable?.Dispose();
+        _disposable = disposable;
+        _compress = compress;
     }
+
+    public Compressor(Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> compress)
+        => _compress = compress;
+
+    public ReadOnlySequence<byte> Compress(ReadOnlySequence<byte> data)
+        => _compress(data);
+
+    public void Dispose()
+        => _disposable?.Dispose();
 }
diff --git a/src/DotPulsar/Internal/Compression/CompressorFactory.cs b/src/DotPulsar/Internal/Compression/CompressorFactory.cs
index 230e1ff..1a8a9e4 100644
--- a/src/DotPulsar/Internal/Compression/CompressorFactory.cs
+++ b/src/DotPulsar/Internal/Compression/CompressorFactory.cs
@@ -12,25 +12,24 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Internal.Abstractions;
+using DotPulsar.Internal.PulsarApi;
+using System;
+
+public sealed class CompressorFactory : ICompressorFactory
 {
-    using DotPulsar.Internal.Abstractions;
-    using DotPulsar.Internal.PulsarApi;
-    using System;
+    private readonly Func<ICompress> _create;
 
-    public sealed class CompressorFactory : ICompressorFactory
+    public CompressorFactory(CompressionType compressionType, Func<ICompress> create)
     {
-        private readonly Func<ICompress> _create;
-
-        public CompressorFactory(CompressionType compressionType, Func<ICompress> create)
-        {
-            CompressionType = compressionType;
-            _create = create;
-        }
-
-        public CompressionType CompressionType { get; }
-
-        public ICompress Create()
-            => _create();
+        CompressionType = compressionType;
+        _create = create;
     }
+
+    public CompressionType CompressionType { get; }
+
+    public ICompress Create()
+        => _create();
 }
diff --git a/src/DotPulsar/Internal/Compression/Decompressor.cs b/src/DotPulsar/Internal/Compression/Decompressor.cs
index eddba6c..dc6a42c 100644
--- a/src/DotPulsar/Internal/Compression/Decompressor.cs
+++ b/src/DotPulsar/Internal/Compression/Decompressor.cs
@@ -12,27 +12,26 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Internal.Abstractions;
+using System;
+using System.Buffers;
+
+public sealed class Decompressor : IDecompress
 {
-    using DotPulsar.Internal.Abstractions;
-    using System;
-    using System.Buffers;
+    private readonly IDisposable? _disposable;
+    private readonly Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> _decompress;
 
-    public sealed class Decompressor : IDecompress
+    public Decompressor(Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> decompress, IDisposable? disposable = null)
     {
-        private readonly IDisposable? _disposable;
-        private readonly Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> _decompress;
-
-        public Decompressor(Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> decompress, IDisposable? disposable = null)
-        {
-            _disposable = disposable;
-            _decompress = decompress;
-        }
-
-        public ReadOnlySequence<byte> Decompress(ReadOnlySequence<byte> data, int decompressedSize)
-            => _decompress(data, decompressedSize);
-
-        public void Dispose()
-            => _disposable?.Dispose();
+        _disposable = disposable;
+        _decompress = decompress;
     }
+
+    public ReadOnlySequence<byte> Decompress(ReadOnlySequence<byte> data, int decompressedSize)
+        => _decompress(data, decompressedSize);
+
+    public void Dispose()
+        => _disposable?.Dispose();
 }
diff --git a/src/DotPulsar/Internal/Compression/DecompressorFactory.cs b/src/DotPulsar/Internal/Compression/DecompressorFactory.cs
index dc2b6da..6ce0388 100644
--- a/src/DotPulsar/Internal/Compression/DecompressorFactory.cs
+++ b/src/DotPulsar/Internal/Compression/DecompressorFactory.cs
@@ -12,25 +12,24 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Internal.Abstractions;
+using DotPulsar.Internal.PulsarApi;
+using System;
+
+public sealed class DecompressorFactory : IDecompressorFactory
 {
-    using DotPulsar.Internal.Abstractions;
-    using DotPulsar.Internal.PulsarApi;
-    using System;
+    private readonly Func<IDecompress> _create;
 
-    public sealed class DecompressorFactory : IDecompressorFactory
+    public DecompressorFactory(CompressionType compressionType, Func<IDecompress> create)
     {
-        private readonly Func<IDecompress> _create;
-
-        public DecompressorFactory(CompressionType compressionType, Func<IDecompress> create)
-        {
-            CompressionType = compressionType;
-            _create = create;
-        }
-
-        public CompressionType CompressionType { get; }
-
-        public IDecompress Create()
-            => _create();
+        CompressionType = compressionType;
+        _create = create;
     }
+
+    public CompressionType CompressionType { get; }
+
+    public IDecompress Create()
+        => _create();
 }
diff --git a/src/DotPulsar/Internal/Compression/Lz4Compression.cs b/src/DotPulsar/Internal/Compression/Lz4Compression.cs
index d528fb7..4809484 100644
--- a/src/DotPulsar/Internal/Compression/Lz4Compression.cs
+++ b/src/DotPulsar/Internal/Compression/Lz4Compression.cs
@@ -12,193 +12,192 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Exceptions;
+using DotPulsar.Internal.Abstractions;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+public static class Lz4Compression
 {
-    using DotPulsar.Exceptions;
-    using DotPulsar.Internal.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
-    using System.Linq;
-    using System.Reflection;
+    public delegate int Decode(byte[] source, int sourceOffset, int sourceLength, byte[] target, int targetOffset, int targetLength);
+    public delegate int Encode(byte[] source, int sourceOffset, int sourceLength, byte[] target, int targetOffset, int targetLength, int level);
+    public delegate int MaximumOutputSize(int length);
 
-    public static class Lz4Compression
+    public static bool TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory)
     {
-        public delegate int Decode(byte[] source, int sourceOffset, int sourceLength, byte[] target, int targetOffset, int targetLength);
-        public delegate int Encode(byte[] source, int sourceOffset, int sourceLength, byte[] target, int targetOffset, int targetLength, int level);
-        public delegate int MaximumOutputSize(int length);
-
-        public static bool TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory)
+        try
         {
-            try
-            {
-                var assembly = Assembly.Load("K4os.Compression.LZ4");
+            var assembly = Assembly.Load("K4os.Compression.LZ4");
 
-                var definedTypes = assembly.DefinedTypes.ToArray();
+            var definedTypes = assembly.DefinedTypes.ToArray();
 
-                var lz4Codec = FindLZ4Codec(definedTypes);
-                var lz4Level = FindLZ4Level(definedTypes);
+            var lz4Codec = FindLZ4Codec(definedTypes);
+            var lz4Level = FindLZ4Level(definedTypes);
 
-                var methods = lz4Codec.GetMethods(BindingFlags.Public | BindingFlags.Static);
+            var methods = lz4Codec.GetMethods(BindingFlags.Public | BindingFlags.Static);
 
-                var decode = FindDecode(methods);
-                var encode = FindEncode(methods, lz4Level);
-                var maximumOutputSize = FindMaximumOutputSize(methods);
+            var decode = FindDecode(methods);
+            var encode = FindEncode(methods, lz4Level);
+            var maximumOutputSize = FindMaximumOutputSize(methods);
 
-                compressorFactory = new CompressorFactory(PulsarApi.CompressionType.Lz4, () => new Compressor(CreateCompressor(encode, maximumOutputSize)));
-                decompressorFactory = new DecompressorFactory(PulsarApi.CompressionType.Lz4, () => new Decompressor(CreateDecompressor(decode)));
-                return true;
-            }
-            catch
-            {
-                // Ignore
-            }
-
-            compressorFactory = null;
-            decompressorFactory = null;
-
-            return false;
+            compressorFactory = new CompressorFactory(PulsarApi.CompressionType.Lz4, () => new Compressor(CreateCompressor(encode, maximumOutputSize)));
+            decompressorFactory = new DecompressorFactory(PulsarApi.CompressionType.Lz4, () => new Decompressor(CreateDecompressor(decode)));
+            return true;
+        }
+        catch
+        {
+            // Ignore
         }
 
-        private static TypeInfo FindLZ4Codec(IEnumerable<TypeInfo> types)
+        compressorFactory = null;
+        decompressorFactory = null;
+
+        return false;
+    }
+
+    private static TypeInfo FindLZ4Codec(IEnumerable<TypeInfo> types)
+    {
+        const string fullName = "K4os.Compression.LZ4.LZ4Codec";
+
+        foreach (var type in types)
         {
-            const string fullName = "K4os.Compression.LZ4.LZ4Codec";
+            if (type.FullName is null || !type.FullName.Equals(fullName))
+                continue;
 
-            foreach (var type in types)
-            {
-                if (type.FullName is null || !type.FullName.Equals(fullName))
-                    continue;
+            if (type.IsPublic && type.IsClass && type.IsAbstract && type.IsSealed)
+                return type;
 
-                if (type.IsPublic && type.IsClass && type.IsAbstract && type.IsSealed)
-                    return type;
-
-                break;
-            }
-
-            throw new Exception($"{fullName} as a public and static class was not found");
+            break;
         }
 
-        private static TypeInfo FindLZ4Level(IEnumerable<TypeInfo> types)
+        throw new Exception($"{fullName} as a public and static class was not found");
+    }
+
+    private static TypeInfo FindLZ4Level(IEnumerable<TypeInfo> types)
+    {
+        const string fullName = "K4os.Compression.LZ4.LZ4Level";
+
+        foreach (var type in types)
         {
-            const string fullName = "K4os.Compression.LZ4.LZ4Level";
+            if (type.FullName is null || !type.FullName.Equals(fullName))
+                continue;
 
-            foreach (var type in types)
-            {
-                if (type.FullName is null || !type.FullName.Equals(fullName))
-                    continue;
+            if (type.IsPublic && type.IsEnum && Enum.GetUnderlyingType(type) == typeof(int))
+                return type;
 
-                if (type.IsPublic && type.IsEnum && Enum.GetUnderlyingType(type) == typeof(int))
-                    return type;
-
-                break;
-            }
-
-            throw new Exception($"{fullName} as a public enum with an int backing was not found");
+            break;
         }
 
-        private static Decode FindDecode(MethodInfo[] methods)
+        throw new Exception($"{fullName} as a public enum with an int backing was not found");
+    }
+
+    private static Decode FindDecode(MethodInfo[] methods)
+    {
+        const string name = "Decode";
+
+        foreach (var method in methods)
         {
-            const string name = "Decode";
+            if (method.Name != name || method.ReturnType != typeof(int))
+                continue;
 
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(int))
-                    continue;
+            var parameters = method.GetParameters();
+            if (parameters.Length != 6)
+                continue;
 
-                var parameters = method.GetParameters();
-                if (parameters.Length != 6)
-                    continue;
+            if (parameters[0].ParameterType != typeof(byte[]) ||
+                parameters[1].ParameterType != typeof(int) ||
+                parameters[2].ParameterType != typeof(int) ||
+                parameters[3].ParameterType != typeof(byte[]) ||
+                parameters[4].ParameterType != typeof(int) ||
+                parameters[5].ParameterType != typeof(int))
+                continue;
 
-                if (parameters[0].ParameterType != typeof(byte[]) ||
-                    parameters[1].ParameterType != typeof(int) ||
-                    parameters[2].ParameterType != typeof(int) ||
-                    parameters[3].ParameterType != typeof(byte[]) ||
-                    parameters[4].ParameterType != typeof(int) ||
-                    parameters[5].ParameterType != typeof(int))
-                    continue;
-
-                return (Decode) method.CreateDelegate(typeof(Decode));
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+            return (Decode) method.CreateDelegate(typeof(Decode));
         }
 
-        private static Encode FindEncode(MethodInfo[] methods, Type lz4Level)
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static Encode FindEncode(MethodInfo[] methods, Type lz4Level)
+    {
+        const string name = "Encode";
+
+        foreach (var method in methods)
         {
-            const string name = "Encode";
+            if (method.Name != name || method.ReturnType != typeof(int))
+                continue;
 
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(int))
-                    continue;
+            var parameters = method.GetParameters();
+            if (parameters.Length != 7)
+                continue;
 
-                var parameters = method.GetParameters();
-                if (parameters.Length != 7)
-                    continue;
+            if (parameters[0].ParameterType != typeof(byte[]) ||
+                parameters[1].ParameterType != typeof(int) ||
+                parameters[2].ParameterType != typeof(int) ||
+                parameters[3].ParameterType != typeof(byte[]) ||
+                parameters[4].ParameterType != typeof(int) ||
+                parameters[5].ParameterType != typeof(int) ||
+                parameters[6].ParameterType != lz4Level)
+                continue;
 
-                if (parameters[0].ParameterType != typeof(byte[]) ||
-                    parameters[1].ParameterType != typeof(int) ||
-                    parameters[2].ParameterType != typeof(int) ||
-                    parameters[3].ParameterType != typeof(byte[]) ||
-                    parameters[4].ParameterType != typeof(int) ||
-                    parameters[5].ParameterType != typeof(int) ||
-                    parameters[6].ParameterType != lz4Level)
-                    continue;
-
-                return (Encode) method.CreateDelegate(typeof(Encode));
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+            return (Encode) method.CreateDelegate(typeof(Encode));
         }
 
-        private static MaximumOutputSize FindMaximumOutputSize(MethodInfo[] methods)
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static MaximumOutputSize FindMaximumOutputSize(MethodInfo[] methods)
+    {
+        const string name = "MaximumOutputSize";
+
+        foreach (var method in methods)
         {
-            const string name = "MaximumOutputSize";
+            if (method.Name != name || method.ReturnType != typeof(int))
+                continue;
 
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(int))
-                    continue;
+            var parameters = method.GetParameters();
+            if (parameters.Length != 1)
+                continue;
 
-                var parameters = method.GetParameters();
-                if (parameters.Length != 1)
-                    continue;
+            if (parameters[0].ParameterType != typeof(int))
+                continue;
 
-                if (parameters[0].ParameterType != typeof(int))
-                    continue;
-
-                return (MaximumOutputSize) method.CreateDelegate(typeof(MaximumOutputSize));
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+            return (MaximumOutputSize) method.CreateDelegate(typeof(MaximumOutputSize));
         }
 
-        private static Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> CreateDecompressor(Decode decompress)
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> CreateDecompressor(Decode decompress)
+    {
+        return (source, size) =>
         {
-            return (source, size) =>
-            {
-                var decompressed = new byte[size];
-                var sourceBytes = source.ToArray();
-                var bytesDecompressed = decompress(sourceBytes, 0, sourceBytes.Length, decompressed, 0, decompressed.Length);
-                if (size == bytesDecompressed)
-                    return new ReadOnlySequence<byte>(decompressed);
+            var decompressed = new byte[size];
+            var sourceBytes = source.ToArray();
+            var bytesDecompressed = decompress(sourceBytes, 0, sourceBytes.Length, decompressed, 0, decompressed.Length);
+            if (size == bytesDecompressed)
+                return new ReadOnlySequence<byte>(decompressed);
 
-                throw new CompressionException($"LZ4Codec.Decode returned {bytesDecompressed} but expected {size}");
-            };
-        }
+            throw new CompressionException($"LZ4Codec.Decode returned {bytesDecompressed} but expected {size}");
+        };
+    }
 
-        private static Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> CreateCompressor(Encode compress, MaximumOutputSize maximumOutputSize)
+    private static Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> CreateCompressor(Encode compress, MaximumOutputSize maximumOutputSize)
+    {
+        return (source) =>
         {
-            return (source) =>
-            {
-                var sourceBytes = source.ToArray();
-                var compressed = new byte[maximumOutputSize(sourceBytes.Length)];
-                var bytesCompressed = compress(sourceBytes, 0, sourceBytes.Length, compressed, 0, compressed.Length, 0);
-                if (bytesCompressed == -1)
-                    throw new CompressionException($"LZ4Codec.Encode returned -1 when compressing {sourceBytes.Length} bytes");
+            var sourceBytes = source.ToArray();
+            var compressed = new byte[maximumOutputSize(sourceBytes.Length)];
+            var bytesCompressed = compress(sourceBytes, 0, sourceBytes.Length, compressed, 0, compressed.Length, 0);
+            if (bytesCompressed == -1)
+                throw new CompressionException($"LZ4Codec.Encode returned -1 when compressing {sourceBytes.Length} bytes");
 
-                return new ReadOnlySequence<byte>(compressed, 0, bytesCompressed);
-            };
-        }
+            return new ReadOnlySequence<byte>(compressed, 0, bytesCompressed);
+        };
     }
 }
diff --git a/src/DotPulsar/Internal/Compression/SnappyCompression.cs b/src/DotPulsar/Internal/Compression/SnappyCompression.cs
index 3f77a43..5d82747 100644
--- a/src/DotPulsar/Internal/Compression/SnappyCompression.cs
+++ b/src/DotPulsar/Internal/Compression/SnappyCompression.cs
@@ -12,116 +12,115 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Internal.Abstractions;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+public static class SnappyCompression
 {
-    using DotPulsar.Internal.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
-    using System.Linq;
-    using System.Reflection;
+    public delegate byte[] Decode(ReadOnlySpan<byte> source);
+    public delegate byte[] Encode(ReadOnlySpan<byte> source);
 
-    public static class SnappyCompression
+    public static bool TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory)
     {
-        public delegate byte[] Decode(ReadOnlySpan<byte> source);
-        public delegate byte[] Encode(ReadOnlySpan<byte> source);
-
-        public static bool TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory)
+        try
         {
-            try
-            {
-                var assembly = Assembly.Load("IronSnappy");
+            var assembly = Assembly.Load("IronSnappy");
 
-                var definedTypes = assembly.DefinedTypes.ToArray();
+            var definedTypes = assembly.DefinedTypes.ToArray();
 
-                var snappy = FindSnappy(definedTypes);
+            var snappy = FindSnappy(definedTypes);
 
-                var methods = snappy.GetMethods(BindingFlags.Public | BindingFlags.Static);
+            var methods = snappy.GetMethods(BindingFlags.Public | BindingFlags.Static);
 
-                var decode = FindDecode(methods);
-                var encode = FindEncode(methods);
+            var decode = FindDecode(methods);
+            var encode = FindEncode(methods);
 
-                compressorFactory = new CompressorFactory(PulsarApi.CompressionType.Snappy, () => new Compressor(CreateCompressor(encode)));
-                decompressorFactory = new DecompressorFactory(PulsarApi.CompressionType.Snappy, () => new Decompressor(CreateDecompressor(decode)));
-                return true;
-            }
-            catch
-            {
-                // Ignore
-            }
-
-            compressorFactory = null;
-            decompressorFactory = null;
-
-            return false;
+            compressorFactory = new CompressorFactory(PulsarApi.CompressionType.Snappy, () => new Compressor(CreateCompressor(encode)));
+            decompressorFactory = new DecompressorFactory(PulsarApi.CompressionType.Snappy, () => new Decompressor(CreateDecompressor(decode)));
+            return true;
+        }
+        catch
+        {
+            // Ignore
         }
 
-        private static TypeInfo FindSnappy(IEnumerable<TypeInfo> types)
-        {
-            const string fullName = "IronSnappy.Snappy";
+        compressorFactory = null;
+        decompressorFactory = null;
 
-            foreach (var type in types)
-            {
-                if (type.FullName is null || !type.FullName.Equals(fullName))
-                    continue;
-
-                if (type.IsPublic && type.IsClass && type.IsAbstract && type.IsSealed)
-                    return type;
-
-                break;
-            }
-
-            throw new Exception($"{fullName} as a public and static class was not found");
-        }
-
-        private static Decode FindDecode(MethodInfo[] methods)
-        {
-            const string name = "Decode";
-
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(byte[]))
-                    continue;
-
-                var parameters = method.GetParameters();
-                if (parameters.Length != 1)
-                    continue;
-
-                if (parameters[0].ParameterType != typeof(ReadOnlySpan<byte>))
-                    continue;
-
-                return (Decode) method.CreateDelegate(typeof(Decode));
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
-        }
-
-        private static Encode FindEncode(MethodInfo[] methods)
-        {
-            const string name = "Encode";
-
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(byte[]))
-                    continue;
-
-                var parameters = method.GetParameters();
-                if (parameters.Length != 1)
-                    continue;
-
-                if (parameters[0].ParameterType != typeof(ReadOnlySpan<byte>))
-                    continue;
-
-                return (Encode) method.CreateDelegate(typeof(Encode));
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
-        }
-
-        private static Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> CreateDecompressor(Decode decompress)
-            => (source, size) => new ReadOnlySequence<byte>(decompress(source.ToArray()));
-
-        private static Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> CreateCompressor(Encode compress)
-            => (source) => new ReadOnlySequence<byte>(compress(source.ToArray()));
+        return false;
     }
+
+    private static TypeInfo FindSnappy(IEnumerable<TypeInfo> types)
+    {
+        const string fullName = "IronSnappy.Snappy";
+
+        foreach (var type in types)
+        {
+            if (type.FullName is null || !type.FullName.Equals(fullName))
+                continue;
+
+            if (type.IsPublic && type.IsClass && type.IsAbstract && type.IsSealed)
+                return type;
+
+            break;
+        }
+
+        throw new Exception($"{fullName} as a public and static class was not found");
+    }
+
+    private static Decode FindDecode(MethodInfo[] methods)
+    {
+        const string name = "Decode";
+
+        foreach (var method in methods)
+        {
+            if (method.Name != name || method.ReturnType != typeof(byte[]))
+                continue;
+
+            var parameters = method.GetParameters();
+            if (parameters.Length != 1)
+                continue;
+
+            if (parameters[0].ParameterType != typeof(ReadOnlySpan<byte>))
+                continue;
+
+            return (Decode) method.CreateDelegate(typeof(Decode));
+        }
+
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static Encode FindEncode(MethodInfo[] methods)
+    {
+        const string name = "Encode";
+
+        foreach (var method in methods)
+        {
+            if (method.Name != name || method.ReturnType != typeof(byte[]))
+                continue;
+
+            var parameters = method.GetParameters();
+            if (parameters.Length != 1)
+                continue;
+
+            if (parameters[0].ParameterType != typeof(ReadOnlySpan<byte>))
+                continue;
+
+            return (Encode) method.CreateDelegate(typeof(Encode));
+        }
+
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> CreateDecompressor(Decode decompress)
+        => (source, size) => new ReadOnlySequence<byte>(decompress(source.ToArray()));
+
+    private static Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> CreateCompressor(Encode compress)
+        => (source) => new ReadOnlySequence<byte>(compress(source.ToArray()));
 }
diff --git a/src/DotPulsar/Internal/Compression/ZlibCompression.cs b/src/DotPulsar/Internal/Compression/ZlibCompression.cs
index 082b9b1..f4bdcbe 100644
--- a/src/DotPulsar/Internal/Compression/ZlibCompression.cs
+++ b/src/DotPulsar/Internal/Compression/ZlibCompression.cs
@@ -12,116 +12,115 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Internal.Abstractions;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+public static class ZlibCompression
 {
-    using DotPulsar.Internal.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
-    using System.Linq;
-    using System.Reflection;
+    public delegate byte[] CompressBuffer(byte[] source);
+    public delegate byte[] UncompressBuffer(byte[] source);
 
-    public static class ZlibCompression
+    public static bool TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory)
     {
-        public delegate byte[] CompressBuffer(byte[] source);
-        public delegate byte[] UncompressBuffer(byte[] source);
-
-        public static bool TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory)
+        try
         {
-            try
-            {
-                var assembly = Assembly.Load("DotNetZip");
+            var assembly = Assembly.Load("DotNetZip");
 
-                var definedTypes = assembly.DefinedTypes.ToArray();
+            var definedTypes = assembly.DefinedTypes.ToArray();
 
-                var ZlibStream = FindZlibStream(definedTypes);
+            var ZlibStream = FindZlibStream(definedTypes);
 
-                var methods = ZlibStream.GetMethods(BindingFlags.Public | BindingFlags.Static);
+            var methods = ZlibStream.GetMethods(BindingFlags.Public | BindingFlags.Static);
 
-                var compressBuffer = FindCompressBuffer(methods);
-                var uncompressBuffer = FindUncompressBuffer(methods);
+            var compressBuffer = FindCompressBuffer(methods);
+            var uncompressBuffer = FindUncompressBuffer(methods);
 
-                compressorFactory = new CompressorFactory(PulsarApi.CompressionType.Zlib, () => new Compressor(CreateCompressor(compressBuffer)));
-                decompressorFactory = new DecompressorFactory(PulsarApi.CompressionType.Zlib, () => new Decompressor(CreateDecompressor(uncompressBuffer)));
-                return true;
-            }
-            catch
-            {
-                // Ignore
-            }
-
-            compressorFactory = null;
-            decompressorFactory = null;
-
-            return false;
+            compressorFactory = new CompressorFactory(PulsarApi.CompressionType.Zlib, () => new Compressor(CreateCompressor(compressBuffer)));
+            decompressorFactory = new DecompressorFactory(PulsarApi.CompressionType.Zlib, () => new Decompressor(CreateDecompressor(uncompressBuffer)));
+            return true;
+        }
+        catch
+        {
+            // Ignore
         }
 
-        private static TypeInfo FindZlibStream(IEnumerable<TypeInfo> types)
-        {
-            const string fullName = "Ionic.Zlib.ZlibStream";
+        compressorFactory = null;
+        decompressorFactory = null;
 
-            foreach (var type in types)
-            {
-                if (type.FullName is null || !type.FullName.Equals(fullName))
-                    continue;
-
-                if (type.IsPublic && type.IsClass)
-                    return type;
-
-                break;
-            }
-
-            throw new Exception($"{fullName} as a public class was not found");
-        }
-
-        private static CompressBuffer FindCompressBuffer(MethodInfo[] methods)
-        {
-            const string name = "CompressBuffer";
-
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(byte[]))
-                    continue;
-
-                var parameters = method.GetParameters();
-                if (parameters.Length != 1)
-                    continue;
-
-                if (parameters[0].ParameterType != typeof(byte[]))
-                    continue;
-
-                return (CompressBuffer) method.CreateDelegate(typeof(CompressBuffer));
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
-        }
-
-        private static UncompressBuffer FindUncompressBuffer(MethodInfo[] methods)
-        {
-            const string name = "UncompressBuffer";
-
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(byte[]))
-                    continue;
-
-                var parameters = method.GetParameters();
-                if (parameters.Length != 1)
-                    continue;
-
-                if (parameters[0].ParameterType != typeof(byte[]))
-                    continue;
-
-                return (UncompressBuffer) method.CreateDelegate(typeof(UncompressBuffer));
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
-        }
-
-        private static Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> CreateDecompressor(UncompressBuffer decompress)
-            => (source, size) => new ReadOnlySequence<byte>(decompress(source.ToArray()));
-
-        private static Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> CreateCompressor(CompressBuffer compress)
-            => (source) => new ReadOnlySequence<byte>(compress(source.ToArray()));
+        return false;
     }
+
+    private static TypeInfo FindZlibStream(IEnumerable<TypeInfo> types)
+    {
+        const string fullName = "Ionic.Zlib.ZlibStream";
+
+        foreach (var type in types)
+        {
+            if (type.FullName is null || !type.FullName.Equals(fullName))
+                continue;
+
+            if (type.IsPublic && type.IsClass)
+                return type;
+
+            break;
+        }
+
+        throw new Exception($"{fullName} as a public class was not found");
+    }
+
+    private static CompressBuffer FindCompressBuffer(MethodInfo[] methods)
+    {
+        const string name = "CompressBuffer";
+
+        foreach (var method in methods)
+        {
+            if (method.Name != name || method.ReturnType != typeof(byte[]))
+                continue;
+
+            var parameters = method.GetParameters();
+            if (parameters.Length != 1)
+                continue;
+
+            if (parameters[0].ParameterType != typeof(byte[]))
+                continue;
+
+            return (CompressBuffer) method.CreateDelegate(typeof(CompressBuffer));
+        }
+
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static UncompressBuffer FindUncompressBuffer(MethodInfo[] methods)
+    {
+        const string name = "UncompressBuffer";
+
+        foreach (var method in methods)
+        {
+            if (method.Name != name || method.ReturnType != typeof(byte[]))
+                continue;
+
+            var parameters = method.GetParameters();
+            if (parameters.Length != 1)
+                continue;
+
+            if (parameters[0].ParameterType != typeof(byte[]))
+                continue;
+
+            return (UncompressBuffer) method.CreateDelegate(typeof(UncompressBuffer));
+        }
+
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> CreateDecompressor(UncompressBuffer decompress)
+        => (source, size) => new ReadOnlySequence<byte>(decompress(source.ToArray()));
+
+    private static Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> CreateCompressor(CompressBuffer compress)
+        => (source) => new ReadOnlySequence<byte>(compress(source.ToArray()));
 }
diff --git a/src/DotPulsar/Internal/Compression/ZstdCompression.cs b/src/DotPulsar/Internal/Compression/ZstdCompression.cs
index c9f5f20..b9857d1 100644
--- a/src/DotPulsar/Internal/Compression/ZstdCompression.cs
+++ b/src/DotPulsar/Internal/Compression/ZstdCompression.cs
@@ -12,151 +12,150 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Compression
+namespace DotPulsar.Internal.Compression;
+
+using DotPulsar.Exceptions;
+using DotPulsar.Internal.Abstractions;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+public static class ZstdCompression
 {
-    using DotPulsar.Exceptions;
-    using DotPulsar.Internal.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
-    using System.Linq;
-    using System.Reflection;
+    public delegate byte[] Wrap(byte[] src);
+    public delegate int Unwrap(byte[] src, byte[] dst, int offset, bool bufferSizePrecheck);
 
-    public static class ZstdCompression
+    public static bool TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory)
     {
-        public delegate byte[] Wrap(byte[] src);
-        public delegate int Unwrap(byte[] src, byte[] dst, int offset, bool bufferSizePrecheck);
-
-        public static bool TryLoading(out ICompressorFactory? compressorFactory, out IDecompressorFactory? decompressorFactory)
+        try
         {
-            try
+            var assembly = Assembly.Load("ZstdNet");
+
+            var definedTypes = assembly.DefinedTypes.ToArray();
+
+            var decompressorType = Find(definedTypes, "ZstdNet.Decompressor");
+            var decompressorMethods = decompressorType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
+            var unwrapMethod = FindUnwrap(decompressorMethods);
+
+            var compressorType = Find(definedTypes, "ZstdNet.Compressor");
+            var compressorMethods = compressorType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
+            var wrapMethod = FindWrap(compressorMethods);
+
+            compressorFactory = new CompressorFactory(PulsarApi.CompressionType.Zstd, () =>
             {
-                var assembly = Assembly.Load("ZstdNet");
+                var compressor = Activator.CreateInstance(compressorType);
+                if (compressor is null)
+                    throw new Exception($"Activator.CreateInstance returned null when trying to create a {compressorType.FullName}");
 
-                var definedTypes = assembly.DefinedTypes.ToArray();
+                var wrap = (Wrap) wrapMethod.CreateDelegate(typeof(Wrap), compressor);
+                return new Compressor(CreateCompressor(wrap), (IDisposable) compressor);
+            });
 
-                var decompressorType = Find(definedTypes, "ZstdNet.Decompressor");
-                var decompressorMethods = decompressorType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
-                var unwrapMethod = FindUnwrap(decompressorMethods);
-
-                var compressorType = Find(definedTypes, "ZstdNet.Compressor");
-                var compressorMethods = compressorType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
-                var wrapMethod = FindWrap(compressorMethods);
-
-                compressorFactory = new CompressorFactory(PulsarApi.CompressionType.Zstd, () =>
-                {
-                    var compressor = Activator.CreateInstance(compressorType);
-                    if (compressor is null)
-                        throw new Exception($"Activator.CreateInstance returned null when trying to create a {compressorType.FullName}");
-
-                    var wrap = (Wrap) wrapMethod.CreateDelegate(typeof(Wrap), compressor);
-                    return new Compressor(CreateCompressor(wrap), (IDisposable) compressor);
-                });
-
-                decompressorFactory = new DecompressorFactory(PulsarApi.CompressionType.Zstd, () =>
-                {
-                    var decompressor = Activator.CreateInstance(decompressorType);
-                    if (decompressor is null)
-                        throw new Exception($"Activator.CreateInstance returned null when trying to create a {decompressorType.FullName}");
-
-                    var unwrap = (Unwrap) unwrapMethod.CreateDelegate(typeof(Unwrap), decompressor);
-                    return new Decompressor(CreateDecompressor(unwrap), (IDisposable) decompressor);
-                });
-
-                return true;
-            }
-            catch
+            decompressorFactory = new DecompressorFactory(PulsarApi.CompressionType.Zstd, () =>
             {
-                // Ignore
-            }
+                var decompressor = Activator.CreateInstance(decompressorType);
+                if (decompressor is null)
+                    throw new Exception($"Activator.CreateInstance returned null when trying to create a {decompressorType.FullName}");
 
-            compressorFactory = null;
-            decompressorFactory = null;
+                var unwrap = (Unwrap) unwrapMethod.CreateDelegate(typeof(Unwrap), decompressor);
+                return new Decompressor(CreateDecompressor(unwrap), (IDisposable) decompressor);
+            });
 
-            return false;
+            return true;
+        }
+        catch
+        {
+            // Ignore
         }
 
-        private static TypeInfo Find(IEnumerable<TypeInfo> types, string fullName)
-        {
-            foreach (var type in types)
-            {
-                if (type.FullName is null || !type.FullName.Equals(fullName))
-                    continue;
+        compressorFactory = null;
+        decompressorFactory = null;
 
-                if (type.IsPublic &&
-                    type.IsClass &&
-                    !type.IsAbstract &&
-                    type.ImplementedInterfaces.Contains(typeof(IDisposable)) &&
-                    type.GetConstructor(Type.EmptyTypes) is not null)
-                    return type;
-
-                break;
-            }
-
-            throw new Exception($"{fullName} as a public class with an empty public constructor and implementing IDisposable was not found");
-        }
-
-        private static MethodInfo FindWrap(MethodInfo[] methods)
-        {
-            const string name = "Wrap";
-
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(byte[]))
-                    continue;
-
-                var parameters = method.GetParameters();
-                if (parameters.Length != 1)
-                    continue;
-
-                if (parameters[0].ParameterType != typeof(byte[]))
-                    continue;
-
-                return method;
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
-        }
-
-        private static MethodInfo FindUnwrap(MethodInfo[] methods)
-        {
-            const string name = "Unwrap";
-
-            foreach (var method in methods)
-            {
-                if (method.Name != name || method.ReturnType != typeof(int))
-                    continue;
-
-                var parameters = method.GetParameters();
-                if (parameters.Length != 4)
-                    continue;
-
-                if (parameters[0].ParameterType != typeof(byte[]) ||
-                    parameters[1].ParameterType != typeof(byte[]) ||
-                    parameters[2].ParameterType != typeof(int) ||
-                    parameters[3].ParameterType != typeof(bool))
-                    continue;
-
-                return method;
-            }
-
-            throw new Exception($"A method with the name '{name}' matching the delegate was not found");
-        }
-
-        private static Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> CreateDecompressor(Unwrap decompress)
-        {
-            return (source, size) =>
-            {
-                var decompressed = new byte[size];
-                var bytesDecompressed = decompress(source.ToArray(), decompressed, 0, false);
-                if (size == bytesDecompressed)
-                    return new ReadOnlySequence<byte>(decompressed);
-
-                throw new CompressionException($"ZstdNet.Decompressor returned {bytesDecompressed} but expected {size}");
-            };
-        }
-
-        private static Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> CreateCompressor(Wrap compress)
-            => (source) => new ReadOnlySequence<byte>(compress(source.ToArray()));
+        return false;
     }
+
+    private static TypeInfo Find(IEnumerable<TypeInfo> types, string fullName)
+    {
+        foreach (var type in types)
+        {
+            if (type.FullName is null || !type.FullName.Equals(fullName))
+                continue;
+
+            if (type.IsPublic &&
+                type.IsClass &&
+                !type.IsAbstract &&
+                type.ImplementedInterfaces.Contains(typeof(IDisposable)) &&
+                type.GetConstructor(Type.EmptyTypes) is not null)
+                return type;
+
+            break;
+        }
+
+        throw new Exception($"{fullName} as a public class with an empty public constructor and implementing IDisposable was not found");
+    }
+
+    private static MethodInfo FindWrap(MethodInfo[] methods)
+    {
+        const string name = "Wrap";
+
+        foreach (var method in methods)
+        {
+            if (method.Name != name || method.ReturnType != typeof(byte[]))
+                continue;
+
+            var parameters = method.GetParameters();
+            if (parameters.Length != 1)
+                continue;
+
+            if (parameters[0].ParameterType != typeof(byte[]))
+                continue;
+
+            return method;
+        }
+
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static MethodInfo FindUnwrap(MethodInfo[] methods)
+    {
+        const string name = "Unwrap";
+
+        foreach (var method in methods)
+        {
+            if (method.Name != name || method.ReturnType != typeof(int))
+                continue;
+
+            var parameters = method.GetParameters();
+            if (parameters.Length != 4)
+                continue;
+
+            if (parameters[0].ParameterType != typeof(byte[]) ||
+                parameters[1].ParameterType != typeof(byte[]) ||
+                parameters[2].ParameterType != typeof(int) ||
+                parameters[3].ParameterType != typeof(bool))
+                continue;
+
+            return method;
+        }
+
+        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
+    }
+
+    private static Func<ReadOnlySequence<byte>, int, ReadOnlySequence<byte>> CreateDecompressor(Unwrap decompress)
+    {
+        return (source, size) =>
+        {
+            var decompressed = new byte[size];
+            var bytesDecompressed = decompress(source.ToArray(), decompressed, 0, false);
+            if (size == bytesDecompressed)
+                return new ReadOnlySequence<byte>(decompressed);
+
+            throw new CompressionException($"ZstdNet.Decompressor returned {bytesDecompressed} but expected {size}");
+        };
+    }
+
+    private static Func<ReadOnlySequence<byte>, ReadOnlySequence<byte>> CreateCompressor(Wrap compress)
+        => (source) => new ReadOnlySequence<byte>(compress(source.ToArray()));
 }
diff --git a/src/DotPulsar/Internal/Connection.cs b/src/DotPulsar/Internal/Connection.cs
index 7534981..1ee72e3 100644
--- a/src/DotPulsar/Internal/Connection.cs
+++ b/src/DotPulsar/Internal/Connection.cs
@@ -12,303 +12,302 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using Exceptions;
+using Extensions;
+using PulsarApi;
+using System;
+using System.Buffers;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class Connection : IConnection
 {
-    using Abstractions;
-    using Exceptions;
-    using Extensions;
-    using PulsarApi;
-    using System;
-    using System.Buffers;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly AsyncLock _lock;
+    private readonly ChannelManager _channelManager;
+    private readonly PingPongHandler _pingPongHandler;
+    private readonly IPulsarStream _stream;
+    private int _isDisposed;
 
-    public sealed class Connection : IConnection
+    public Connection(IPulsarStream stream, TimeSpan keepAliveInterval)
     {
-        private readonly AsyncLock _lock;
-        private readonly ChannelManager _channelManager;
-        private readonly PingPongHandler _pingPongHandler;
-        private readonly IPulsarStream _stream;
-        private int _isDisposed;
+        _lock = new AsyncLock();
+        _channelManager = new ChannelManager();
+        _pingPongHandler = new PingPongHandler(this, keepAliveInterval);
+        _stream = stream;
+    }
 
-        public Connection(IPulsarStream stream, TimeSpan keepAliveInterval)
+    public async ValueTask<bool> HasChannels(CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
         {
-            _lock = new AsyncLock();
-            _channelManager = new ChannelManager();
-            _pingPongHandler = new PingPongHandler(this, keepAliveInterval);
-            _stream = stream;
+            return _channelManager.HasChannels();
+        }
+    }
+
+    public async Task<ProducerResponse> Send(CommandProducer command, IChannel channel, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<ProducerResponse>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command, channel);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
         }
 
-        public async ValueTask<bool> HasChannels(CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
+        return await responseTask.ConfigureAwait(false);
+    }
 
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+    public async Task<SubscribeResponse> Send(CommandSubscribe command, IChannel channel, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<SubscribeResponse>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command, channel);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public Task Send(CommandPing command, CancellationToken cancellationToken)
+        => Send(command.AsBaseCommand(), cancellationToken);
+
+    public Task Send(CommandPong command, CancellationToken cancellationToken)
+        => Send(command.AsBaseCommand(), cancellationToken);
+
+    public Task Send(CommandAck command, CancellationToken cancellationToken)
+        => Send(command.AsBaseCommand(), cancellationToken);
+
+    public Task Send(CommandFlow command, CancellationToken cancellationToken)
+        => Send(command.AsBaseCommand(), cancellationToken);
+
+    public Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken)
+        => Send(command.AsBaseCommand(), cancellationToken);
+
+    public async Task<BaseCommand> Send(CommandUnsubscribe command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(CommandConnect command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(CommandLookupTopic command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(CommandSeek command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(CommandGetLastMessageId command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(CommandCloseProducer command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(CommandCloseConsumer command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(SendPackage command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command.Command!);
+            var sequence = Serializer.Serialize(command.Command!.AsBaseCommand(), command.Metadata!, command.Payload);
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(CommandGetOrCreateSchema command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    public async Task<BaseCommand> Send(CommandPartitionedTopicMetadata command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        Task<BaseCommand>? responseTask;
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            responseTask = _channelManager.Outgoing(command);
+            var sequence = Serializer.Serialize(command.AsBaseCommand());
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+
+        return await responseTask.ConfigureAwait(false);
+    }
+
+    private async Task Send(BaseCommand command, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        var sequence = Serializer.Serialize(command);
+
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            await _stream.Send(sequence).ConfigureAwait(false);
+        }
+    }
+
+    public async Task ProcessIncommingFrames()
+    {
+        await Task.Yield();
+
+        try
+        {
+            await foreach (var frame in _stream.Frames())
             {
-                return _channelManager.HasChannels();
+                var commandSize = frame.ReadUInt32(0, true);
+                var command = Serializer.Deserialize<BaseCommand>(frame.Slice(4, commandSize));
+
+                if (_pingPongHandler.Incoming(command.CommandType))
+                    continue;
+
+                if (command.CommandType == BaseCommand.Type.Message)
+                    _channelManager.Incoming(command.Message, new ReadOnlySequence<byte>(frame.Slice(commandSize + 4).ToArray()));
+                else
+                    _channelManager.Incoming(command);
             }
         }
-
-        public async Task<ProducerResponse> Send(CommandProducer command, IChannel channel, CancellationToken cancellationToken)
+        catch
         {
-            ThrowIfDisposed();
-
-            Task<ProducerResponse>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command, channel);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
+            // ignored
         }
+    }
 
-        public async Task<SubscribeResponse> Send(CommandSubscribe command, IChannel channel, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
+    public async ValueTask DisposeAsync()
+    {
+        if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+            return;
 
-            Task<SubscribeResponse>? responseTask;
+        await _pingPongHandler.DisposeAsync().ConfigureAwait(false);
+        await _lock.DisposeAsync().ConfigureAwait(false);
+        _channelManager.Dispose();
+        await _stream.DisposeAsync().ConfigureAwait(false);
+    }
 
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command, channel);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public Task Send(CommandPing command, CancellationToken cancellationToken)
-            => Send(command.AsBaseCommand(), cancellationToken);
-
-        public Task Send(CommandPong command, CancellationToken cancellationToken)
-            => Send(command.AsBaseCommand(), cancellationToken);
-
-        public Task Send(CommandAck command, CancellationToken cancellationToken)
-            => Send(command.AsBaseCommand(), cancellationToken);
-
-        public Task Send(CommandFlow command, CancellationToken cancellationToken)
-            => Send(command.AsBaseCommand(), cancellationToken);
-
-        public Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken)
-            => Send(command.AsBaseCommand(), cancellationToken);
-
-        public async Task<BaseCommand> Send(CommandUnsubscribe command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(CommandConnect command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(CommandLookupTopic command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(CommandSeek command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(CommandGetLastMessageId command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(CommandCloseProducer command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(CommandCloseConsumer command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(SendPackage command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command.Command!);
-                var sequence = Serializer.Serialize(command.Command!.AsBaseCommand(), command.Metadata!, command.Payload);
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(CommandGetOrCreateSchema command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        public async Task<BaseCommand> Send(CommandPartitionedTopicMetadata command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            Task<BaseCommand>? responseTask;
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                responseTask = _channelManager.Outgoing(command);
-                var sequence = Serializer.Serialize(command.AsBaseCommand());
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-
-            return await responseTask.ConfigureAwait(false);
-        }
-
-        private async Task Send(BaseCommand command, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            var sequence = Serializer.Serialize(command);
-
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                await _stream.Send(sequence).ConfigureAwait(false);
-            }
-        }
-
-        public async Task ProcessIncommingFrames()
-        {
-            await Task.Yield();
-
-            try
-            {
-                await foreach (var frame in _stream.Frames())
-                {
-                    var commandSize = frame.ReadUInt32(0, true);
-                    var command = Serializer.Deserialize<BaseCommand>(frame.Slice(4, commandSize));
-
-                    if (_pingPongHandler.Incoming(command.CommandType))
-                        continue;
-
-                    if (command.CommandType == BaseCommand.Type.Message)
-                        _channelManager.Incoming(command.Message, new ReadOnlySequence<byte>(frame.Slice(commandSize + 4).ToArray()));
-                    else
-                        _channelManager.Incoming(command);
-                }
-            }
-            catch
-            {
-                // ignored
-            }
-        }
-
-        public async ValueTask DisposeAsync()
-        {
-            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
-                return;
-
-            await _pingPongHandler.DisposeAsync().ConfigureAwait(false);
-            await _lock.DisposeAsync().ConfigureAwait(false);
-            _channelManager.Dispose();
-            await _stream.DisposeAsync().ConfigureAwait(false);
-        }
-
-        private void ThrowIfDisposed()
-        {
-            if (_isDisposed != 0)
-                throw new ConnectionDisposedException();
-        }
+    private void ThrowIfDisposed()
+    {
+        if (_isDisposed != 0)
+            throw new ConnectionDisposedException();
     }
 }
diff --git a/src/DotPulsar/Internal/ConnectionPool.cs b/src/DotPulsar/Internal/ConnectionPool.cs
index 1eaf96f..14ab85f 100644
--- a/src/DotPulsar/Internal/ConnectionPool.cs
+++ b/src/DotPulsar/Internal/ConnectionPool.cs
@@ -12,253 +12,252 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Exceptions;
+using Extensions;
+using PulsarApi;
+using System;
+using System.Collections.Concurrent;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class ConnectionPool : IConnectionPool
 {
-    using Abstractions;
-    using DotPulsar.Exceptions;
-    using Extensions;
-    using PulsarApi;
-    using System;
-    using System.Collections.Concurrent;
-    using System.Linq;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly AsyncLock _lock;
+    private readonly CommandConnect _commandConnect;
+    private readonly Uri _serviceUrl;
+    private readonly Connector _connector;
+    private readonly EncryptionPolicy _encryptionPolicy;
+    private readonly ConcurrentDictionary<PulsarUrl, Connection> _connections;
+    private readonly CancellationTokenSource _cancellationTokenSource;
+    private readonly Task _closeInactiveConnections;
+    private readonly string? _listenerName;
+    private readonly TimeSpan _keepAliveInterval;
 
-    public sealed class ConnectionPool : IConnectionPool
+    public ConnectionPool(
+        CommandConnect commandConnect,
+        Uri serviceUrl,
+        Connector connector,
+        EncryptionPolicy encryptionPolicy,
+        TimeSpan closeInactiveConnectionsInterval,
+        string? listenerName,
+        TimeSpan keepAliveInterval)
     {
-        private readonly AsyncLock _lock;
-        private readonly CommandConnect _commandConnect;
-        private readonly Uri _serviceUrl;
-        private readonly Connector _connector;
-        private readonly EncryptionPolicy _encryptionPolicy;
-        private readonly ConcurrentDictionary<PulsarUrl, Connection> _connections;
-        private readonly CancellationTokenSource _cancellationTokenSource;
-        private readonly Task _closeInactiveConnections;
-        private readonly string? _listenerName;
-        private readonly TimeSpan _keepAliveInterval;
+        _lock = new AsyncLock();
+        _commandConnect = commandConnect;
+        _serviceUrl = serviceUrl;
+        _connector = connector;
+        _encryptionPolicy = encryptionPolicy;
+        _listenerName = listenerName;
+        _connections = new ConcurrentDictionary<PulsarUrl, Connection>();
+        _cancellationTokenSource = new CancellationTokenSource();
+        _closeInactiveConnections = CloseInactiveConnections(closeInactiveConnectionsInterval, _cancellationTokenSource.Token);
+        _keepAliveInterval = keepAliveInterval;
+    }
 
-        public ConnectionPool(
-            CommandConnect commandConnect,
-            Uri serviceUrl,
-            Connector connector,
-            EncryptionPolicy encryptionPolicy,
-            TimeSpan closeInactiveConnectionsInterval,
-            string? listenerName,
-            TimeSpan keepAliveInterval)
+    public async ValueTask DisposeAsync()
+    {
+        _cancellationTokenSource.Cancel();
+
+        await _closeInactiveConnections.ConfigureAwait(false);
+
+        await _lock.DisposeAsync().ConfigureAwait(false);
+
+        foreach (var serviceUrl in _connections.Keys.ToArray())
         {
-            _lock = new AsyncLock();
-            _commandConnect = commandConnect;
-            _serviceUrl = serviceUrl;
-            _connector = connector;
-            _encryptionPolicy = encryptionPolicy;
-            _listenerName = listenerName;
-            _connections = new ConcurrentDictionary<PulsarUrl, Connection>();
-            _cancellationTokenSource = new CancellationTokenSource();
-            _closeInactiveConnections = CloseInactiveConnections(closeInactiveConnectionsInterval, _cancellationTokenSource.Token);
-            _keepAliveInterval = keepAliveInterval;
+            await DisposeConnection(serviceUrl).ConfigureAwait(false);
         }
+    }
 
-        public async ValueTask DisposeAsync()
+    public async ValueTask<IConnection> FindConnectionForTopic(string topic, CancellationToken cancellationToken)
+    {
+        var lookup = new CommandLookupTopic
         {
-            _cancellationTokenSource.Cancel();
+            Topic = topic,
+            Authoritative = false,
+            AdvertisedListenerName = _listenerName
+        };
 
-            await _closeInactiveConnections.ConfigureAwait(false);
+        var physicalUrl = _serviceUrl;
 
-            await _lock.DisposeAsync().ConfigureAwait(false);
+        while (true)
+        {
+            var connection = await GetConnection(physicalUrl, cancellationToken).ConfigureAwait(false);
+            var response = await connection.Send(lookup, cancellationToken).ConfigureAwait(false);
 
-            foreach (var serviceUrl in _connections.Keys.ToArray())
+            response.Expect(BaseCommand.Type.LookupResponse);
+
+            if (response.LookupTopicResponse.Response == CommandLookupTopicResponse.LookupType.Failed)
+                response.LookupTopicResponse.Throw();
+
+            lookup.Authoritative = response.LookupTopicResponse.Authoritative;
+
+            var lookupResponseServiceUrl = new Uri(GetBrokerServiceUrl(response.LookupTopicResponse));
+
+            if (response.LookupTopicResponse.Response == CommandLookupTopicResponse.LookupType.Redirect || !response.LookupTopicResponse.Authoritative)
             {
-                await DisposeConnection(serviceUrl).ConfigureAwait(false);
+                physicalUrl = lookupResponseServiceUrl;
+                continue;
             }
+
+            if (response.LookupTopicResponse.ProxyThroughServiceUrl)
+            {
+                var url = new PulsarUrl(physicalUrl, lookupResponseServiceUrl);
+                return await GetConnection(url, cancellationToken).ConfigureAwait(false);
+            }
+
+            // LookupType is 'Connect', ServiceUrl is local and response is authoritative. Assume the Pulsar server is a standalone docker.
+            return lookupResponseServiceUrl.IsLoopback
+                ? connection
+                : await GetConnection(lookupResponseServiceUrl, cancellationToken).ConfigureAwait(false);
         }
+    }
 
-        public async ValueTask<IConnection> FindConnectionForTopic(string topic, CancellationToken cancellationToken)
+    private string GetBrokerServiceUrl(CommandLookupTopicResponse response)
+    {
+        var hasBrokerServiceUrl = !string.IsNullOrEmpty(response.BrokerServiceUrl);
+        var hasBrokerServiceUrlTls = !string.IsNullOrEmpty(response.BrokerServiceUrlTls);
+
+        switch (_encryptionPolicy)
         {
-            var lookup = new CommandLookupTopic
+            case EncryptionPolicy.EnforceEncrypted:
+                if (!hasBrokerServiceUrlTls)
+                    throw new ConnectionSecurityException("Cannot enforce encrypted connections. The lookup topic response from broker gave no secure alternative.");
+                return response.BrokerServiceUrlTls;
+            case EncryptionPolicy.EnforceUnencrypted:
+                if (!hasBrokerServiceUrl)
+                    throw new ConnectionSecurityException("Cannot enforce unencrypted connections. The lookup topic response from broker gave no unsecure alternative.");
+                return response.BrokerServiceUrl;
+            case EncryptionPolicy.PreferEncrypted:
+                return hasBrokerServiceUrlTls ? response.BrokerServiceUrlTls : response.BrokerServiceUrl;
+            default:
+                return hasBrokerServiceUrl ? response.BrokerServiceUrl : response.BrokerServiceUrlTls;
+        }
+    }
+
+    private ValueTask<Connection> GetConnection(Uri serviceUrl, CancellationToken cancellationToken)
+    {
+        return GetConnection(new PulsarUrl(serviceUrl, serviceUrl), cancellationToken);
+    }
+
+    private async ValueTask<Connection> GetConnection(PulsarUrl url, CancellationToken cancellationToken)
+    {
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            if (_connections.TryGetValue(url, out Connection? connection) && connection is not null)
+                return connection;
+
+            return await EstablishNewConnection(url, cancellationToken).ConfigureAwait(false);
+        }
+    }
+
+    private async Task<Connection> EstablishNewConnection(PulsarUrl url, CancellationToken cancellationToken)
+    {
+        var stream = await _connector.Connect(url.Physical).ConfigureAwait(false);
+        var connection = new Connection(new PulsarStream(stream), _keepAliveInterval);
+        DotPulsarEventSource.Log.ConnectionCreated();
+        _connections[url] = connection;
+        _ = connection.ProcessIncommingFrames().ContinueWith(t => DisposeConnection(url));
+        var commandConnect = _commandConnect;
+
+        if (url.ProxyThroughServiceUrl)
+            commandConnect = WithProxyToBroker(_commandConnect, url.Logical);
+
+        var response = await connection.Send(commandConnect, cancellationToken).ConfigureAwait(false);
+        response.Expect(BaseCommand.Type.Connected);
+        return connection;
+    }
+
+    private async ValueTask DisposeConnection(PulsarUrl serviceUrl)
+    {
+        if (_connections.TryRemove(serviceUrl, out Connection? connection) && connection is not null)
+        {
+            await connection.DisposeAsync().ConfigureAwait(false);
+            DotPulsarEventSource.Log.ConnectionDisposed();
+        }
+    }
+
+    private static CommandConnect WithProxyToBroker(CommandConnect commandConnect, Uri logicalUrl)
+    {
+        return new CommandConnect
+        {
+            AuthData = commandConnect.AuthData,
+            AuthMethod = commandConnect.AuthMethod,
+            AuthMethodName = commandConnect.AuthMethodName,
+            ClientVersion = commandConnect.ClientVersion,
+            OriginalPrincipal = commandConnect.OriginalPrincipal,
+            ProtocolVersion = commandConnect.ProtocolVersion,
+            OriginalAuthData = commandConnect.OriginalAuthData,
+            OriginalAuthMethod = commandConnect.OriginalAuthMethod,
+            ProxyToBrokerUrl = $"{logicalUrl.Host}:{logicalUrl.Port}"
+        };
+    }
+
+    private async Task CloseInactiveConnections(TimeSpan interval, CancellationToken cancellationToken)
+    {
+        while (!cancellationToken.IsCancellationRequested)
+        {
+            try
             {
-                Topic = topic,
-                Authoritative = false,
-                AdvertisedListenerName = _listenerName
-            };
+                await Task.Delay(interval, cancellationToken).ConfigureAwait(false);
 
-            var physicalUrl = _serviceUrl;
-
-            while (true)
-            {
-                var connection = await GetConnection(physicalUrl, cancellationToken).ConfigureAwait(false);
-                var response = await connection.Send(lookup, cancellationToken).ConfigureAwait(false);
-
-                response.Expect(BaseCommand.Type.LookupResponse);
-
-                if (response.LookupTopicResponse.Response == CommandLookupTopicResponse.LookupType.Failed)
-                    response.LookupTopicResponse.Throw();
-
-                lookup.Authoritative = response.LookupTopicResponse.Authoritative;
-
-                var lookupResponseServiceUrl = new Uri(GetBrokerServiceUrl(response.LookupTopicResponse));
-
-                if (response.LookupTopicResponse.Response == CommandLookupTopicResponse.LookupType.Redirect || !response.LookupTopicResponse.Authoritative)
+                using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
                 {
-                    physicalUrl = lookupResponseServiceUrl;
-                    continue;
-                }
-
-                if (response.LookupTopicResponse.ProxyThroughServiceUrl)
-                {
-                    var url = new PulsarUrl(physicalUrl, lookupResponseServiceUrl);
-                    return await GetConnection(url, cancellationToken).ConfigureAwait(false);
-                }
-
-                // LookupType is 'Connect', ServiceUrl is local and response is authoritative. Assume the Pulsar server is a standalone docker.
-                return lookupResponseServiceUrl.IsLoopback
-                    ? connection
-                    : await GetConnection(lookupResponseServiceUrl, cancellationToken).ConfigureAwait(false);
-            }
-        }
-
-        private string GetBrokerServiceUrl(CommandLookupTopicResponse response)
-        {
-            var hasBrokerServiceUrl = !string.IsNullOrEmpty(response.BrokerServiceUrl);
-            var hasBrokerServiceUrlTls = !string.IsNullOrEmpty(response.BrokerServiceUrlTls);
-
-            switch (_encryptionPolicy)
-            {
-                case EncryptionPolicy.EnforceEncrypted:
-                    if (!hasBrokerServiceUrlTls)
-                        throw new ConnectionSecurityException("Cannot enforce encrypted connections. The lookup topic response from broker gave no secure alternative.");
-                    return response.BrokerServiceUrlTls;
-                case EncryptionPolicy.EnforceUnencrypted:
-                    if (!hasBrokerServiceUrl)
-                        throw new ConnectionSecurityException("Cannot enforce unencrypted connections. The lookup topic response from broker gave no unsecure alternative.");
-                    return response.BrokerServiceUrl;
-                case EncryptionPolicy.PreferEncrypted:
-                    return hasBrokerServiceUrlTls ? response.BrokerServiceUrlTls : response.BrokerServiceUrl;
-                default:
-                    return hasBrokerServiceUrl ? response.BrokerServiceUrl : response.BrokerServiceUrlTls;
-            }
-        }
-
-        private ValueTask<Connection> GetConnection(Uri serviceUrl, CancellationToken cancellationToken)
-        {
-            return GetConnection(new PulsarUrl(serviceUrl, serviceUrl), cancellationToken);
-        }
-
-        private async ValueTask<Connection> GetConnection(PulsarUrl url, CancellationToken cancellationToken)
-        {
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
-            {
-                if (_connections.TryGetValue(url, out Connection? connection) && connection is not null)
-                    return connection;
-
-                return await EstablishNewConnection(url, cancellationToken).ConfigureAwait(false);
-            }
-        }
-
-        private async Task<Connection> EstablishNewConnection(PulsarUrl url, CancellationToken cancellationToken)
-        {
-            var stream = await _connector.Connect(url.Physical).ConfigureAwait(false);
-            var connection = new Connection(new PulsarStream(stream), _keepAliveInterval);
-            DotPulsarEventSource.Log.ConnectionCreated();
-            _connections[url] = connection;
-            _ = connection.ProcessIncommingFrames().ContinueWith(t => DisposeConnection(url));
-            var commandConnect = _commandConnect;
-
-            if (url.ProxyThroughServiceUrl)
-                commandConnect = WithProxyToBroker(_commandConnect, url.Logical);
-
-            var response = await connection.Send(commandConnect, cancellationToken).ConfigureAwait(false);
-            response.Expect(BaseCommand.Type.Connected);
-            return connection;
-        }
-
-        private async ValueTask DisposeConnection(PulsarUrl serviceUrl)
-        {
-            if (_connections.TryRemove(serviceUrl, out Connection? connection) && connection is not null)
-            {
-                await connection.DisposeAsync().ConfigureAwait(false);
-                DotPulsarEventSource.Log.ConnectionDisposed();
-            }
-        }
-
-        private static CommandConnect WithProxyToBroker(CommandConnect commandConnect, Uri logicalUrl)
-        {
-            return new CommandConnect
-            {
-                AuthData = commandConnect.AuthData,
-                AuthMethod = commandConnect.AuthMethod,
-                AuthMethodName = commandConnect.AuthMethodName,
-                ClientVersion = commandConnect.ClientVersion,
-                OriginalPrincipal = commandConnect.OriginalPrincipal,
-                ProtocolVersion = commandConnect.ProtocolVersion,
-                OriginalAuthData = commandConnect.OriginalAuthData,
-                OriginalAuthMethod = commandConnect.OriginalAuthMethod,
-                ProxyToBrokerUrl = $"{logicalUrl.Host}:{logicalUrl.Port}"
-            };
-        }
-
-        private async Task CloseInactiveConnections(TimeSpan interval, CancellationToken cancellationToken)
-        {
-            while (!cancellationToken.IsCancellationRequested)
-            {
-                try
-                {
-                    await Task.Delay(interval, cancellationToken).ConfigureAwait(false);
-
-                    using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+                    var serviceUrls = _connections.Keys;
+                    foreach (var serviceUrl in serviceUrls)
                     {
-                        var serviceUrls = _connections.Keys;
-                        foreach (var serviceUrl in serviceUrls)
-                        {
-                            var connection = _connections[serviceUrl];
-                            if (connection is null)
-                                continue;
+                        var connection = _connections[serviceUrl];
+                        if (connection is null)
+                            continue;
 
-                            if (!await connection.HasChannels(cancellationToken).ConfigureAwait(false))
-                                await DisposeConnection(serviceUrl).ConfigureAwait(false);
-                        }
+                        if (!await connection.HasChannels(cancellationToken).ConfigureAwait(false))
+                            await DisposeConnection(serviceUrl).ConfigureAwait(false);
                     }
                 }
-                catch
-                {
-                    // ignored
-                }
+            }
+            catch
+            {
+                // ignored
             }
         }
+    }
 
-        private sealed class PulsarUrl : IEquatable<PulsarUrl>
+    private sealed class PulsarUrl : IEquatable<PulsarUrl>
+    {
+        public PulsarUrl(Uri physical, Uri logical)
         {
-            public PulsarUrl(Uri physical, Uri logical)
-            {
-                Physical = physical;
-                Logical = logical;
-                ProxyThroughServiceUrl = physical != logical;
-            }
-
-            public Uri Physical { get; }
-
-            public Uri Logical { get; }
-
-            public bool ProxyThroughServiceUrl { get; }
-
-            public bool Equals(PulsarUrl? other)
-            {
-                if (other is null)
-                    return false;
-
-                if (ReferenceEquals(this, other))
-                    return true;
-
-                return Physical.Equals(other.Physical) && Logical.Equals(other.Logical);
-            }
-
-            public override bool Equals(object? obj)
-                => obj is PulsarUrl url && Equals(url);
-
-            public override int GetHashCode()
-                => HashCode.Combine(Physical, Logical);
-
-            public override string ToString()
-                => $"{nameof(Physical)}: {Physical}, {nameof(Logical)}: {Logical}, {nameof(ProxyThroughServiceUrl)}: {ProxyThroughServiceUrl}";
+            Physical = physical;
+            Logical = logical;
+            ProxyThroughServiceUrl = physical != logical;
         }
+
+        public Uri Physical { get; }
+
+        public Uri Logical { get; }
+
+        public bool ProxyThroughServiceUrl { get; }
+
+        public bool Equals(PulsarUrl? other)
+        {
+            if (other is null)
+                return false;
+
+            if (ReferenceEquals(this, other))
+                return true;
+
+            return Physical.Equals(other.Physical) && Logical.Equals(other.Logical);
+        }
+
+        public override bool Equals(object? obj)
+            => obj is PulsarUrl url && Equals(url);
+
+        public override int GetHashCode()
+            => HashCode.Combine(Physical, Logical);
+
+        public override string ToString()
+            => $"{nameof(Physical)}: {Physical}, {nameof(Logical)}: {Logical}, {nameof(ProxyThroughServiceUrl)}: {ProxyThroughServiceUrl}";
     }
 }
diff --git a/src/DotPulsar/Internal/Connector.cs b/src/DotPulsar/Internal/Connector.cs
index 52b2774..99f761f 100644
--- a/src/DotPulsar/Internal/Connector.cs
+++ b/src/DotPulsar/Internal/Connector.cs
@@ -12,132 +12,131 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System;
+using System.IO;
+using System.Net;
+using System.Net.Security;
+using System.Net.Sockets;
+using System.Security.Authentication;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading.Tasks;
+
+public sealed class Connector
 {
-    using System;
-    using System.IO;
-    using System.Net;
-    using System.Net.Security;
-    using System.Net.Sockets;
-    using System.Security.Authentication;
-    using System.Security.Cryptography.X509Certificates;
-    using System.Threading.Tasks;
+    private readonly X509Certificate2Collection _clientCertificates;
+    private readonly X509Certificate2? _trustedCertificateAuthority;
+    private readonly bool _verifyCertificateAuthority;
+    private readonly bool _verifyCertificateName;
 
-    public sealed class Connector
+    public Connector(
+        X509Certificate2Collection clientCertificates,
+        X509Certificate2? trustedCertificateAuthority,
+        bool verifyCertificateAuthority,
+        bool verifyCertificateName)
     {
-        private readonly X509Certificate2Collection _clientCertificates;
-        private readonly X509Certificate2? _trustedCertificateAuthority;
-        private readonly bool _verifyCertificateAuthority;
-        private readonly bool _verifyCertificateName;
+        _clientCertificates = clientCertificates;
+        _trustedCertificateAuthority = trustedCertificateAuthority;
+        _verifyCertificateAuthority = verifyCertificateAuthority;
+        _verifyCertificateName = verifyCertificateName;
+    }
 
-        public Connector(
-            X509Certificate2Collection clientCertificates,
-            X509Certificate2? trustedCertificateAuthority,
-            bool verifyCertificateAuthority,
-            bool verifyCertificateName)
+    public async Task<Stream> Connect(Uri serviceUrl)
+    {
+        var scheme = serviceUrl.Scheme;
+        var host = serviceUrl.Host;
+        var port = serviceUrl.Port;
+        var encrypt = scheme == Constants.PulsarSslScheme;
+
+        if (port == -1)
+            port = encrypt ? Constants.DefaultPulsarSSLPort : Constants.DefaultPulsarPort;
+
+        var stream = await GetStream(host, port).ConfigureAwait(false);
+
+        if (encrypt)
+            stream = await EncryptStream(stream, host).ConfigureAwait(false);
+
+        return stream;
+    }
+
+    private static async Task<Stream> GetStream(string host, int port)
+    {
+        var tcpClient = new TcpClient();
+
+        try
         {
-            _clientCertificates = clientCertificates;
-            _trustedCertificateAuthority = trustedCertificateAuthority;
-            _verifyCertificateAuthority = verifyCertificateAuthority;
-            _verifyCertificateName = verifyCertificateName;
+            var type = Uri.CheckHostName(host);
+
+            if (type == UriHostNameType.IPv4 || type == UriHostNameType.IPv6)
+                await tcpClient.ConnectAsync(IPAddress.Parse(host), port).ConfigureAwait(false);
+            else
+                await tcpClient.ConnectAsync(host, port).ConfigureAwait(false);
+
+            return tcpClient.GetStream();
         }
-
-        public async Task<Stream> Connect(Uri serviceUrl)
+        catch
         {
-            var scheme = serviceUrl.Scheme;
-            var host = serviceUrl.Host;
-            var port = serviceUrl.Port;
-            var encrypt = scheme == Constants.PulsarSslScheme;
-
-            if (port == -1)
-                port = encrypt ? Constants.DefaultPulsarSSLPort : Constants.DefaultPulsarPort;
-
-            var stream = await GetStream(host, port).ConfigureAwait(false);
-
-            if (encrypt)
-                stream = await EncryptStream(stream, host).ConfigureAwait(false);
-
-            return stream;
+            tcpClient.Dispose();
+            throw;
         }
+    }
 
-        private static async Task<Stream> GetStream(string host, int port)
+    private async Task<Stream> EncryptStream(Stream stream, string host)
+    {
+        SslStream? sslStream = null;
+
+        try
         {
-            var tcpClient = new TcpClient();
-
-            try
-            {
-                var type = Uri.CheckHostName(host);
-
-                if (type == UriHostNameType.IPv4 || type == UriHostNameType.IPv6)
-                    await tcpClient.ConnectAsync(IPAddress.Parse(host), port).ConfigureAwait(false);
-                else
-                    await tcpClient.ConnectAsync(host, port).ConfigureAwait(false);
-
-                return tcpClient.GetStream();
-            }
-            catch
-            {
-                tcpClient.Dispose();
-                throw;
-            }
+            sslStream = new SslStream(stream, false, ValidateServerCertificate, null);
+            await sslStream.AuthenticateAsClientAsync(host, _clientCertificates, SslProtocols.None, true).ConfigureAwait(false);
+            return sslStream;
         }
-
-        private async Task<Stream> EncryptStream(Stream stream, string host)
+        catch
         {
-            SslStream? sslStream = null;
-
-            try
-            {
-                sslStream = new SslStream(stream, false, ValidateServerCertificate, null);
-                await sslStream.AuthenticateAsClientAsync(host, _clientCertificates, SslProtocols.None, true).ConfigureAwait(false);
-                return sslStream;
-            }
-            catch
-            {
 #if NETSTANDARD2_0
-                if (sslStream is null)
-                    stream.Dispose();
-                else
-                    sslStream.Dispose();
+            if (sslStream is null)
+                stream.Dispose();
+            else
+                sslStream.Dispose();
 #else
                 if (sslStream is null)
                     await stream.DisposeAsync().ConfigureAwait(false);
                 else
                     await sslStream.DisposeAsync().ConfigureAwait(false);
 #endif
-                throw;
-            }
+            throw;
         }
+    }
 
-        private bool ValidateServerCertificate(object sender, X509Certificate? certificate, X509Chain? chain, SslPolicyErrors sslPolicyErrors)
-        {
-            if (sslPolicyErrors == SslPolicyErrors.None)
-                return true;
-
-            if (sslPolicyErrors.HasFlag(SslPolicyErrors.RemoteCertificateNotAvailable))
-                return false;
-
-            if (sslPolicyErrors.HasFlag(SslPolicyErrors.RemoteCertificateNameMismatch) && _verifyCertificateName)
-                return false;
-
-            if (sslPolicyErrors.HasFlag(SslPolicyErrors.RemoteCertificateChainErrors) && _verifyCertificateAuthority)
-            {
-                if (_trustedCertificateAuthority is null || chain is null || certificate is null)
-                    return false;
-
-                chain.ChainPolicy.ExtraStore.Add(_trustedCertificateAuthority);
-                _ = chain.Build((X509Certificate2) certificate);
-
-                for (var i = 0; i < chain.ChainElements.Count; i++)
-                {
-                    if (chain.ChainElements[i].Certificate.Thumbprint == _trustedCertificateAuthority.Thumbprint)
-                        return true;
-                }
-
-                return false;
-            }
-
+    private bool ValidateServerCertificate(object sender, X509Certificate? certificate, X509Chain? chain, SslPolicyErrors sslPolicyErrors)
+    {
+        if (sslPolicyErrors == SslPolicyErrors.None)
             return true;
+
+        if (sslPolicyErrors.HasFlag(SslPolicyErrors.RemoteCertificateNotAvailable))
+            return false;
+
+        if (sslPolicyErrors.HasFlag(SslPolicyErrors.RemoteCertificateNameMismatch) && _verifyCertificateName)
+            return false;
+
+        if (sslPolicyErrors.HasFlag(SslPolicyErrors.RemoteCertificateChainErrors) && _verifyCertificateAuthority)
+        {
+            if (_trustedCertificateAuthority is null || chain is null || certificate is null)
+                return false;
+
+            chain.ChainPolicy.ExtraStore.Add(_trustedCertificateAuthority);
+            _ = chain.Build((X509Certificate2) certificate);
+
+            for (var i = 0; i < chain.ChainElements.Count; i++)
+            {
+                if (chain.ChainElements[i].Certificate.Thumbprint == _trustedCertificateAuthority.Thumbprint)
+                    return true;
+            }
+
+            return false;
         }
+
+        return true;
     }
 }
diff --git a/src/DotPulsar/Internal/Constants.cs b/src/DotPulsar/Internal/Constants.cs
index 9ee752b..0630812 100644
--- a/src/DotPulsar/Internal/Constants.cs
+++ b/src/DotPulsar/Internal/Constants.cs
@@ -12,44 +12,43 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System;
+
+public static class Constants
 {
-    using System;
-
-    public static class Constants
+    static Constants()
     {
-        static Constants()
-        {
-            var assembly = typeof(Constants).Assembly;
-            var assemblyName = assembly.GetName();
-            if (assemblyName.Name is null)
-                throw new Exception($"Assembly name of {assembly.FullName} is null");
+        var assembly = typeof(Constants).Assembly;
+        var assemblyName = assembly.GetName();
+        if (assemblyName.Name is null)
+            throw new Exception($"Assembly name of {assembly.FullName} is null");
 
-            var assemblyVersion = assemblyName.Version;
-            if (assemblyVersion is null)
-                throw new Exception($"Assembly version of {assembly.FullName} is null");
+        var assemblyVersion = assemblyName.Version;
+        if (assemblyVersion is null)
+            throw new Exception($"Assembly version of {assembly.FullName} is null");
 
-            ClientName = assemblyName.Name;
-            ClientVersion = assemblyVersion.ToString(3);
-            ProtocolVersion = 14;
-            PulsarScheme = "pulsar";
-            PulsarSslScheme = "pulsar+ssl";
-            DefaultPulsarPort = 6650;
-            DefaultPulsarSSLPort = 6651;
-            MagicNumber = new byte[] { 0x0e, 0x01 };
-            MetadataSizeOffset = 6;
-            MetadataOffset = 10;
-        }
-
-        public static string ClientName { get; }
-        public static string ClientVersion { get; }
-        public static int ProtocolVersion { get; }
-        public static string PulsarScheme { get; }
-        public static string PulsarSslScheme { get; }
-        public static int DefaultPulsarPort { get; }
-        public static int DefaultPulsarSSLPort { get; }
-        public static byte[] MagicNumber { get; }
-        public static int MetadataSizeOffset { get; }
-        public static int MetadataOffset { get; }
+        ClientName = assemblyName.Name;
+        ClientVersion = assemblyVersion.ToString(3);
+        ProtocolVersion = 14;
+        PulsarScheme = "pulsar";
+        PulsarSslScheme = "pulsar+ssl";
+        DefaultPulsarPort = 6650;
+        DefaultPulsarSSLPort = 6651;
+        MagicNumber = new byte[] { 0x0e, 0x01 };
+        MetadataSizeOffset = 6;
+        MetadataOffset = 10;
     }
+
+    public static string ClientName { get; }
+    public static string ClientVersion { get; }
+    public static int ProtocolVersion { get; }
+    public static string PulsarScheme { get; }
+    public static string PulsarSslScheme { get; }
+    public static int DefaultPulsarPort { get; }
+    public static int DefaultPulsarSSLPort { get; }
+    public static byte[] MagicNumber { get; }
+    public static int MetadataSizeOffset { get; }
+    public static int MetadataOffset { get; }
 }
diff --git a/src/DotPulsar/Internal/Consumer.cs b/src/DotPulsar/Internal/Consumer.cs
index 3d50ead..a81b3ee 100644
--- a/src/DotPulsar/Internal/Consumer.cs
+++ b/src/DotPulsar/Internal/Consumer.cs
@@ -12,195 +12,194 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using DotPulsar.Internal.Extensions;
+using Events;
+using Microsoft.Extensions.ObjectPool;
+using PulsarApi;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class Consumer<TMessage> : IEstablishNewChannel, IConsumer<TMessage>
 {
-    using Abstractions;
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using DotPulsar.Internal.Extensions;
-    using Events;
-    using Microsoft.Extensions.ObjectPool;
-    using PulsarApi;
-    using System;
-    using System.Collections.Generic;
-    using System.Linq;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly Guid _correlationId;
+    private readonly IRegisterEvent _eventRegister;
+    private IConsumerChannel<TMessage> _channel;
+    private readonly ObjectPool<CommandAck> _commandAckPool;
+    private readonly IExecute _executor;
+    private readonly IStateChanged<ConsumerState> _state;
+    private readonly IConsumerChannelFactory<TMessage> _factory;
+    private int _isDisposed;
 
-    public sealed class Consumer<TMessage> : IEstablishNewChannel, IConsumer<TMessage>
+    public Uri ServiceUrl { get; }
+    public string SubscriptionName { get; }
+    public string Topic { get; }
+
+    public Consumer(
+        Guid correlationId,
+        Uri serviceUrl,
+        string subscriptionName,
+        string topic,
+        IRegisterEvent eventRegister,
+        IConsumerChannel<TMessage> initialChannel,
+        IExecute executor,
+        IStateChanged<ConsumerState> state,
+        IConsumerChannelFactory<TMessage> factory)
     {
-        private readonly Guid _correlationId;
-        private readonly IRegisterEvent _eventRegister;
-        private IConsumerChannel<TMessage> _channel;
-        private readonly ObjectPool<CommandAck> _commandAckPool;
-        private readonly IExecute _executor;
-        private readonly IStateChanged<ConsumerState> _state;
-        private readonly IConsumerChannelFactory<TMessage> _factory;
-        private int _isDisposed;
+        _correlationId = correlationId;
+        ServiceUrl = serviceUrl;
+        SubscriptionName = subscriptionName;
+        Topic = topic;
+        _eventRegister = eventRegister;
+        _channel = initialChannel;
+        _executor = executor;
+        _state = state;
+        _factory = factory;
+        _commandAckPool = new DefaultObjectPool<CommandAck>(new DefaultPooledObjectPolicy<CommandAck>());
+        _isDisposed = 0;
 
-        public Uri ServiceUrl { get; }
-        public string SubscriptionName { get; }
-        public string Topic { get; }
+        _eventRegister.Register(new ConsumerCreated(_correlationId));
+    }
 
-        public Consumer(
-            Guid correlationId,
-            Uri serviceUrl,
-            string subscriptionName,
-            string topic,
-            IRegisterEvent eventRegister,
-            IConsumerChannel<TMessage> initialChannel,
-            IExecute executor,
-            IStateChanged<ConsumerState> state,
-            IConsumerChannelFactory<TMessage> factory)
+    public async ValueTask<ConsumerState> OnStateChangeTo(ConsumerState state, CancellationToken cancellationToken)
+        => await _state.StateChangedTo(state, cancellationToken).ConfigureAwait(false);
+
+    public async ValueTask<ConsumerState> OnStateChangeFrom(ConsumerState state, CancellationToken cancellationToken)
+        => await _state.StateChangedFrom(state, cancellationToken).ConfigureAwait(false);
+
+    public bool IsFinalState()
+        => _state.IsFinalState();
+
+    public bool IsFinalState(ConsumerState state)
+        => _state.IsFinalState(state);
+
+    public async ValueTask DisposeAsync()
+    {
+        if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+            return;
+
+        _eventRegister.Register(new ConsumerDisposed(_correlationId));
+        await _channel.ClosedByClient(CancellationToken.None).ConfigureAwait(false);
+        await _channel.DisposeAsync().ConfigureAwait(false);
+    }
+
+    public async ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        return await _executor.Execute(() => ReceiveMessage(cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
+
+    private async ValueTask<IMessage<TMessage>> ReceiveMessage(CancellationToken cancellationToken)
+        => await _channel.Receive(cancellationToken).ConfigureAwait(false);
+
+    public async ValueTask Acknowledge(MessageId messageId, CancellationToken cancellationToken)
+        => await Acknowledge(messageId, CommandAck.AckType.Individual, cancellationToken).ConfigureAwait(false);
+
+    public async ValueTask AcknowledgeCumulative(MessageId messageId, CancellationToken cancellationToken)
+        => await Acknowledge(messageId, CommandAck.AckType.Cumulative, cancellationToken).ConfigureAwait(false);
+
+    public async ValueTask RedeliverUnacknowledgedMessages(IEnumerable<MessageId> messageIds, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        var command = new CommandRedeliverUnacknowledgedMessages();
+        command.MessageIds.AddRange(messageIds.Select(messageId => messageId.ToMessageIdData()));
+        await _executor.Execute(() => RedeliverUnacknowledgedMessages(command, cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
+
+    public async ValueTask RedeliverUnacknowledgedMessages(CancellationToken cancellationToken)
+        => await RedeliverUnacknowledgedMessages(Enumerable.Empty<MessageId>(), cancellationToken).ConfigureAwait(false);
+
+    public async ValueTask Unsubscribe(CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        var unsubscribe = new CommandUnsubscribe();
+        await _executor.Execute(() => Unsubscribe(unsubscribe, cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
+
+    private async ValueTask Unsubscribe(CommandUnsubscribe command, CancellationToken cancellationToken)
+        => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
+
+    public async ValueTask Seek(MessageId messageId, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        var seek = new CommandSeek { MessageId = messageId.ToMessageIdData() };
+        await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
+
+    public async ValueTask Seek(ulong publishTime, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        var seek = new CommandSeek { MessagePublishTime = publishTime };
+        await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
+
+    public async ValueTask<MessageId> GetLastMessageId(CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        var getLastMessageId = new CommandGetLastMessageId();
+        return await _executor.Execute(() => GetLastMessageId(getLastMessageId, cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
+
+    private async ValueTask<MessageId> GetLastMessageId(CommandGetLastMessageId command, CancellationToken cancellationToken)
+        => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
+
+    private async Task Seek(CommandSeek command, CancellationToken cancellationToken)
+        => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
+
+    private async ValueTask Acknowledge(MessageId messageId, CommandAck.AckType ackType, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        var commandAck = _commandAckPool.Get();
+        commandAck.Type = ackType;
+        if (commandAck.MessageIds.Count == 0)
+            commandAck.MessageIds.Add(messageId.ToMessageIdData());
+        else
+            commandAck.MessageIds[0].MapFrom(messageId);
+
+        try
         {
-            _correlationId = correlationId;
-            ServiceUrl = serviceUrl;
-            SubscriptionName = subscriptionName;
-            Topic = topic;
-            _eventRegister = eventRegister;
-            _channel = initialChannel;
-            _executor = executor;
-            _state = state;
-            _factory = factory;
-            _commandAckPool = new DefaultObjectPool<CommandAck>(new DefaultPooledObjectPolicy<CommandAck>());
-            _isDisposed = 0;
-
-            _eventRegister.Register(new ConsumerCreated(_correlationId));
+            await _executor.Execute(() => Acknowledge(commandAck, cancellationToken), cancellationToken).ConfigureAwait(false);
         }
-
-        public async ValueTask<ConsumerState> OnStateChangeTo(ConsumerState state, CancellationToken cancellationToken)
-            => await _state.StateChangedTo(state, cancellationToken).ConfigureAwait(false);
-
-        public async ValueTask<ConsumerState> OnStateChangeFrom(ConsumerState state, CancellationToken cancellationToken)
-            => await _state.StateChangedFrom(state, cancellationToken).ConfigureAwait(false);
-
-        public bool IsFinalState()
-            => _state.IsFinalState();
-
-        public bool IsFinalState(ConsumerState state)
-            => _state.IsFinalState(state);
-
-        public async ValueTask DisposeAsync()
+        finally
         {
-            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
-                return;
-
-            _eventRegister.Register(new ConsumerDisposed(_correlationId));
-            await _channel.ClosedByClient(CancellationToken.None).ConfigureAwait(false);
-            await _channel.DisposeAsync().ConfigureAwait(false);
+            _commandAckPool.Return(commandAck);
         }
+    }
 
-        public async ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
+    private async ValueTask Acknowledge(CommandAck command, CancellationToken cancellationToken)
+        => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
 
-            return await _executor.Execute(() => ReceiveMessage(cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
+    private async ValueTask RedeliverUnacknowledgedMessages(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken)
+        => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
 
-        private async ValueTask<IMessage<TMessage>> ReceiveMessage(CancellationToken cancellationToken)
-            => await _channel.Receive(cancellationToken).ConfigureAwait(false);
+    private void ThrowIfDisposed()
+    {
+        if (_isDisposed != 0)
+            throw new ConsumerDisposedException(GetType().FullName!);
+    }
 
-        public async ValueTask Acknowledge(MessageId messageId, CancellationToken cancellationToken)
-            => await Acknowledge(messageId, CommandAck.AckType.Individual, cancellationToken).ConfigureAwait(false);
+    public async Task EstablishNewChannel(CancellationToken cancellationToken)
+    {
+        var channel = await _executor.Execute(() => _factory.Create(cancellationToken), cancellationToken).ConfigureAwait(false);
 
-        public async ValueTask AcknowledgeCumulative(MessageId messageId, CancellationToken cancellationToken)
-            => await Acknowledge(messageId, CommandAck.AckType.Cumulative, cancellationToken).ConfigureAwait(false);
+        var oldChannel = _channel;
+        _channel = channel;
 
-        public async ValueTask RedeliverUnacknowledgedMessages(IEnumerable<MessageId> messageIds, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            var command = new CommandRedeliverUnacknowledgedMessages();
-            command.MessageIds.AddRange(messageIds.Select(messageId => messageId.ToMessageIdData()));
-            await _executor.Execute(() => RedeliverUnacknowledgedMessages(command, cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
-
-        public async ValueTask RedeliverUnacknowledgedMessages(CancellationToken cancellationToken)
-            => await RedeliverUnacknowledgedMessages(Enumerable.Empty<MessageId>(), cancellationToken).ConfigureAwait(false);
-
-        public async ValueTask Unsubscribe(CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            var unsubscribe = new CommandUnsubscribe();
-            await _executor.Execute(() => Unsubscribe(unsubscribe, cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
-
-        private async ValueTask Unsubscribe(CommandUnsubscribe command, CancellationToken cancellationToken)
-            => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
-
-        public async ValueTask Seek(MessageId messageId, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            var seek = new CommandSeek { MessageId = messageId.ToMessageIdData() };
-            await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
-
-        public async ValueTask Seek(ulong publishTime, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            var seek = new CommandSeek { MessagePublishTime = publishTime };
-            await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
-
-        public async ValueTask<MessageId> GetLastMessageId(CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            var getLastMessageId = new CommandGetLastMessageId();
-            return await _executor.Execute(() => GetLastMessageId(getLastMessageId, cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
-
-        private async ValueTask<MessageId> GetLastMessageId(CommandGetLastMessageId command, CancellationToken cancellationToken)
-            => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
-
-        private async Task Seek(CommandSeek command, CancellationToken cancellationToken)
-            => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
-
-        private async ValueTask Acknowledge(MessageId messageId, CommandAck.AckType ackType, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            var commandAck = _commandAckPool.Get();
-            commandAck.Type = ackType;
-            if (commandAck.MessageIds.Count == 0)
-                commandAck.MessageIds.Add(messageId.ToMessageIdData());
-            else
-                commandAck.MessageIds[0].MapFrom(messageId);
-
-            try
-            {
-                await _executor.Execute(() => Acknowledge(commandAck, cancellationToken), cancellationToken).ConfigureAwait(false);
-            }
-            finally
-            {
-                _commandAckPool.Return(commandAck);
-            }
-        }
-
-        private async ValueTask Acknowledge(CommandAck command, CancellationToken cancellationToken)
-            => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
-
-        private async ValueTask RedeliverUnacknowledgedMessages(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken)
-            => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
-
-        private void ThrowIfDisposed()
-        {
-            if (_isDisposed != 0)
-                throw new ConsumerDisposedException(GetType().FullName!);
-        }
-
-        public async Task EstablishNewChannel(CancellationToken cancellationToken)
-        {
-            var channel = await _executor.Execute(() => _factory.Create(cancellationToken), cancellationToken).ConfigureAwait(false);
-
-            var oldChannel = _channel;
-            _channel = channel;
-
-            if (oldChannel is not null)
-                await oldChannel.DisposeAsync().ConfigureAwait(false);
-        }
+        if (oldChannel is not null)
+            await oldChannel.DisposeAsync().ConfigureAwait(false);
     }
 }
diff --git a/src/DotPulsar/Internal/ConsumerBuilder.cs b/src/DotPulsar/Internal/ConsumerBuilder.cs
index 3e48ece..bac10c2 100644
--- a/src/DotPulsar/Internal/ConsumerBuilder.cs
+++ b/src/DotPulsar/Internal/ConsumerBuilder.cs
@@ -12,110 +12,109 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+
+public sealed class ConsumerBuilder<TMessage> : IConsumerBuilder<TMessage>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
+    private readonly IPulsarClient _pulsarClient;
+    private readonly ISchema<TMessage> _schema;
+    private string? _consumerName;
+    private SubscriptionInitialPosition _initialPosition;
+    private int _priorityLevel;
+    private uint _messagePrefetchCount;
+    private bool _readCompacted;
+    private string? _subscriptionName;
+    private SubscriptionType _subscriptionType;
+    private string? _topic;
+    private IHandleStateChanged<ConsumerStateChanged>? _stateChangedHandler;
 
-    public sealed class ConsumerBuilder<TMessage> : IConsumerBuilder<TMessage>
+    public ConsumerBuilder(IPulsarClient pulsarClient, ISchema<TMessage> schema)
     {
-        private readonly IPulsarClient _pulsarClient;
-        private readonly ISchema<TMessage> _schema;
-        private string? _consumerName;
-        private SubscriptionInitialPosition _initialPosition;
-        private int _priorityLevel;
-        private uint _messagePrefetchCount;
-        private bool _readCompacted;
-        private string? _subscriptionName;
-        private SubscriptionType _subscriptionType;
-        private string? _topic;
-        private IHandleStateChanged<ConsumerStateChanged>? _stateChangedHandler;
+        _schema = schema;
+        _pulsarClient = pulsarClient;
+        _initialPosition = ConsumerOptions<TMessage>.DefaultInitialPosition;
+        _priorityLevel = ConsumerOptions<TMessage>.DefaultPriorityLevel;
+        _messagePrefetchCount = ConsumerOptions<TMessage>.DefaultMessagePrefetchCount;
+        _readCompacted = ConsumerOptions<TMessage>.DefaultReadCompacted;
+        _subscriptionType = ConsumerOptions<TMessage>.DefaultSubscriptionType;
+    }
 
-        public ConsumerBuilder(IPulsarClient pulsarClient, ISchema<TMessage> schema)
+    public IConsumerBuilder<TMessage> ConsumerName(string name)
+    {
+        _consumerName = name;
+        return this;
+    }
+
+    public IConsumerBuilder<TMessage> InitialPosition(SubscriptionInitialPosition initialPosition)
+    {
+        _initialPosition = initialPosition;
+        return this;
+    }
+
+    public IConsumerBuilder<TMessage> MessagePrefetchCount(uint count)
+    {
+        _messagePrefetchCount = count;
+        return this;
+    }
+
+    public IConsumerBuilder<TMessage> PriorityLevel(int priorityLevel)
+    {
+        _priorityLevel = priorityLevel;
+        return this;
+    }
+
+    public IConsumerBuilder<TMessage> ReadCompacted(bool readCompacted)
+    {
+        _readCompacted = readCompacted;
+        return this;
+    }
+
+    public IConsumerBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ConsumerStateChanged> handler)
+    {
+        _stateChangedHandler = handler;
+        return this;
+    }
+
+    public IConsumerBuilder<TMessage> SubscriptionName(string name)
+    {
+        _subscriptionName = name;
+        return this;
+    }
+
+    public IConsumerBuilder<TMessage> SubscriptionType(SubscriptionType type)
+    {
+        _subscriptionType = type;
+        return this;
+    }
+
+    public IConsumerBuilder<TMessage> Topic(string topic)
+    {
+        _topic = topic;
+        return this;
+    }
+
+    public IConsumer<TMessage> Create()
+    {
+        if (string.IsNullOrEmpty(_subscriptionName))
+            throw new ConfigurationException("SubscriptionName may not be null or empty");
+
+        if (string.IsNullOrEmpty(_topic))
+            throw new ConfigurationException("Topic may not be null or empty");
+
+        var options = new ConsumerOptions<TMessage>(_subscriptionName!, _topic!, _schema)
         {
-            _schema = schema;
-            _pulsarClient = pulsarClient;
-            _initialPosition = ConsumerOptions<TMessage>.DefaultInitialPosition;
-            _priorityLevel = ConsumerOptions<TMessage>.DefaultPriorityLevel;
-            _messagePrefetchCount = ConsumerOptions<TMessage>.DefaultMessagePrefetchCount;
-            _readCompacted = ConsumerOptions<TMessage>.DefaultReadCompacted;
-            _subscriptionType = ConsumerOptions<TMessage>.DefaultSubscriptionType;
-        }
+            ConsumerName = _consumerName,
+            InitialPosition = _initialPosition,
+            MessagePrefetchCount = _messagePrefetchCount,
+            PriorityLevel = _priorityLevel,
+            ReadCompacted = _readCompacted,
+            StateChangedHandler = _stateChangedHandler,
+            SubscriptionType = _subscriptionType
+        };
 
-        public IConsumerBuilder<TMessage> ConsumerName(string name)
-        {
-            _consumerName = name;
-            return this;
-        }
-
-        public IConsumerBuilder<TMessage> InitialPosition(SubscriptionInitialPosition initialPosition)
-        {
-            _initialPosition = initialPosition;
-            return this;
-        }
-
-        public IConsumerBuilder<TMessage> MessagePrefetchCount(uint count)
-        {
-            _messagePrefetchCount = count;
-            return this;
-        }
-
-        public IConsumerBuilder<TMessage> PriorityLevel(int priorityLevel)
-        {
-            _priorityLevel = priorityLevel;
-            return this;
-        }
-
-        public IConsumerBuilder<TMessage> ReadCompacted(bool readCompacted)
-        {
-            _readCompacted = readCompacted;
-            return this;
-        }
-
-        public IConsumerBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ConsumerStateChanged> handler)
-        {
-            _stateChangedHandler = handler;
-            return this;
-        }
-
-        public IConsumerBuilder<TMessage> SubscriptionName(string name)
-        {
-            _subscriptionName = name;
-            return this;
-        }
-
-        public IConsumerBuilder<TMessage> SubscriptionType(SubscriptionType type)
-        {
-            _subscriptionType = type;
-            return this;
-        }
-
-        public IConsumerBuilder<TMessage> Topic(string topic)
-        {
-            _topic = topic;
-            return this;
-        }
-
-        public IConsumer<TMessage> Create()
-        {
-            if (string.IsNullOrEmpty(_subscriptionName))
-                throw new ConfigurationException("SubscriptionName may not be null or empty");
-
-            if (string.IsNullOrEmpty(_topic))
-                throw new ConfigurationException("Topic may not be null or empty");
-
-            var options = new ConsumerOptions<TMessage>(_subscriptionName!, _topic!, _schema)
-            {
-                ConsumerName = _consumerName,
-                InitialPosition = _initialPosition,
-                MessagePrefetchCount = _messagePrefetchCount,
-                PriorityLevel = _priorityLevel,
-                ReadCompacted = _readCompacted,
-                StateChangedHandler = _stateChangedHandler,
-                SubscriptionType = _subscriptionType
-            };
-
-            return _pulsarClient.CreateConsumer(options);
-        }
+        return _pulsarClient.CreateConsumer(options);
     }
 }
diff --git a/src/DotPulsar/Internal/ConsumerChannel.cs b/src/DotPulsar/Internal/ConsumerChannel.cs
index 3dfe343..dadefa1 100644
--- a/src/DotPulsar/Internal/ConsumerChannel.cs
+++ b/src/DotPulsar/Internal/ConsumerChannel.cs
@@ -12,227 +12,226 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using Extensions;
+using PulsarApi;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class ConsumerChannel<TMessage> : IConsumerChannel<TMessage>
 {
-    using Abstractions;
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using Extensions;
-    using PulsarApi;
-    using System;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly ulong _id;
+    private readonly AsyncQueue<MessagePackage> _queue;
+    private readonly IConnection _connection;
+    private readonly BatchHandler<TMessage> _batchHandler;
+    private readonly CommandFlow _cachedCommandFlow;
+    private readonly IMessageFactory<TMessage> _messageFactory;
+    private readonly IDecompress?[] _decompressors;
+    private readonly AsyncLock _lock;
+    private uint _sendWhenZero;
+    private bool _firstFlow;
 
-    public sealed class ConsumerChannel<TMessage> : IConsumerChannel<TMessage>
+    public ConsumerChannel(
+        ulong id,
+        uint messagePrefetchCount,
+        AsyncQueue<MessagePackage> queue,
+        IConnection connection,
+        BatchHandler<TMessage> batchHandler,
+        IMessageFactory<TMessage> messageFactory,
+        IEnumerable<IDecompressorFactory> decompressorFactories)
     {
-        private readonly ulong _id;
-        private readonly AsyncQueue<MessagePackage> _queue;
-        private readonly IConnection _connection;
-        private readonly BatchHandler<TMessage> _batchHandler;
-        private readonly CommandFlow _cachedCommandFlow;
-        private readonly IMessageFactory<TMessage> _messageFactory;
-        private readonly IDecompress?[] _decompressors;
-        private readonly AsyncLock _lock;
-        private uint _sendWhenZero;
-        private bool _firstFlow;
+        _id = id;
+        _queue = queue;
+        _connection = connection;
+        _batchHandler = batchHandler;
+        _messageFactory = messageFactory;
 
-        public ConsumerChannel(
-            ulong id,
-            uint messagePrefetchCount,
-            AsyncQueue<MessagePackage> queue,
-            IConnection connection,
-            BatchHandler<TMessage> batchHandler,
-            IMessageFactory<TMessage> messageFactory,
-            IEnumerable<IDecompressorFactory> decompressorFactories)
+        _decompressors = new IDecompress[5];
+
+        foreach (var decompressorFactory in decompressorFactories)
         {
-            _id = id;
-            _queue = queue;
-            _connection = connection;
-            _batchHandler = batchHandler;
-            _messageFactory = messageFactory;
-
-            _decompressors = new IDecompress[5];
-
-            foreach (var decompressorFactory in decompressorFactories)
-            {
-                _decompressors[(int) decompressorFactory.CompressionType] = decompressorFactory.Create();
-            }
-
-            _lock = new AsyncLock();
-
-            _cachedCommandFlow = new CommandFlow
-            {
-                ConsumerId = id,
-                MessagePermits = messagePrefetchCount
-            };
-
-            _sendWhenZero = 0;
-            _firstFlow = true;
+            _decompressors[(int) decompressorFactory.CompressionType] = decompressorFactory.Create();
         }
 
-        public async ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken)
+        _lock = new AsyncLock();
+
+        _cachedCommandFlow = new CommandFlow
         {
-            using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+            ConsumerId = id,
+            MessagePermits = messagePrefetchCount
+        };
+
+        _sendWhenZero = 0;
+        _firstFlow = true;
+    }
+
+    public async ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken)
+    {
+        using (await _lock.Lock(cancellationToken).ConfigureAwait(false))
+        {
+            while (true)
             {
-                while (true)
+                if (_sendWhenZero == 0)
+                    await SendFlow(cancellationToken).ConfigureAwait(false);
+
+                _sendWhenZero--;
+
+                var message = _batchHandler.GetNext();
+
+                if (message is not null)
+                    return message;
+
+                var messagePackage = await _queue.Dequeue(cancellationToken).ConfigureAwait(false);
+
+                if (!messagePackage.ValidateMagicNumberAndChecksum())
                 {
-                    if (_sendWhenZero == 0)
-                        await SendFlow(cancellationToken).ConfigureAwait(false);
+                    await RejectPackage(messagePackage, CommandAck.ValidationErrorType.ChecksumMismatch, cancellationToken).ConfigureAwait(false);
+                    continue;
+                }
 
-                    _sendWhenZero--;
+                var metadataSize = messagePackage.GetMetadataSize();
+                var metadata = messagePackage.ExtractMetadata(metadataSize);
+                var data = messagePackage.ExtractData(metadataSize);
 
-                    var message = _batchHandler.GetNext();
+                if (metadata.Compression != CompressionType.None)
+                {
+                    var decompressor = _decompressors[(int) metadata.Compression];
+                    if (decompressor is null)
+                        throw new CompressionException($"Support for {metadata.Compression} compression was not found");
 
-                    if (message is not null)
-                        return message;
-
-                    var messagePackage = await _queue.Dequeue(cancellationToken).ConfigureAwait(false);
-
-                    if (!messagePackage.ValidateMagicNumberAndChecksum())
+                    try
                     {
-                        await RejectPackage(messagePackage, CommandAck.ValidationErrorType.ChecksumMismatch, cancellationToken).ConfigureAwait(false);
+                        data = decompressor.Decompress(data, (int) metadata.UncompressedSize);
+                    }
+                    catch
+                    {
+                        await RejectPackage(messagePackage, CommandAck.ValidationErrorType.DecompressionError, cancellationToken).ConfigureAwait(false);
                         continue;
                     }
-
-                    var metadataSize = messagePackage.GetMetadataSize();
-                    var metadata = messagePackage.ExtractMetadata(metadataSize);
-                    var data = messagePackage.ExtractData(metadataSize);
-
-                    if (metadata.Compression != CompressionType.None)
-                    {
-                        var decompressor = _decompressors[(int) metadata.Compression];
-                        if (decompressor is null)
-                            throw new CompressionException($"Support for {metadata.Compression} compression was not found");
-
-                        try
-                        {
-                            data = decompressor.Decompress(data, (int) metadata.UncompressedSize);
-                        }
-                        catch
-                        {
-                            await RejectPackage(messagePackage, CommandAck.ValidationErrorType.DecompressionError, cancellationToken).ConfigureAwait(false);
-                            continue;
-                        }
-                    }
-
-                    var messageId = messagePackage.MessageId;
-                    var redeliveryCount = messagePackage.RedeliveryCount;
-
-                    if (metadata.ShouldSerializeNumMessagesInBatch())
-                    {
-                        try
-                        {
-                            return _batchHandler.Add(messageId, redeliveryCount, metadata, data);
-                        }
-                        catch
-                        {
-                            await RejectPackage(messagePackage, CommandAck.ValidationErrorType.BatchDeSerializeError, cancellationToken).ConfigureAwait(false);
-                            continue;
-                        }
-                    }
-
-                    return _messageFactory.Create(messageId.ToMessageId(), redeliveryCount, data, metadata);
                 }
+
+                var messageId = messagePackage.MessageId;
+                var redeliveryCount = messagePackage.RedeliveryCount;
+
+                if (metadata.ShouldSerializeNumMessagesInBatch())
+                {
+                    try
+                    {
+                        return _batchHandler.Add(messageId, redeliveryCount, metadata, data);
+                    }
+                    catch
+                    {
+                        await RejectPackage(messagePackage, CommandAck.ValidationErrorType.BatchDeSerializeError, cancellationToken).ConfigureAwait(false);
+                        continue;
+                    }
+                }
+
+                return _messageFactory.Create(messageId.ToMessageId(), redeliveryCount, data, metadata);
             }
         }
+    }
 
-        public async Task Send(CommandAck command, CancellationToken cancellationToken)
+    public async Task Send(CommandAck command, CancellationToken cancellationToken)
+    {
+        var messageId = command.MessageIds[0];
+
+        if (messageId.BatchIndex != -1)
         {
-            var messageId = command.MessageIds[0];
+            var batchMessageId = _batchHandler.Acknowledge(messageId);
 
-            if (messageId.BatchIndex != -1)
-            {
-                var batchMessageId = _batchHandler.Acknowledge(messageId);
+            if (batchMessageId is null)
+                return;
 
-                if (batchMessageId is null)
-                    return;
-
-                command.MessageIds[0] = batchMessageId;
-            }
-
-            command.ConsumerId = _id;
-            await _connection.Send(command, cancellationToken).ConfigureAwait(false);
+            command.MessageIds[0] = batchMessageId;
         }
 
-        public async Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken)
+        command.ConsumerId = _id;
+        await _connection.Send(command, cancellationToken).ConfigureAwait(false);
+    }
+
+    public async Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken)
+    {
+        command.ConsumerId = _id;
+        await _connection.Send(command, cancellationToken).ConfigureAwait(false);
+    }
+
+    public async Task Send(CommandUnsubscribe command, CancellationToken cancellationToken)
+    {
+        command.ConsumerId = _id;
+        var response = await _connection.Send(command, cancellationToken).ConfigureAwait(false);
+        response.Expect(BaseCommand.Type.Success);
+    }
+
+    public async Task Send(CommandSeek command, CancellationToken cancellationToken)
+    {
+        command.ConsumerId = _id;
+        var response = await _connection.Send(command, cancellationToken).ConfigureAwait(false);
+        response.Expect(BaseCommand.Type.Success);
+        _batchHandler.Clear();
+    }
+
+    public async Task<MessageId> Send(CommandGetLastMessageId command, CancellationToken cancellationToken)
+    {
+        command.ConsumerId = _id;
+        var response = await _connection.Send(command, cancellationToken).ConfigureAwait(false);
+        response.Expect(BaseCommand.Type.GetLastMessageIdResponse);
+        return response.GetLastMessageIdResponse.LastMessageId.ToMessageId();
+    }
+
+    public async ValueTask DisposeAsync()
+    {
+        _queue.Dispose();
+
+        for (var i = 0; i < _decompressors.Length; ++i)
         {
-            command.ConsumerId = _id;
-            await _connection.Send(command, cancellationToken).ConfigureAwait(false);
+            _decompressors[i]?.Dispose();
         }
 
-        public async Task Send(CommandUnsubscribe command, CancellationToken cancellationToken)
+        await _lock.DisposeAsync().ConfigureAwait(false);
+    }
+
+    private async ValueTask SendFlow(CancellationToken cancellationToken)
+    {
+        await _connection.Send(_cachedCommandFlow, cancellationToken).ConfigureAwait(false);
+
+        if (_firstFlow)
         {
-            command.ConsumerId = _id;
-            var response = await _connection.Send(command, cancellationToken).ConfigureAwait(false);
-            response.Expect(BaseCommand.Type.Success);
+            _cachedCommandFlow.MessagePermits = (uint) Math.Ceiling(_cachedCommandFlow.MessagePermits * 0.5);
+            _firstFlow = false;
         }
 
-        public async Task Send(CommandSeek command, CancellationToken cancellationToken)
+        _sendWhenZero = _cachedCommandFlow.MessagePermits;
+    }
+
+    private async Task RejectPackage(MessagePackage messagePackage, CommandAck.ValidationErrorType validationErrorType, CancellationToken cancellationToken)
+    {
+        var ack = new CommandAck
         {
-            command.ConsumerId = _id;
-            var response = await _connection.Send(command, cancellationToken).ConfigureAwait(false);
-            response.Expect(BaseCommand.Type.Success);
-            _batchHandler.Clear();
+            Type = CommandAck.AckType.Individual,
+            ValidationError = validationErrorType
+        };
+
+        ack.MessageIds.Add(messagePackage.MessageId);
+
+        await Send(ack, cancellationToken).ConfigureAwait(false);
+    }
+
+    public async ValueTask ClosedByClient(CancellationToken cancellationToken)
+    {
+        try
+        {
+            var closeConsumer = new CommandCloseConsumer { ConsumerId = _id };
+            await _connection.Send(closeConsumer, cancellationToken).ConfigureAwait(false);
         }
-
-        public async Task<MessageId> Send(CommandGetLastMessageId command, CancellationToken cancellationToken)
+        catch
         {
-            command.ConsumerId = _id;
-            var response = await _connection.Send(command, cancellationToken).ConfigureAwait(false);
-            response.Expect(BaseCommand.Type.GetLastMessageIdResponse);
-            return response.GetLastMessageIdResponse.LastMessageId.ToMessageId();
-        }
-
-        public async ValueTask DisposeAsync()
-        {
-            _queue.Dispose();
-
-            for (var i = 0; i < _decompressors.Length; ++i)
-            {
-                _decompressors[i]?.Dispose();
-            }
-
-            await _lock.DisposeAsync().ConfigureAwait(false);
-        }
-
-        private async ValueTask SendFlow(CancellationToken cancellationToken)
-        {
-            await _connection.Send(_cachedCommandFlow, cancellationToken).ConfigureAwait(false);
-
-            if (_firstFlow)
-            {
-                _cachedCommandFlow.MessagePermits = (uint) Math.Ceiling(_cachedCommandFlow.MessagePermits * 0.5);
-                _firstFlow = false;
-            }
-
-            _sendWhenZero = _cachedCommandFlow.MessagePermits;
-        }
-
-        private async Task RejectPackage(MessagePackage messagePackage, CommandAck.ValidationErrorType validationErrorType, CancellationToken cancellationToken)
-        {
-            var ack = new CommandAck
-            {
-                Type = CommandAck.AckType.Individual,
-                ValidationError = validationErrorType
-            };
-
-            ack.MessageIds.Add(messagePackage.MessageId);
-
-            await Send(ack, cancellationToken).ConfigureAwait(false);
-        }
-
-        public async ValueTask ClosedByClient(CancellationToken cancellationToken)
-        {
-            try
-            {
-                var closeConsumer = new CommandCloseConsumer { ConsumerId = _id };
-                await _connection.Send(closeConsumer, cancellationToken).ConfigureAwait(false);
-            }
-            catch
-            {
-                // Ignore
-            }
+            // Ignore
         }
     }
 }
diff --git a/src/DotPulsar/Internal/ConsumerChannelFactory.cs b/src/DotPulsar/Internal/ConsumerChannelFactory.cs
index 24954f7..69de5ac 100644
--- a/src/DotPulsar/Internal/ConsumerChannelFactory.cs
+++ b/src/DotPulsar/Internal/ConsumerChannelFactory.cs
@@ -12,53 +12,52 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using PulsarApi;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class ConsumerChannelFactory<TMessage> : IConsumerChannelFactory<TMessage>
 {
-    using Abstractions;
-    using PulsarApi;
-    using System;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly Guid _correlationId;
+    private readonly IRegisterEvent _eventRegister;
+    private readonly IConnectionPool _connectionPool;
+    private readonly CommandSubscribe _subscribe;
+    private readonly uint _messagePrefetchCount;
+    private readonly BatchHandler<TMessage> _batchHandler;
+    private readonly IMessageFactory<TMessage> _messageFactory;
+    private readonly IEnumerable<IDecompressorFactory> _decompressorFactories;
 
-    public sealed class ConsumerChannelFactory<TMessage> : IConsumerChannelFactory<TMessage>
+    public ConsumerChannelFactory(
+        Guid correlationId,
+        IRegisterEvent eventRegister,
+        IConnectionPool connectionPool,
+        CommandSubscribe subscribe,
+        uint messagePrefetchCount,
+        BatchHandler<TMessage> batchHandler,
+        IMessageFactory<TMessage> messageFactory,
+        IEnumerable<IDecompressorFactory> decompressorFactories)
     {
-        private readonly Guid _correlationId;
-        private readonly IRegisterEvent _eventRegister;
-        private readonly IConnectionPool _connectionPool;
-        private readonly CommandSubscribe _subscribe;
-        private readonly uint _messagePrefetchCount;
-        private readonly BatchHandler<TMessage> _batchHandler;
-        private readonly IMessageFactory<TMessage> _messageFactory;
-        private readonly IEnumerable<IDecompressorFactory> _decompressorFactories;
+        _correlationId = correlationId;
+        _eventRegister = eventRegister;
+        _connectionPool = connectionPool;
+        _subscribe = subscribe;
+        _messagePrefetchCount = messagePrefetchCount;
+        _batchHandler = batchHandler;
+        _messageFactory = messageFactory;
+        _decompressorFactories = decompressorFactories;
+    }
 
-        public ConsumerChannelFactory(
-            Guid correlationId,
-            IRegisterEvent eventRegister,
-            IConnectionPool connectionPool,
-            CommandSubscribe subscribe,
-            uint messagePrefetchCount,
-            BatchHandler<TMessage> batchHandler,
-            IMessageFactory<TMessage> messageFactory,
-            IEnumerable<IDecompressorFactory> decompressorFactories)
-        {
-            _correlationId = correlationId;
-            _eventRegister = eventRegister;
-            _connectionPool = connectionPool;
-            _subscribe = subscribe;
-            _messagePrefetchCount = messagePrefetchCount;
-            _batchHandler = batchHandler;
-            _messageFactory = messageFactory;
-            _decompressorFactories = decompressorFactories;
-        }
-
-        public async Task<IConsumerChannel<TMessage>> Create(CancellationToken cancellationToken)
-        {
-            var connection = await _connectionPool.FindConnectionForTopic(_subscribe.Topic, cancellationToken).ConfigureAwait(false);
-            var messageQueue = new AsyncQueue<MessagePackage>();
-            var channel = new Channel(_correlationId, _eventRegister, messageQueue);
-            var response = await connection.Send(_subscribe, channel, cancellationToken).ConfigureAwait(false);
-            return new ConsumerChannel<TMessage>(response.ConsumerId, _messagePrefetchCount, messageQueue, connection, _batchHandler, _messageFactory, _decompressorFactories);
-        }
+    public async Task<IConsumerChannel<TMessage>> Create(CancellationToken cancellationToken)
+    {
+        var connection = await _connectionPool.FindConnectionForTopic(_subscribe.Topic, cancellationToken).ConfigureAwait(false);
+        var messageQueue = new AsyncQueue<MessagePackage>();
+        var channel = new Channel(_correlationId, _eventRegister, messageQueue);
+        var response = await connection.Send(_subscribe, channel, cancellationToken).ConfigureAwait(false);
+        return new ConsumerChannel<TMessage>(response.ConsumerId, _messagePrefetchCount, messageQueue, connection, _batchHandler, _messageFactory, _decompressorFactories);
     }
 }
diff --git a/src/DotPulsar/Internal/ConsumerProcess.cs b/src/DotPulsar/Internal/ConsumerProcess.cs
index f2296c2..af2ef22 100644
--- a/src/DotPulsar/Internal/ConsumerProcess.cs
+++ b/src/DotPulsar/Internal/ConsumerProcess.cs
@@ -12,71 +12,70 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using System;
+using System.Threading.Tasks;
+
+public sealed class ConsumerProcess : Process
 {
-    using Abstractions;
-    using System;
-    using System.Threading.Tasks;
+    private readonly IStateManager<ConsumerState> _stateManager;
+    private readonly IEstablishNewChannel _consumer;
+    private readonly bool _isFailoverSubscription;
 
-    public sealed class ConsumerProcess : Process
+    public ConsumerProcess(
+        Guid correlationId,
+        IStateManager<ConsumerState> stateManager,
+        IEstablishNewChannel consumer,
+        bool isFailoverSubscription) : base(correlationId)
     {
-        private readonly IStateManager<ConsumerState> _stateManager;
-        private readonly IEstablishNewChannel _consumer;
-        private readonly bool _isFailoverSubscription;
+        _stateManager = stateManager;
+        _consumer = consumer;
+        _isFailoverSubscription = isFailoverSubscription;
+    }
 
-        public ConsumerProcess(
-            Guid correlationId,
-            IStateManager<ConsumerState> stateManager,
-            IEstablishNewChannel consumer,
-            bool isFailoverSubscription) : base(correlationId)
+    public override async ValueTask DisposeAsync()
+    {
+        _stateManager.SetState(ConsumerState.Closed);
+        CancellationTokenSource.Cancel();
+        await _consumer.DisposeAsync().ConfigureAwait(false);
+    }
+
+    protected override void CalculateState()
+    {
+        if (_stateManager.IsFinalState())
+            return;
+
+        if (ExecutorState == ExecutorState.Faulted)
         {
-            _stateManager = stateManager;
-            _consumer = consumer;
-            _isFailoverSubscription = isFailoverSubscription;
+            _stateManager.SetState(ConsumerState.Faulted);
+            return;
         }
 
-        public override async ValueTask DisposeAsync()
+        switch (ChannelState)
         {
-            _stateManager.SetState(ConsumerState.Closed);
-            CancellationTokenSource.Cancel();
-            await _consumer.DisposeAsync().ConfigureAwait(false);
-        }
-
-        protected override void CalculateState()
-        {
-            if (_stateManager.IsFinalState())
+            case ChannelState.Active:
+                _stateManager.SetState(ConsumerState.Active);
                 return;
-
-            if (ExecutorState == ExecutorState.Faulted)
-            {
-                _stateManager.SetState(ConsumerState.Faulted);
+            case ChannelState.Inactive:
+                _stateManager.SetState(ConsumerState.Inactive);
                 return;
-            }
-
-            switch (ChannelState)
-            {
-                case ChannelState.Active:
+            case ChannelState.ClosedByServer:
+            case ChannelState.Disconnected:
+                _stateManager.SetState(ConsumerState.Disconnected);
+                _ = _consumer.EstablishNewChannel(CancellationTokenSource.Token);
+                return;
+            case ChannelState.Connected:
+                if (!_isFailoverSubscription)
                     _stateManager.SetState(ConsumerState.Active);
-                    return;
-                case ChannelState.Inactive:
-                    _stateManager.SetState(ConsumerState.Inactive);
-                    return;
-                case ChannelState.ClosedByServer:
-                case ChannelState.Disconnected:
-                    _stateManager.SetState(ConsumerState.Disconnected);
-                    _ = _consumer.EstablishNewChannel(CancellationTokenSource.Token);
-                    return;
-                case ChannelState.Connected:
-                    if (!_isFailoverSubscription)
-                        _stateManager.SetState(ConsumerState.Active);
-                    return;
-                case ChannelState.ReachedEndOfTopic:
-                    _stateManager.SetState(ConsumerState.ReachedEndOfTopic);
-                    return;
-                case ChannelState.Unsubscribed:
-                    _stateManager.SetState(ConsumerState.Unsubscribed);
-                    return;
-            }
+                return;
+            case ChannelState.ReachedEndOfTopic:
+                _stateManager.SetState(ConsumerState.ReachedEndOfTopic);
+                return;
+            case ChannelState.Unsubscribed:
+                _stateManager.SetState(ConsumerState.Unsubscribed);
+                return;
         }
     }
 }
diff --git a/src/DotPulsar/Internal/Crc32C.cs b/src/DotPulsar/Internal/Crc32C.cs
index 63d641a..fa82bca 100644
--- a/src/DotPulsar/Internal/Crc32C.cs
+++ b/src/DotPulsar/Internal/Crc32C.cs
@@ -12,82 +12,81 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System.Buffers;
+
+public static class Crc32C
 {
-    using System.Buffers;
+    private const uint _generator = 0x82F63B78u;
 
-    public static class Crc32C
+    private static readonly uint[] _lookup;
+
+    static Crc32C()
     {
-        private const uint _generator = 0x82F63B78u;
+        _lookup = new uint[16 * 256];
 
-        private static readonly uint[] _lookup;
-
-        static Crc32C()
+        for (uint i = 0; i < 256; i++)
         {
-            _lookup = new uint[16 * 256];
+            var entry = i;
 
-            for (uint i = 0; i < 256; i++)
+            for (var j = 0; j < 16; j++)
             {
-                var entry = i;
+                for (var k = 0; k < 8; k++)
+                    entry = (entry & 1) == 1 ? _generator ^ (entry >> 1) : entry >> 1;
 
-                for (var j = 0; j < 16; j++)
+                _lookup[j * 256 + i] = entry;
+            }
+        }
+    }
+
+    public static uint Calculate(ReadOnlySequence<byte> sequence)
+    {
+        var block = new uint[16];
+        var checksum = uint.MaxValue;
+        var remaningBytes = sequence.Length;
+        var readingBlock = remaningBytes >= 16;
+        var offset = 15;
+
+        foreach (var memory in sequence)
+        {
+            var span = memory.Span;
+
+            for (var i = 0; i < span.Length; ++i)
+            {
+                var currentByte = span[i];
+
+                if (!readingBlock)
                 {
-                    for (var k = 0; k < 8; k++)
-                        entry = (entry & 1) == 1 ? _generator ^ (entry >> 1) : entry >> 1;
+                    checksum = _lookup[(byte) (checksum ^ currentByte)] ^ (checksum >> 8);
+                    continue;
+                }
 
-                    _lookup[j * 256 + i] = entry;
+                var offSetBase = offset * 256;
+
+                if (offset > 11)
+                    block[offset] = _lookup[offSetBase + ((byte) (checksum >> (8 * (15 - offset))) ^ currentByte)];
+                else
+                    block[offset] = _lookup[offSetBase + currentByte];
+
+                --remaningBytes;
+
+                if (offset == 0)
+                {
+                    offset = 15;
+                    readingBlock = remaningBytes >= 16;
+                    checksum = 0;
+
+                    for (var j = 0; j < block.Length; ++j)
+                        checksum ^= block[j];
+                }
+                else
+                {
+                    --offset;
                 }
             }
         }
 
-        public static uint Calculate(ReadOnlySequence<byte> sequence)
-        {
-            var block = new uint[16];
-            var checksum = uint.MaxValue;
-            var remaningBytes = sequence.Length;
-            var readingBlock = remaningBytes >= 16;
-            var offset = 15;
-
-            foreach (var memory in sequence)
-            {
-                var span = memory.Span;
-
-                for (var i = 0; i < span.Length; ++i)
-                {
-                    var currentByte = span[i];
-
-                    if (!readingBlock)
-                    {
-                        checksum = _lookup[(byte) (checksum ^ currentByte)] ^ (checksum >> 8);
-                        continue;
-                    }
-
-                    var offSetBase = offset * 256;
-
-                    if (offset > 11)
-                        block[offset] = _lookup[offSetBase + ((byte) (checksum >> (8 * (15 - offset))) ^ currentByte)];
-                    else
-                        block[offset] = _lookup[offSetBase + currentByte];
-
-                    --remaningBytes;
-
-                    if (offset == 0)
-                    {
-                        offset = 15;
-                        readingBlock = remaningBytes >= 16;
-                        checksum = 0;
-
-                        for (var j = 0; j < block.Length; ++j)
-                            checksum ^= block[j];
-                    }
-                    else
-                    {
-                        --offset;
-                    }
-                }
-            }
-
-            return checksum ^ uint.MaxValue;
-        }
+        return checksum ^ uint.MaxValue;
     }
 }
diff --git a/src/DotPulsar/Internal/DefaultExceptionHandler.cs b/src/DotPulsar/Internal/DefaultExceptionHandler.cs
index c064153..f143ead 100644
--- a/src/DotPulsar/Internal/DefaultExceptionHandler.cs
+++ b/src/DotPulsar/Internal/DefaultExceptionHandler.cs
@@ -12,55 +12,54 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using Exceptions;
+using System;
+using System.Net.Sockets;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class DefaultExceptionHandler : IHandleException
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using Exceptions;
-    using System;
-    using System.Net.Sockets;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly TimeSpan _retryInterval;
 
-    public sealed class DefaultExceptionHandler : IHandleException
+    public DefaultExceptionHandler(TimeSpan retryInterval)
+        => _retryInterval = retryInterval;
+
+    public async ValueTask OnException(ExceptionContext exceptionContext)
     {
-        private readonly TimeSpan _retryInterval;
+        exceptionContext.Result = DetermineFaultAction(exceptionContext.Exception, exceptionContext.CancellationToken);
 
-        public DefaultExceptionHandler(TimeSpan retryInterval)
-            => _retryInterval = retryInterval;
+        if (exceptionContext.Result == FaultAction.Retry)
+            await Task.Delay(_retryInterval, exceptionContext.CancellationToken).ConfigureAwait(false);
 
-        public async ValueTask OnException(ExceptionContext exceptionContext)
-        {
-            exceptionContext.Result = DetermineFaultAction(exceptionContext.Exception, exceptionContext.CancellationToken);
-
-            if (exceptionContext.Result == FaultAction.Retry)
-                await Task.Delay(_retryInterval, exceptionContext.CancellationToken).ConfigureAwait(false);
-
-            exceptionContext.ExceptionHandled = true;
-        }
-
-        private static FaultAction DetermineFaultAction(Exception exception, CancellationToken cancellationToken)
-            => exception switch
-            {
-                TooManyRequestsException _ => FaultAction.Retry,
-                ChannelNotReadyException _ => FaultAction.Retry,
-                ServiceNotReadyException _ => FaultAction.Retry,
-                MetadataException _ => FaultAction.Rethrow,
-                ConsumerNotFoundException _ => FaultAction.Retry,
-                ConnectionDisposedException _ => FaultAction.Retry,
-                AsyncLockDisposedException _ => FaultAction.Retry,
-                PulsarStreamDisposedException _ => FaultAction.Retry,
-                AsyncQueueDisposedException _ => FaultAction.Retry,
-                OperationCanceledException _ => cancellationToken.IsCancellationRequested ? FaultAction.Rethrow : FaultAction.Retry,
-                DotPulsarException _ => FaultAction.Rethrow,
-                SocketException socketException => socketException.SocketErrorCode switch
-                {
-                    SocketError.HostNotFound => FaultAction.Rethrow,
-                    SocketError.HostUnreachable => FaultAction.Rethrow,
-                    SocketError.NetworkUnreachable => FaultAction.Rethrow,
-                    _ => FaultAction.Retry
-                },
-                _ => FaultAction.Rethrow
-            };
+        exceptionContext.ExceptionHandled = true;
     }
+
+    private static FaultAction DetermineFaultAction(Exception exception, CancellationToken cancellationToken)
+        => exception switch
+        {
+            TooManyRequestsException _ => FaultAction.Retry,
+            ChannelNotReadyException _ => FaultAction.Retry,
+            ServiceNotReadyException _ => FaultAction.Retry,
+            MetadataException _ => FaultAction.Rethrow,
+            ConsumerNotFoundException _ => FaultAction.Retry,
+            ConnectionDisposedException _ => FaultAction.Retry,
+            AsyncLockDisposedException _ => FaultAction.Retry,
+            PulsarStreamDisposedException _ => FaultAction.Retry,
+            AsyncQueueDisposedException _ => FaultAction.Retry,
+            OperationCanceledException _ => cancellationToken.IsCancellationRequested ? FaultAction.Rethrow : FaultAction.Retry,
+            DotPulsarException _ => FaultAction.Rethrow,
+            SocketException socketException => socketException.SocketErrorCode switch
+            {
+                SocketError.HostNotFound => FaultAction.Rethrow,
+                SocketError.HostUnreachable => FaultAction.Rethrow,
+                SocketError.NetworkUnreachable => FaultAction.Rethrow,
+                _ => FaultAction.Retry
+            },
+            _ => FaultAction.Rethrow
+        };
 }
diff --git a/src/DotPulsar/Internal/DotPulsarActivitySource.cs b/src/DotPulsar/Internal/DotPulsarActivitySource.cs
index 87e2c3e..4f4c163 100644
--- a/src/DotPulsar/Internal/DotPulsarActivitySource.cs
+++ b/src/DotPulsar/Internal/DotPulsarActivitySource.cs
@@ -12,72 +12,71 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+public static class DotPulsarActivitySource
 {
-    using DotPulsar.Abstractions;
-    using System.Collections.Generic;
-    using System.Diagnostics;
+    private const string _traceParent = "traceparent";
+    private const string _traceState = "tracestate";
 
-    public static class DotPulsarActivitySource
+    static DotPulsarActivitySource()
     {
-        private const string _traceParent = "traceparent";
-        private const string _traceState = "tracestate";
+        ActivitySource = new ActivitySource(Constants.ClientName, Constants.ClientVersion);
+    }
 
-        static DotPulsarActivitySource()
+    public static ActivitySource ActivitySource { get; }
+
+    public static Activity? StartConsumerActivity(IMessage message, string operationName, KeyValuePair<string, object?>[] tags)
+    {
+        if (!ActivitySource.HasListeners())
+            return null;
+
+        var properties = message.Properties;
+
+        if (properties.TryGetValue(_traceParent, out var traceparent))
         {
-            ActivitySource = new ActivitySource(Constants.ClientName, Constants.ClientVersion);
+            var tracestate = properties.ContainsKey(_traceState) ? properties[_traceState] : null;
+            if (ActivityContext.TryParse(traceparent, tracestate, out var activityContext))
+                return ActivitySource.StartActivity(operationName, ActivityKind.Consumer, activityContext, tags);
         }
 
-        public static ActivitySource ActivitySource { get; }
+        var activity = ActivitySource.StartActivity(operationName, ActivityKind.Consumer);
 
-        public static Activity? StartConsumerActivity(IMessage message, string operationName, KeyValuePair<string, object?>[] tags)
+        if (activity is not null && activity.IsAllDataRequested)
         {
-            if (!ActivitySource.HasListeners())
-                return null;
-
-            var properties = message.Properties;
-
-            if (properties.TryGetValue(_traceParent, out var traceparent))
+            for (var i = 0; i < tags.Length; ++i)
             {
-                var tracestate = properties.ContainsKey(_traceState) ? properties[_traceState] : null;
-                if (ActivityContext.TryParse(traceparent, tracestate, out var activityContext))
-                    return ActivitySource.StartActivity(operationName, ActivityKind.Consumer, activityContext, tags);
+                var tag = tags[i];
+                activity.SetTag(tag.Key, tag.Value);
             }
-
-            var activity = ActivitySource.StartActivity(operationName, ActivityKind.Consumer);
-
-            if (activity is not null && activity.IsAllDataRequested)
-            {
-                for (var i = 0; i < tags.Length; ++i)
-                {
-                    var tag = tags[i];
-                    activity.SetTag(tag.Key, tag.Value);
-                }
-            }
-
-            return activity;
         }
 
-        public static Activity? StartProducerActivity(MessageMetadata metadata, string operationName, KeyValuePair<string, object?>[] tags)
+        return activity;
+    }
+
+    public static Activity? StartProducerActivity(MessageMetadata metadata, string operationName, KeyValuePair<string, object?>[] tags)
+    {
+        if (!ActivitySource.HasListeners())
+            return null;
+
+        var activity = ActivitySource.StartActivity(operationName, ActivityKind.Producer);
+
+        if (activity is not null && activity.IsAllDataRequested)
         {
-            if (!ActivitySource.HasListeners())
-                return null;
+            metadata[_traceParent] = activity.TraceId.ToHexString();
+            metadata[_traceState] = activity.TraceStateString;
 
-            var activity = ActivitySource.StartActivity(operationName, ActivityKind.Producer);
-
-            if (activity is not null && activity.IsAllDataRequested)
+            for (var i = 0; i < tags.Length; ++i)
             {
-                metadata[_traceParent] = activity.TraceId.ToHexString();
-                metadata[_traceState] = activity.TraceStateString;
-
-                for (var i = 0; i < tags.Length; ++i)
-                {
-                    var tag = tags[i];
-                    activity.SetTag(tag.Key, tag.Value);
-                }
+                var tag = tags[i];
+                activity.SetTag(tag.Key, tag.Value);
             }
-
-            return activity;
         }
+
+        return activity;
     }
 }
diff --git a/src/DotPulsar/Internal/DotPulsarEventSource.cs b/src/DotPulsar/Internal/DotPulsarEventSource.cs
index a988189..5547b07 100644
--- a/src/DotPulsar/Internal/DotPulsarEventSource.cs
+++ b/src/DotPulsar/Internal/DotPulsarEventSource.cs
@@ -12,186 +12,185 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
-{
+namespace DotPulsar.Internal;
+
 #if NETSTANDARD2_0
-    public sealed class DotPulsarEventSource
-    {
-        public static readonly DotPulsarEventSource Log = new();
+public sealed class DotPulsarEventSource
+{
+    public static readonly DotPulsarEventSource Log = new();
 
-        public void ClientCreated() { }
+    public void ClientCreated() { }
 
-        public void ClientDisposed() { }
+    public void ClientDisposed() { }
 
-        public void ConnectionCreated() { }
+    public void ConnectionCreated() { }
 
-        public void ConnectionDisposed() { }
+    public void ConnectionDisposed() { }
 
-        public void ConsumerCreated() { }
+    public void ConsumerCreated() { }
 
-        public void ConsumerDisposed() { }
+    public void ConsumerDisposed() { }
 
-        public void ProducerCreated() { }
+    public void ProducerCreated() { }
 
-        public void ProducerDisposed() { }
+    public void ProducerDisposed() { }
 
-        public void ReaderCreated() { }
+    public void ReaderCreated() { }
 
-        public void ReaderDisposed() { }
-    }
+    public void ReaderDisposed() { }
+}
 
 #else
-    using System.Diagnostics.Tracing;
-    using System.Threading;
+using System.Diagnostics.Tracing;
+using System.Threading;
 
-    public sealed class DotPulsarEventSource : EventSource
-    {
+public sealed class DotPulsarEventSource : EventSource
+{
 #pragma warning disable IDE0052 // Remove unread private members
-        private PollingCounter? _totalClientsCounter;
-        private long _totalClients;
+    private PollingCounter? _totalClientsCounter;
+    private long _totalClients;
 
-        private PollingCounter? _currentClientsCounter;
-        private long _currentClients;
+    private PollingCounter? _currentClientsCounter;
+    private long _currentClients;
 
-        private PollingCounter? _totalConnectionsCounter;
-        private long _totalConnections;
+    private PollingCounter? _totalConnectionsCounter;
+    private long _totalConnections;
 
-        private PollingCounter? _currentConnectionsCounter;
-        private long _currentConnections;
+    private PollingCounter? _currentConnectionsCounter;
+    private long _currentConnections;
 
-        private PollingCounter? _totalConsumersCounter;
-        private long _totalConsumers;
+    private PollingCounter? _totalConsumersCounter;
+    private long _totalConsumers;
 
-        private PollingCounter? _currentConsumersCounter;
-        private long _currentConsumers;
+    private PollingCounter? _currentConsumersCounter;
+    private long _currentConsumers;
 
-        private PollingCounter? _totalProducersCounter;
-        private long _totalProducers;
+    private PollingCounter? _totalProducersCounter;
+    private long _totalProducers;
 
-        private PollingCounter? _currentProducersCounter;
-        private long _currentProducers;
+    private PollingCounter? _currentProducersCounter;
+    private long _currentProducers;
 
-        private PollingCounter? _totalReadersCounter;
-        private long _totalReaders;
+    private PollingCounter? _totalReadersCounter;
+    private long _totalReaders;
 
-        private PollingCounter? _currentReadersCounter;
-        private long _currentReaders;
+    private PollingCounter? _currentReadersCounter;
+    private long _currentReaders;
 #pragma warning restore IDE0052 // Remove unread private members
 
-        public static readonly DotPulsarEventSource Log = new();
+    public static readonly DotPulsarEventSource Log = new();
 
-        public DotPulsarEventSource() : base("DotPulsar") { }
+    public DotPulsarEventSource() : base("DotPulsar") { }
 
-        public void ClientCreated()
-        {
-            Interlocked.Increment(ref _totalClients);
-            Interlocked.Increment(ref _currentClients);
-        }
-
-        public void ClientDisposed()
-        {
-            Interlocked.Decrement(ref _currentClients);
-        }
-
-        public void ConnectionCreated()
-        {
-            Interlocked.Increment(ref _totalConnections);
-            Interlocked.Increment(ref _currentConnections);
-        }
-
-        public void ConnectionDisposed()
-        {
-            Interlocked.Decrement(ref _currentConnections);
-        }
-
-        public void ConsumerCreated()
-        {
-            Interlocked.Increment(ref _totalConsumers);
-            Interlocked.Increment(ref _currentConsumers);
-        }
-
-        public void ConsumerDisposed()
-        {
-            Interlocked.Decrement(ref _currentConsumers);
-        }
-
-        public void ProducerCreated()
-        {
-            Interlocked.Increment(ref _totalProducers);
-            Interlocked.Increment(ref _currentProducers);
-        }
-
-        public void ProducerDisposed()
-        {
-            Interlocked.Decrement(ref _currentProducers);
-        }
-
-        public void ReaderCreated()
-        {
-            Interlocked.Increment(ref _totalReaders);
-            Interlocked.Increment(ref _currentReaders);
-        }
-
-        public void ReaderDisposed()
-        {
-            Interlocked.Decrement(ref _currentReaders);
-        }
-
-        protected override void OnEventCommand(EventCommandEventArgs command)
-        {
-            if (command.Command != EventCommand.Enable)
-                return;
-
-            _totalClientsCounter ??= new PollingCounter("total-clients", this, () => Volatile.Read(ref _totalClients))
-            {
-                DisplayName = "Total number of clients"
-            };
-
-            _currentClientsCounter ??= new PollingCounter("current-clients", this, () => Volatile.Read(ref _currentClients))
-            {
-                DisplayName = "Current number of clients"
-            };
-
-            _totalConnectionsCounter ??= new PollingCounter("total-connections", this, () => Volatile.Read(ref _totalConnections))
-            {
-                DisplayName = "Total number of connections"
-            };
-
-            _currentConnectionsCounter ??= new PollingCounter("current-connections", this, () => Volatile.Read(ref _currentConnections))
-            {
-                DisplayName = "Current number of connections"
-            };
-
-            _totalConsumersCounter ??= new PollingCounter("total-consumers", this, () => Volatile.Read(ref _totalConsumers))
-            {
-                DisplayName = "Total number of consumers"
-            };
-
-            _currentConsumersCounter ??= new PollingCounter("current-consumers", this, () => Volatile.Read(ref _currentConsumers))
-            {
-                DisplayName = "Current number of consumers"
-            };
-
-            _totalProducersCounter ??= new PollingCounter("total-producers", this, () => Volatile.Read(ref _totalProducers))
-            {
-                DisplayName = "Total number of producers"
-            };
-
-            _currentProducersCounter ??= new PollingCounter("current-producers", this, () => Volatile.Read(ref _currentProducers))
-            {
-                DisplayName = "Current number of producers"
-            };
-
-            _totalReadersCounter ??= new PollingCounter("total-readers", this, () => Volatile.Read(ref _totalReaders))
-            {
-                DisplayName = "Total number of readers"
-            };
-
-            _currentReadersCounter ??= new PollingCounter("current-readers", this, () => Volatile.Read(ref _currentReaders))
-            {
-                DisplayName = "Current number of readers"
-            };
-        }
+    public void ClientCreated()
+    {
+        Interlocked.Increment(ref _totalClients);
+        Interlocked.Increment(ref _currentClients);
     }
-#endif
+
+    public void ClientDisposed()
+    {
+        Interlocked.Decrement(ref _currentClients);
+    }
+
+    public void ConnectionCreated()
+    {
+        Interlocked.Increment(ref _totalConnections);
+        Interlocked.Increment(ref _currentConnections);
+    }
+
+    public void ConnectionDisposed()
+    {
+        Interlocked.Decrement(ref _currentConnections);
+    }
+
+    public void ConsumerCreated()
+    {
+        Interlocked.Increment(ref _totalConsumers);
+        Interlocked.Increment(ref _currentConsumers);
+    }
+
+    public void ConsumerDisposed()
+    {
+        Interlocked.Decrement(ref _currentConsumers);
+    }
+
+    public void ProducerCreated()
+    {
+        Interlocked.Increment(ref _totalProducers);
+        Interlocked.Increment(ref _currentProducers);
+    }
+
+    public void ProducerDisposed()
+    {
+        Interlocked.Decrement(ref _currentProducers);
+    }
+
+    public void ReaderCreated()
+    {
+        Interlocked.Increment(ref _totalReaders);
+        Interlocked.Increment(ref _currentReaders);
+    }
+
+    public void ReaderDisposed()
+    {
+        Interlocked.Decrement(ref _currentReaders);
+    }
+
+    protected override void OnEventCommand(EventCommandEventArgs command)
+    {
+        if (command.Command != EventCommand.Enable)
+            return;
+
+        _totalClientsCounter ??= new PollingCounter("total-clients", this, () => Volatile.Read(ref _totalClients))
+        {
+            DisplayName = "Total number of clients"
+        };
+
+        _currentClientsCounter ??= new PollingCounter("current-clients", this, () => Volatile.Read(ref _currentClients))
+        {
+            DisplayName = "Current number of clients"
+        };
+
+        _totalConnectionsCounter ??= new PollingCounter("total-connections", this, () => Volatile.Read(ref _totalConnections))
+        {
+            DisplayName = "Total number of connections"
+        };
+
+        _currentConnectionsCounter ??= new PollingCounter("current-connections", this, () => Volatile.Read(ref _currentConnections))
+        {
+            DisplayName = "Current number of connections"
+        };
+
+        _totalConsumersCounter ??= new PollingCounter("total-consumers", this, () => Volatile.Read(ref _totalConsumers))
+        {
+            DisplayName = "Total number of consumers"
+        };
+
+        _currentConsumersCounter ??= new PollingCounter("current-consumers", this, () => Volatile.Read(ref _currentConsumers))
+        {
+            DisplayName = "Current number of consumers"
+        };
+
+        _totalProducersCounter ??= new PollingCounter("total-producers", this, () => Volatile.Read(ref _totalProducers))
+        {
+            DisplayName = "Total number of producers"
+        };
+
+        _currentProducersCounter ??= new PollingCounter("current-producers", this, () => Volatile.Read(ref _currentProducers))
+        {
+            DisplayName = "Current number of producers"
+        };
+
+        _totalReadersCounter ??= new PollingCounter("total-readers", this, () => Volatile.Read(ref _totalReaders))
+        {
+            DisplayName = "Total number of readers"
+        };
+
+        _currentReadersCounter ??= new PollingCounter("current-readers", this, () => Volatile.Read(ref _currentReaders))
+        {
+            DisplayName = "Current number of readers"
+        };
+    }
 }
+#endif
diff --git a/src/DotPulsar/Internal/EnumLookup.cs b/src/DotPulsar/Internal/EnumLookup.cs
index 5d7bc33..009d2c1 100644
--- a/src/DotPulsar/Internal/EnumLookup.cs
+++ b/src/DotPulsar/Internal/EnumLookup.cs
@@ -12,28 +12,27 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System;
+using System.Linq;
+using System.Runtime.CompilerServices;
+
+public sealed class EnumLookup<TKey, TValue> where TKey : Enum
 {
-    using System;
-    using System.Linq;
-    using System.Runtime.CompilerServices;
+    private readonly TValue[] _values;
 
-    public sealed class EnumLookup<TKey, TValue> where TKey : Enum
+    public EnumLookup(TValue defaultValue)
     {
-        private readonly TValue[] _values;
-
-        public EnumLookup(TValue defaultValue)
-        {
-            var max = Enum.GetValues(typeof(TKey)).Cast<int>().Max() + 1;
-            _values = new TValue[max];
-            for (var i = 0; i < max; ++i)
-                _values[i] = defaultValue;
-        }
-
-        public void Set(TKey key, TValue value)
-            => _values[Unsafe.As<TKey, int>(ref key)] = value;
-
-        public TValue Get(TKey key)
-            => _values[Unsafe.As<TKey, int>(ref key)];
+        var max = Enum.GetValues(typeof(TKey)).Cast<int>().Max() + 1;
+        _values = new TValue[max];
+        for (var i = 0; i < max; ++i)
+            _values[i] = defaultValue;
     }
+
+    public void Set(TKey key, TValue value)
+        => _values[Unsafe.As<TKey, int>(ref key)] = value;
+
+    public TValue Get(TKey key)
+        => _values[Unsafe.As<TKey, int>(ref key)];
 }
diff --git a/src/DotPulsar/Internal/Events/ChannelActivated.cs b/src/DotPulsar/Internal/Events/ChannelActivated.cs
index 1300e24..506ee8a 100644
--- a/src/DotPulsar/Internal/Events/ChannelActivated.cs
+++ b/src/DotPulsar/Internal/Events/ChannelActivated.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ChannelActivated : IEvent
 {
-    using Abstractions;
-    using System;
+    public ChannelActivated(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ChannelActivated : IEvent
-    {
-        public ChannelActivated(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ChannelClosedByServer.cs b/src/DotPulsar/Internal/Events/ChannelClosedByServer.cs
index 274f45c..a5ed6d0 100644
--- a/src/DotPulsar/Internal/Events/ChannelClosedByServer.cs
+++ b/src/DotPulsar/Internal/Events/ChannelClosedByServer.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ChannelClosedByServer : IEvent
 {
-    using Abstractions;
-    using System;
+    public ChannelClosedByServer(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ChannelClosedByServer : IEvent
-    {
-        public ChannelClosedByServer(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ChannelConnected.cs b/src/DotPulsar/Internal/Events/ChannelConnected.cs
index 6640d62..20ef3d2 100644
--- a/src/DotPulsar/Internal/Events/ChannelConnected.cs
+++ b/src/DotPulsar/Internal/Events/ChannelConnected.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ChannelConnected : IEvent
 {
-    using Abstractions;
-    using System;
+    public ChannelConnected(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ChannelConnected : IEvent
-    {
-        public ChannelConnected(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ChannelDeactivated.cs b/src/DotPulsar/Internal/Events/ChannelDeactivated.cs
index 5b0cf93..204e240 100644
--- a/src/DotPulsar/Internal/Events/ChannelDeactivated.cs
+++ b/src/DotPulsar/Internal/Events/ChannelDeactivated.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ChannelDeactivated : IEvent
 {
-    using Abstractions;
-    using System;
+    public ChannelDeactivated(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ChannelDeactivated : IEvent
-    {
-        public ChannelDeactivated(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ChannelDisconnected.cs b/src/DotPulsar/Internal/Events/ChannelDisconnected.cs
index 60e98b2..e752f90 100644
--- a/src/DotPulsar/Internal/Events/ChannelDisconnected.cs
+++ b/src/DotPulsar/Internal/Events/ChannelDisconnected.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ChannelDisconnected : IEvent
 {
-    using Abstractions;
-    using System;
+    public ChannelDisconnected(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ChannelDisconnected : IEvent
-    {
-        public ChannelDisconnected(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ChannelReachedEndOfTopic.cs b/src/DotPulsar/Internal/Events/ChannelReachedEndOfTopic.cs
index 08c1d4e..65d61ca 100644
--- a/src/DotPulsar/Internal/Events/ChannelReachedEndOfTopic.cs
+++ b/src/DotPulsar/Internal/Events/ChannelReachedEndOfTopic.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ChannelReachedEndOfTopic : IEvent
 {
-    using Abstractions;
-    using System;
+    public ChannelReachedEndOfTopic(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ChannelReachedEndOfTopic : IEvent
-    {
-        public ChannelReachedEndOfTopic(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ChannelUnsubscribed.cs b/src/DotPulsar/Internal/Events/ChannelUnsubscribed.cs
index 000cf7c..71be9b2 100644
--- a/src/DotPulsar/Internal/Events/ChannelUnsubscribed.cs
+++ b/src/DotPulsar/Internal/Events/ChannelUnsubscribed.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ChannelUnsubscribed : IEvent
 {
-    using Abstractions;
-    using System;
+    public ChannelUnsubscribed(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ChannelUnsubscribed : IEvent
-    {
-        public ChannelUnsubscribed(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ConsumerCreated.cs b/src/DotPulsar/Internal/Events/ConsumerCreated.cs
index 41c5513..87d04ff 100644
--- a/src/DotPulsar/Internal/Events/ConsumerCreated.cs
+++ b/src/DotPulsar/Internal/Events/ConsumerCreated.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ConsumerCreated : IEvent
 {
-    using Abstractions;
-    using System;
+    public ConsumerCreated(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ConsumerCreated : IEvent
-    {
-        public ConsumerCreated(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ConsumerDisposed.cs b/src/DotPulsar/Internal/Events/ConsumerDisposed.cs
index 130f9c9..a767a66 100644
--- a/src/DotPulsar/Internal/Events/ConsumerDisposed.cs
+++ b/src/DotPulsar/Internal/Events/ConsumerDisposed.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ConsumerDisposed : IEvent
 {
-    using Abstractions;
-    using System;
+    public ConsumerDisposed(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ConsumerDisposed : IEvent
-    {
-        public ConsumerDisposed(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ExecutorFaulted.cs b/src/DotPulsar/Internal/Events/ExecutorFaulted.cs
index 33661a2..0ba9dad 100644
--- a/src/DotPulsar/Internal/Events/ExecutorFaulted.cs
+++ b/src/DotPulsar/Internal/Events/ExecutorFaulted.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ExecutorFaulted : IEvent
 {
-    using Abstractions;
-    using System;
+    public ExecutorFaulted(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ExecutorFaulted : IEvent
-    {
-        public ExecutorFaulted(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ProducerCreated.cs b/src/DotPulsar/Internal/Events/ProducerCreated.cs
index 2a89db7..66e110d 100644
--- a/src/DotPulsar/Internal/Events/ProducerCreated.cs
+++ b/src/DotPulsar/Internal/Events/ProducerCreated.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ProducerCreated : IEvent
 {
-    using Abstractions;
-    using System;
+    public ProducerCreated(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ProducerCreated : IEvent
-    {
-        public ProducerCreated(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ProducerDisposed.cs b/src/DotPulsar/Internal/Events/ProducerDisposed.cs
index 223024f..5bd1e2e 100644
--- a/src/DotPulsar/Internal/Events/ProducerDisposed.cs
+++ b/src/DotPulsar/Internal/Events/ProducerDisposed.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ProducerDisposed : IEvent
 {
-    using Abstractions;
-    using System;
+    public ProducerDisposed(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ProducerDisposed : IEvent
-    {
-        public ProducerDisposed(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ReaderCreated.cs b/src/DotPulsar/Internal/Events/ReaderCreated.cs
index 1aa55f1..43d29da 100644
--- a/src/DotPulsar/Internal/Events/ReaderCreated.cs
+++ b/src/DotPulsar/Internal/Events/ReaderCreated.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ReaderCreated : IEvent
 {
-    using Abstractions;
-    using System;
+    public ReaderCreated(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ReaderCreated : IEvent
-    {
-        public ReaderCreated(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/Events/ReaderDisposed.cs b/src/DotPulsar/Internal/Events/ReaderDisposed.cs
index 33a9ac6..f852488 100644
--- a/src/DotPulsar/Internal/Events/ReaderDisposed.cs
+++ b/src/DotPulsar/Internal/Events/ReaderDisposed.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Events
+namespace DotPulsar.Internal.Events;
+
+using Abstractions;
+using System;
+
+public sealed class ReaderDisposed : IEvent
 {
-    using Abstractions;
-    using System;
+    public ReaderDisposed(Guid correlationId)
+        => CorrelationId = correlationId;
 
-    public sealed class ReaderDisposed : IEvent
-    {
-        public ReaderDisposed(Guid correlationId)
-            => CorrelationId = correlationId;
-
-        public Guid CorrelationId { get; }
-    }
+    public Guid CorrelationId { get; }
 }
diff --git a/src/DotPulsar/Internal/ExceptionHandlerPipeline.cs b/src/DotPulsar/Internal/ExceptionHandlerPipeline.cs
index 143555f..00d943e 100644
--- a/src/DotPulsar/Internal/ExceptionHandlerPipeline.cs
+++ b/src/DotPulsar/Internal/ExceptionHandlerPipeline.cs
@@ -12,29 +12,28 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+public sealed class ExceptionHandlerPipeline : IHandleException
 {
-    using DotPulsar.Abstractions;
-    using System.Collections.Generic;
-    using System.Linq;
-    using System.Threading.Tasks;
+    private readonly IHandleException[] _handlers;
 
-    public sealed class ExceptionHandlerPipeline : IHandleException
+    public ExceptionHandlerPipeline(IEnumerable<IHandleException> handlers)
+        => _handlers = handlers.ToArray();
+
+    public async ValueTask OnException(ExceptionContext exceptionContext)
     {
-        private readonly IHandleException[] _handlers;
-
-        public ExceptionHandlerPipeline(IEnumerable<IHandleException> handlers)
-            => _handlers = handlers.ToArray();
-
-        public async ValueTask OnException(ExceptionContext exceptionContext)
+        foreach (var handler in _handlers)
         {
-            foreach (var handler in _handlers)
-            {
-                await handler.OnException(exceptionContext).ConfigureAwait(false);
+            await handler.OnException(exceptionContext).ConfigureAwait(false);
 
-                if (exceptionContext.ExceptionHandled)
-                    break;
-            }
+            if (exceptionContext.ExceptionHandled)
+                break;
         }
     }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/AsyncLockDisposedException.cs b/src/DotPulsar/Internal/Exceptions/AsyncLockDisposedException.cs
index 0efb519..457d810 100644
--- a/src/DotPulsar/Internal/Exceptions/AsyncLockDisposedException.cs
+++ b/src/DotPulsar/Internal/Exceptions/AsyncLockDisposedException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
-{
-    using System;
+namespace DotPulsar.Internal.Exceptions;
 
-    public sealed class AsyncLockDisposedException : ObjectDisposedException
-    {
-        public AsyncLockDisposedException() : base(typeof(AsyncLock).FullName) { }
-    }
+using System;
+
+public sealed class AsyncLockDisposedException : ObjectDisposedException
+{
+    public AsyncLockDisposedException() : base(typeof(AsyncLock).FullName) { }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/AsyncQueueDisposedException.cs b/src/DotPulsar/Internal/Exceptions/AsyncQueueDisposedException.cs
index ea5f5fd..5248275 100644
--- a/src/DotPulsar/Internal/Exceptions/AsyncQueueDisposedException.cs
+++ b/src/DotPulsar/Internal/Exceptions/AsyncQueueDisposedException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
-{
-    using System;
+namespace DotPulsar.Internal.Exceptions;
 
-    public sealed class AsyncQueueDisposedException : ObjectDisposedException
-    {
-        public AsyncQueueDisposedException() : base(typeof(AsyncQueue<>).FullName) { }
-    }
+using System;
+
+public sealed class AsyncQueueDisposedException : ObjectDisposedException
+{
+    public AsyncQueueDisposedException() : base(typeof(AsyncQueue<>).FullName) { }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/ChannelNotReadyException.cs b/src/DotPulsar/Internal/Exceptions/ChannelNotReadyException.cs
index 64178cd..599c0b2 100644
--- a/src/DotPulsar/Internal/Exceptions/ChannelNotReadyException.cs
+++ b/src/DotPulsar/Internal/Exceptions/ChannelNotReadyException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
-{
-    using DotPulsar.Exceptions;
+namespace DotPulsar.Internal.Exceptions;
 
-    public sealed class ChannelNotReadyException : DotPulsarException
-    {
-        public ChannelNotReadyException() : base("The service is not ready yet") { }
-    }
+using DotPulsar.Exceptions;
+
+public sealed class ChannelNotReadyException : DotPulsarException
+{
+    public ChannelNotReadyException() : base("The service is not ready yet") { }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/ConnectionDisposedException.cs b/src/DotPulsar/Internal/Exceptions/ConnectionDisposedException.cs
index 7b0b1d4..ce398e7 100644
--- a/src/DotPulsar/Internal/Exceptions/ConnectionDisposedException.cs
+++ b/src/DotPulsar/Internal/Exceptions/ConnectionDisposedException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
-{
-    using System;
+namespace DotPulsar.Internal.Exceptions;
 
-    public sealed class ConnectionDisposedException : ObjectDisposedException
-    {
-        public ConnectionDisposedException() : base(typeof(Connection).FullName) { }
-    }
+using System;
+
+public sealed class ConnectionDisposedException : ObjectDisposedException
+{
+    public ConnectionDisposedException() : base(typeof(Connection).FullName) { }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/ConsumerNotFoundException.cs b/src/DotPulsar/Internal/Exceptions/ConsumerNotFoundException.cs
index ade8ecd..be58640 100644
--- a/src/DotPulsar/Internal/Exceptions/ConsumerNotFoundException.cs
+++ b/src/DotPulsar/Internal/Exceptions/ConsumerNotFoundException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
-{
-    using DotPulsar.Exceptions;
+namespace DotPulsar.Internal.Exceptions;
 
-    public sealed class ConsumerNotFoundException : DotPulsarException
-    {
-        public ConsumerNotFoundException(string message) : base(message) { }
-    }
+using DotPulsar.Exceptions;
+
+public sealed class ConsumerNotFoundException : DotPulsarException
+{
+    public ConsumerNotFoundException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/PulsarStreamDisposedException.cs b/src/DotPulsar/Internal/Exceptions/PulsarStreamDisposedException.cs
index b4ec0a0..11b13a3 100644
--- a/src/DotPulsar/Internal/Exceptions/PulsarStreamDisposedException.cs
+++ b/src/DotPulsar/Internal/Exceptions/PulsarStreamDisposedException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
-{
-    using System;
+namespace DotPulsar.Internal.Exceptions;
 
-    public sealed class PulsarStreamDisposedException : ObjectDisposedException
-    {
-        public PulsarStreamDisposedException() : base(typeof(PulsarStream).FullName) { }
-    }
+using System;
+
+public sealed class PulsarStreamDisposedException : ObjectDisposedException
+{
+    public PulsarStreamDisposedException() : base(typeof(PulsarStream).FullName) { }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/ServiceNotReadyException.cs b/src/DotPulsar/Internal/Exceptions/ServiceNotReadyException.cs
index d7f2975..35e9a51 100644
--- a/src/DotPulsar/Internal/Exceptions/ServiceNotReadyException.cs
+++ b/src/DotPulsar/Internal/Exceptions/ServiceNotReadyException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
-{
-    using DotPulsar.Exceptions;
+namespace DotPulsar.Internal.Exceptions;
 
-    public sealed class ServiceNotReadyException : DotPulsarException
-    {
-        public ServiceNotReadyException(string message) : base(message) { }
-    }
+using DotPulsar.Exceptions;
+
+public sealed class ServiceNotReadyException : DotPulsarException
+{
+    public ServiceNotReadyException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/TooManyRequestsException.cs b/src/DotPulsar/Internal/Exceptions/TooManyRequestsException.cs
index 80c91c2..22ef3ae 100644
--- a/src/DotPulsar/Internal/Exceptions/TooManyRequestsException.cs
+++ b/src/DotPulsar/Internal/Exceptions/TooManyRequestsException.cs
@@ -12,12 +12,11 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
-{
-    using DotPulsar.Exceptions;
+namespace DotPulsar.Internal.Exceptions;
 
-    public sealed class TooManyRequestsException : DotPulsarException
-    {
-        public TooManyRequestsException(string message) : base(message) { }
-    }
+using DotPulsar.Exceptions;
+
+public sealed class TooManyRequestsException : DotPulsarException
+{
+    public TooManyRequestsException(string message) : base(message) { }
 }
diff --git a/src/DotPulsar/Internal/Exceptions/UnexpectedResponseException.cs b/src/DotPulsar/Internal/Exceptions/UnexpectedResponseException.cs
index 50b814d..5033af4 100644
--- a/src/DotPulsar/Internal/Exceptions/UnexpectedResponseException.cs
+++ b/src/DotPulsar/Internal/Exceptions/UnexpectedResponseException.cs
@@ -12,15 +12,14 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Exceptions
+namespace DotPulsar.Internal.Exceptions;
+
+using DotPulsar.Exceptions;
+using System;
+
+public sealed class UnexpectedResponseException : DotPulsarException
 {
-    using DotPulsar.Exceptions;
-    using System;
+    public UnexpectedResponseException(string message) : base(message) { }
 
-    public sealed class UnexpectedResponseException : DotPulsarException
-    {
-        public UnexpectedResponseException(string message) : base(message) { }
-
-        public UnexpectedResponseException(string message, Exception innerException) : base(message, innerException) { }
-    }
+    public UnexpectedResponseException(string message, Exception innerException) : base(message, innerException) { }
 }
diff --git a/src/DotPulsar/Internal/Executor.cs b/src/DotPulsar/Internal/Executor.cs
index 540229e..ccabb22 100644
--- a/src/DotPulsar/Internal/Executor.cs
+++ b/src/DotPulsar/Internal/Executor.cs
@@ -12,154 +12,153 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Abstractions;
+using Events;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class Executor : IExecute
 {
-    using Abstractions;
-    using DotPulsar.Abstractions;
-    using Events;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly Guid _correlationId;
+    private readonly IRegisterEvent _eventRegister;
+    private readonly IHandleException _exceptionHandler;
 
-    public sealed class Executor : IExecute
+    public Executor(Guid correlationId, IRegisterEvent eventRegister, IHandleException exceptionHandler)
     {
-        private readonly Guid _correlationId;
-        private readonly IRegisterEvent _eventRegister;
-        private readonly IHandleException _exceptionHandler;
+        _correlationId = correlationId;
+        _eventRegister = eventRegister;
+        _exceptionHandler = exceptionHandler;
+    }
 
-        public Executor(Guid correlationId, IRegisterEvent eventRegister, IHandleException exceptionHandler)
+    public async ValueTask Execute(Action action, CancellationToken cancellationToken)
+    {
+        while (true)
         {
-            _correlationId = correlationId;
-            _eventRegister = eventRegister;
-            _exceptionHandler = exceptionHandler;
-        }
-
-        public async ValueTask Execute(Action action, CancellationToken cancellationToken)
-        {
-            while (true)
+            try
             {
-                try
-                {
-                    action();
-                    return;
-                }
-                catch (Exception ex)
-                {
-                    if (await Handle(ex, cancellationToken).ConfigureAwait(false))
-                        throw;
-                }
-
-                cancellationToken.ThrowIfCancellationRequested();
+                action();
+                return;
             }
-        }
-
-        public async ValueTask Execute(Func<Task> func, CancellationToken cancellationToken)
-        {
-            while (true)
+            catch (Exception ex)
             {
-                try
-                {
-                    await func().ConfigureAwait(false);
-                    return;
-                }
-                catch (Exception ex)
-                {
-                    if (await Handle(ex, cancellationToken).ConfigureAwait(false))
-                        throw;
-                }
-
-                cancellationToken.ThrowIfCancellationRequested();
+                if (await Handle(ex, cancellationToken).ConfigureAwait(false))
+                    throw;
             }
-        }
 
-        public async ValueTask Execute(Func<ValueTask> func, CancellationToken cancellationToken)
+            cancellationToken.ThrowIfCancellationRequested();
+        }
+    }
+
+    public async ValueTask Execute(Func<Task> func, CancellationToken cancellationToken)
+    {
+        while (true)
         {
-            while (true)
+            try
             {
-                try
-                {
-                    await func().ConfigureAwait(false);
-                    return;
-                }
-                catch (Exception ex)
-                {
-                    if (await Handle(ex, cancellationToken).ConfigureAwait(false))
-                        throw;
-                }
-
-                cancellationToken.ThrowIfCancellationRequested();
+                await func().ConfigureAwait(false);
+                return;
             }
-        }
-
-        public async ValueTask<TResult> Execute<TResult>(Func<TResult> func, CancellationToken cancellationToken)
-        {
-            while (true)
+            catch (Exception ex)
             {
-                try
-                {
-                    return func();
-                }
-                catch (Exception ex)
-                {
-                    if (await Handle(ex, cancellationToken).ConfigureAwait(false))
-                        throw;
-                }
-
-                cancellationToken.ThrowIfCancellationRequested();
+                if (await Handle(ex, cancellationToken).ConfigureAwait(false))
+                    throw;
             }
-        }
 
-        public async ValueTask<TResult> Execute<TResult>(Func<Task<TResult>> func, CancellationToken cancellationToken)
+            cancellationToken.ThrowIfCancellationRequested();
+        }
+    }
+
+    public async ValueTask Execute(Func<ValueTask> func, CancellationToken cancellationToken)
+    {
+        while (true)
         {
-            while (true)
+            try
             {
-                try
-                {
-                    return await func().ConfigureAwait(false);
-                }
-                catch (Exception ex)
-                {
-                    if (await Handle(ex, cancellationToken).ConfigureAwait(false))
-                        throw;
-                }
-
-                cancellationToken.ThrowIfCancellationRequested();
+                await func().ConfigureAwait(false);
+                return;
             }
-        }
-
-        public async ValueTask<TResult> Execute<TResult>(Func<ValueTask<TResult>> func, CancellationToken cancellationToken)
-        {
-            while (true)
+            catch (Exception ex)
             {
-                try
-                {
-                    return await func().ConfigureAwait(false);
-                }
-                catch (Exception ex)
-                {
-                    if (await Handle(ex, cancellationToken).ConfigureAwait(false))
-                        throw;
-                }
-
-                cancellationToken.ThrowIfCancellationRequested();
+                if (await Handle(ex, cancellationToken).ConfigureAwait(false))
+                    throw;
             }
-        }
 
-        private async ValueTask<bool> Handle(Exception exception, CancellationToken cancellationToken)
+            cancellationToken.ThrowIfCancellationRequested();
+        }
+    }
+
+    public async ValueTask<TResult> Execute<TResult>(Func<TResult> func, CancellationToken cancellationToken)
+    {
+        while (true)
         {
-            if (cancellationToken.IsCancellationRequested)
-                return true;
+            try
+            {
+                return func();
+            }
+            catch (Exception ex)
+            {
+                if (await Handle(ex, cancellationToken).ConfigureAwait(false))
+                    throw;
+            }
 
-            var context = new ExceptionContext(exception, cancellationToken);
-
-            await _exceptionHandler.OnException(context).ConfigureAwait(false);
-
-            if (context.Result != FaultAction.Retry)
-                _eventRegister.Register(new ExecutorFaulted(_correlationId));
-
-            return context.Result == FaultAction.ThrowException
-                ? throw context.Exception
-                : context.Result == FaultAction.Rethrow;
+            cancellationToken.ThrowIfCancellationRequested();
         }
     }
+
+    public async ValueTask<TResult> Execute<TResult>(Func<Task<TResult>> func, CancellationToken cancellationToken)
+    {
+        while (true)
+        {
+            try
+            {
+                return await func().ConfigureAwait(false);
+            }
+            catch (Exception ex)
+            {
+                if (await Handle(ex, cancellationToken).ConfigureAwait(false))
+                    throw;
+            }
+
+            cancellationToken.ThrowIfCancellationRequested();
+        }
+    }
+
+    public async ValueTask<TResult> Execute<TResult>(Func<ValueTask<TResult>> func, CancellationToken cancellationToken)
+    {
+        while (true)
+        {
+            try
+            {
+                return await func().ConfigureAwait(false);
+            }
+            catch (Exception ex)
+            {
+                if (await Handle(ex, cancellationToken).ConfigureAwait(false))
+                    throw;
+            }
+
+            cancellationToken.ThrowIfCancellationRequested();
+        }
+    }
+
+    private async ValueTask<bool> Handle(Exception exception, CancellationToken cancellationToken)
+    {
+        if (cancellationToken.IsCancellationRequested)
+            return true;
+
+        var context = new ExceptionContext(exception, cancellationToken);
+
+        await _exceptionHandler.OnException(context).ConfigureAwait(false);
+
+        if (context.Result != FaultAction.Retry)
+            _eventRegister.Register(new ExecutorFaulted(_correlationId));
+
+        return context.Result == FaultAction.ThrowException
+            ? throw context.Exception
+            : context.Result == FaultAction.Rethrow;
+    }
 }
diff --git a/src/DotPulsar/Internal/ExecutorState.cs b/src/DotPulsar/Internal/ExecutorState.cs
index c5386ce..bf2c7aa 100644
--- a/src/DotPulsar/Internal/ExecutorState.cs
+++ b/src/DotPulsar/Internal/ExecutorState.cs
@@ -12,11 +12,10 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+public enum ExecutorState : byte
 {
-    public enum ExecutorState : byte
-    {
-        Ok,
-        Faulted
-    }
+    Ok,
+    Faulted
 }
diff --git a/src/DotPulsar/Internal/Extensions/ActivityExtensions.cs b/src/DotPulsar/Internal/Extensions/ActivityExtensions.cs
index 850e93e..11c3149 100644
--- a/src/DotPulsar/Internal/Extensions/ActivityExtensions.cs
+++ b/src/DotPulsar/Internal/Extensions/ActivityExtensions.cs
@@ -12,45 +12,44 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Extensions
+namespace DotPulsar.Internal.Extensions;
+
+using System;
+using System.Diagnostics;
+
+public static class ActivityExtensions
 {
-    using System;
-    using System.Diagnostics;
+    private const string _exceptionEventName = "exception";
+    private const string _exceptionStackTrace = "exception.stacktrace";
+    private const string _exceptionType = "exception.type";
+    private const string _exceptionMessage = "exception.message";
+    private const string _messageId = "messaging.message_id";
+    private const string _payloadSize = "messaging.message_payload_size_bytes";
+    private const string _statusCode = "otel.status_code";
 
-    public static class ActivityExtensions
+    public static void AddException(this Activity activity, Exception exception)
     {
-        private const string _exceptionEventName = "exception";
-        private const string _exceptionStackTrace = "exception.stacktrace";
-        private const string _exceptionType = "exception.type";
-        private const string _exceptionMessage = "exception.message";
-        private const string _messageId = "messaging.message_id";
-        private const string _payloadSize = "messaging.message_payload_size_bytes";
-        private const string _statusCode = "otel.status_code";
+        activity.SetStatusCode("ERROR");
 
-        public static void AddException(this Activity activity, Exception exception)
-        {
-            activity.SetStatusCode("ERROR");
-
-            var exceptionTags = new ActivityTagsCollection
+        var exceptionTags = new ActivityTagsCollection
             {
                 { _exceptionType, exception.GetType().FullName },
                 { _exceptionStackTrace, exception.ToString() }
             };
 
-            if (!string.IsNullOrWhiteSpace(exception.Message))
-                exceptionTags.Add(_exceptionMessage, exception.Message);
+        if (!string.IsNullOrWhiteSpace(exception.Message))
+            exceptionTags.Add(_exceptionMessage, exception.Message);
 
-            var activityEvent = new ActivityEvent(_exceptionEventName, default, exceptionTags);
-            activity.AddEvent(activityEvent);
-        }
-
-        public static void SetMessageId(this Activity activity, MessageId messageId)
-            => activity.SetTag(_messageId, messageId.ToString());
-
-        public static void SetStatusCode(this Activity activity, string statusCode)
-            => activity.SetTag(_statusCode, statusCode);
-
-        public static void SetPayloadSize(this Activity activity, long payloadSize)
-            => activity.SetTag(_payloadSize, payloadSize);
+        var activityEvent = new ActivityEvent(_exceptionEventName, default, exceptionTags);
+        activity.AddEvent(activityEvent);
     }
+
+    public static void SetMessageId(this Activity activity, MessageId messageId)
+        => activity.SetTag(_messageId, messageId.ToString());
+
+    public static void SetStatusCode(this Activity activity, string statusCode)
+        => activity.SetTag(_statusCode, statusCode);
+
+    public static void SetPayloadSize(this Activity activity, long payloadSize)
+        => activity.SetTag(_payloadSize, payloadSize);
 }
diff --git a/src/DotPulsar/Internal/Extensions/CommandExtensions.cs b/src/DotPulsar/Internal/Extensions/CommandExtensions.cs
index 642a103..a17e313 100644
--- a/src/DotPulsar/Internal/Extensions/CommandExtensions.cs
+++ b/src/DotPulsar/Internal/Extensions/CommandExtensions.cs
@@ -12,190 +12,189 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Extensions
+namespace DotPulsar.Internal.Extensions;
+
+using DotPulsar.Exceptions;
+using Exceptions;
+using PulsarApi;
+
+public static class CommandExtensions
 {
-    using DotPulsar.Exceptions;
-    using Exceptions;
-    using PulsarApi;
-
-    public static class CommandExtensions
+    public static void Expect(this BaseCommand command, BaseCommand.Type type)
     {
-        public static void Expect(this BaseCommand command, BaseCommand.Type type)
-        {
-            if (command.CommandType == type)
-                return;
+        if (command.CommandType == type)
+            return;
 
-            if (command.CommandType == BaseCommand.Type.Error)
-                command.Error.Throw();
+        if (command.CommandType == BaseCommand.Type.Error)
+            command.Error.Throw();
 
-            if (command.CommandType == BaseCommand.Type.SendError)
-                command.SendError.Throw();
+        if (command.CommandType == BaseCommand.Type.SendError)
+            command.SendError.Throw();
 
-            throw new UnexpectedResponseException($"Expected '{type}' but got '{command.CommandType}'");
-        }
-
-        public static void Throw(this CommandSendError command)
-            => Throw(command.Error, command.Message);
-
-        public static void Throw(this CommandLookupTopicResponse command)
-            => Throw(command.Error, command.Message);
-
-        public static void Throw(this CommandError command)
-            => Throw(command.Error, command.Message);
-
-        public static void Throw(this CommandGetOrCreateSchemaResponse command)
-            => Throw(command.ErrorCode, command.ErrorMessage);
-
-        public static void Throw(this CommandPartitionedTopicMetadataResponse command)
-            => Throw(command.Error, command.Message);
-
-        private static void Throw(ServerError error, string message)
-            => throw (error switch
-            {
-                ServerError.AuthenticationError => new AuthenticationException(message),
-                ServerError.AuthorizationError => new AuthorizationException(message),
-                ServerError.ChecksumError => new ChecksumException(message),
-                ServerError.ConsumerAssignError => new ConsumerAssignException(message),
-                ServerError.ConsumerBusy => new ConsumerBusyException(message),
-                ServerError.ConsumerNotFound => new ConsumerNotFoundException(message),
-                ServerError.IncompatibleSchema => new IncompatibleSchemaException(message),
-                ServerError.InvalidTopicName => new InvalidTopicNameException(message),
-                ServerError.InvalidTxnStatus => new InvalidTransactionStatusException(message),
-                ServerError.MetadataError => new MetadataException(message),
-                ServerError.NotAllowedError => new NotAllowedException(message),
-                ServerError.PersistenceError => new PersistenceException(message),
-                ServerError.ProducerBlockedQuotaExceededError => new ProducerBlockedQuotaExceededException($"{message}. Error code: {error}"),
-                ServerError.ProducerBlockedQuotaExceededException => new ProducerBlockedQuotaExceededException($"{message}. Error code: {error}"),
-                ServerError.ProducerBusy => new ProducerBusyException(message),
-                ServerError.ServiceNotReady => new ServiceNotReadyException(message),
-                ServerError.SubscriptionNotFound => new SubscriptionNotFoundException(message),
-                ServerError.TooManyRequests => new TooManyRequestsException(message),
-                ServerError.TopicNotFound => new TopicNotFoundException(message),
-                ServerError.TopicTerminatedError => new TopicTerminatedException(message),
-                ServerError.TransactionConflict => new TransactionConflictException(message),
-                ServerError.TransactionCoordinatorNotFound => new TransactionCoordinatorNotFoundException(message),
-                ServerError.UnknownError => new UnknownException($"{message}. Error code: {error}"),
-                ServerError.UnsupportedVersionError => new UnsupportedVersionException(message),
-                _ => new UnknownException($"{message}. Error code: {error}")
-            });
-
-        public static BaseCommand AsBaseCommand(this CommandAck command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Ack,
-                Ack = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandConnect command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Connect,
-                Connect = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandPing command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Ping,
-                Ping = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandPong command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Pong,
-                Pong = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandProducer command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Producer,
-                Producer = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandGetLastMessageId command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.GetLastMessageId,
-                GetLastMessageId = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandUnsubscribe command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Unsubscribe,
-                Unsubscribe = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandSubscribe command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Subscribe,
-                Subscribe = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandLookupTopic command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Lookup,
-                LookupTopic = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandSend command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Send,
-                Send = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandFlow command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Flow,
-                Flow = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandCloseProducer command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.CloseProducer,
-                CloseProducer = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandCloseConsumer command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.CloseConsumer,
-                CloseConsumer = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandSeek command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.Seek,
-                Seek = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandRedeliverUnacknowledgedMessages command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.RedeliverUnacknowledgedMessages,
-                RedeliverUnacknowledgedMessages = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandGetOrCreateSchema command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.GetOrCreateSchema,
-                GetOrCreateSchema = command
-            };
-
-        public static BaseCommand AsBaseCommand(this CommandPartitionedTopicMetadata command)
-            => new()
-            {
-                CommandType = BaseCommand.Type.PartitionedMetadata,
-                PartitionMetadata = command
-            };
+        throw new UnexpectedResponseException($"Expected '{type}' but got '{command.CommandType}'");
     }
+
+    public static void Throw(this CommandSendError command)
+        => Throw(command.Error, command.Message);
+
+    public static void Throw(this CommandLookupTopicResponse command)
+        => Throw(command.Error, command.Message);
+
+    public static void Throw(this CommandError command)
+        => Throw(command.Error, command.Message);
+
+    public static void Throw(this CommandGetOrCreateSchemaResponse command)
+        => Throw(command.ErrorCode, command.ErrorMessage);
+
+    public static void Throw(this CommandPartitionedTopicMetadataResponse command)
+        => Throw(command.Error, command.Message);
+
+    private static void Throw(ServerError error, string message)
+        => throw (error switch
+        {
+            ServerError.AuthenticationError => new AuthenticationException(message),
+            ServerError.AuthorizationError => new AuthorizationException(message),
+            ServerError.ChecksumError => new ChecksumException(message),
+            ServerError.ConsumerAssignError => new ConsumerAssignException(message),
+            ServerError.ConsumerBusy => new ConsumerBusyException(message),
+            ServerError.ConsumerNotFound => new ConsumerNotFoundException(message),
+            ServerError.IncompatibleSchema => new IncompatibleSchemaException(message),
+            ServerError.InvalidTopicName => new InvalidTopicNameException(message),
+            ServerError.InvalidTxnStatus => new InvalidTransactionStatusException(message),
+            ServerError.MetadataError => new MetadataException(message),
+            ServerError.NotAllowedError => new NotAllowedException(message),
+            ServerError.PersistenceError => new PersistenceException(message),
+            ServerError.ProducerBlockedQuotaExceededError => new ProducerBlockedQuotaExceededException($"{message}. Error code: {error}"),
+            ServerError.ProducerBlockedQuotaExceededException => new ProducerBlockedQuotaExceededException($"{message}. Error code: {error}"),
+            ServerError.ProducerBusy => new ProducerBusyException(message),
+            ServerError.ServiceNotReady => new ServiceNotReadyException(message),
+            ServerError.SubscriptionNotFound => new SubscriptionNotFoundException(message),
+            ServerError.TooManyRequests => new TooManyRequestsException(message),
+            ServerError.TopicNotFound => new TopicNotFoundException(message),
+            ServerError.TopicTerminatedError => new TopicTerminatedException(message),
+            ServerError.TransactionConflict => new TransactionConflictException(message),
+            ServerError.TransactionCoordinatorNotFound => new TransactionCoordinatorNotFoundException(message),
+            ServerError.UnknownError => new UnknownException($"{message}. Error code: {error}"),
+            ServerError.UnsupportedVersionError => new UnsupportedVersionException(message),
+            _ => new UnknownException($"{message}. Error code: {error}")
+        });
+
+    public static BaseCommand AsBaseCommand(this CommandAck command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Ack,
+            Ack = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandConnect command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Connect,
+            Connect = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandPing command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Ping,
+            Ping = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandPong command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Pong,
+            Pong = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandProducer command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Producer,
+            Producer = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandGetLastMessageId command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.GetLastMessageId,
+            GetLastMessageId = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandUnsubscribe command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Unsubscribe,
+            Unsubscribe = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandSubscribe command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Subscribe,
+            Subscribe = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandLookupTopic command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Lookup,
+            LookupTopic = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandSend command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Send,
+            Send = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandFlow command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Flow,
+            Flow = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandCloseProducer command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.CloseProducer,
+            CloseProducer = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandCloseConsumer command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.CloseConsumer,
+            CloseConsumer = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandSeek command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.Seek,
+            Seek = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandRedeliverUnacknowledgedMessages command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.RedeliverUnacknowledgedMessages,
+            RedeliverUnacknowledgedMessages = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandGetOrCreateSchema command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.GetOrCreateSchema,
+            GetOrCreateSchema = command
+        };
+
+    public static BaseCommand AsBaseCommand(this CommandPartitionedTopicMetadata command)
+        => new()
+        {
+            CommandType = BaseCommand.Type.PartitionedMetadata,
+            PartitionMetadata = command
+        };
 }
diff --git a/src/DotPulsar/Internal/Extensions/MessageIdDataExtensions.cs b/src/DotPulsar/Internal/Extensions/MessageIdDataExtensions.cs
index 8f59a64..f632659 100644
--- a/src/DotPulsar/Internal/Extensions/MessageIdDataExtensions.cs
+++ b/src/DotPulsar/Internal/Extensions/MessageIdDataExtensions.cs
@@ -12,21 +12,20 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Extensions
+namespace DotPulsar.Internal.Extensions;
+
+using DotPulsar.Internal.PulsarApi;
+
+public static class MessageIdDataExtensions
 {
-    using DotPulsar.Internal.PulsarApi;
+    public static MessageId ToMessageId(this MessageIdData messageIdData)
+        => new(messageIdData.LedgerId, messageIdData.EntryId, messageIdData.Partition, messageIdData.BatchIndex);
 
-    public static class MessageIdDataExtensions
+    public static void MapFrom(this MessageIdData destination, MessageId source)
     {
-        public static MessageId ToMessageId(this MessageIdData messageIdData)
-            => new(messageIdData.LedgerId, messageIdData.EntryId, messageIdData.Partition, messageIdData.BatchIndex);
-
-        public static void MapFrom(this MessageIdData destination, MessageId source)
-        {
-            destination.LedgerId = source.LedgerId;
-            destination.EntryId = source.EntryId;
-            destination.Partition = source.Partition;
-            destination.BatchIndex = source.BatchIndex;
-        }
+        destination.LedgerId = source.LedgerId;
+        destination.EntryId = source.EntryId;
+        destination.Partition = source.Partition;
+        destination.BatchIndex = source.BatchIndex;
     }
 }
diff --git a/src/DotPulsar/Internal/Extensions/MessageMetadataExtensions.cs b/src/DotPulsar/Internal/Extensions/MessageMetadataExtensions.cs
index f2bac5f..734f53d 100644
--- a/src/DotPulsar/Internal/Extensions/MessageMetadataExtensions.cs
+++ b/src/DotPulsar/Internal/Extensions/MessageMetadataExtensions.cs
@@ -12,65 +12,64 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Extensions
+namespace DotPulsar.Internal.Extensions;
+
+using System;
+using System.Text;
+using Metadata = PulsarApi.MessageMetadata;
+
+public static class MessageMetadataExtensions
 {
-    using System;
-    using System.Text;
-    using Metadata = PulsarApi.MessageMetadata;
+    // Deliver at
+    public static DateTime GetDeliverAtTimeAsDateTime(this Metadata metadata)
+        => metadata.GetDeliverAtTimeAsDateTimeOffset().UtcDateTime;
 
-    public static class MessageMetadataExtensions
+    public static void SetDeliverAtTime(this Metadata metadata, DateTime timestamp)
+        => metadata.SetDeliverAtTime(new DateTimeOffset(timestamp));
+
+    public static DateTimeOffset GetDeliverAtTimeAsDateTimeOffset(this Metadata metadata)
+        => DateTimeOffset.FromUnixTimeMilliseconds(metadata.DeliverAtTime);
+
+    public static void SetDeliverAtTime(this Metadata metadata, DateTimeOffset timestamp)
+        => metadata.DeliverAtTime = timestamp.ToUnixTimeMilliseconds();
+
+    // Event time
+    public static DateTime GetEventTimeAsDateTime(this Metadata metadata)
+        => metadata.GetEventTimeAsDateTimeOffset().UtcDateTime;
+
+    public static void SetEventTime(this Metadata metadata, DateTime timestamp)
+        => metadata.SetEventTime(new DateTimeOffset(timestamp));
+
+    public static DateTimeOffset GetEventTimeAsDateTimeOffset(this Metadata metadata)
+        => DateTimeOffset.FromUnixTimeMilliseconds((long) metadata.EventTime);
+
+    public static void SetEventTime(this Metadata metadata, DateTimeOffset timestamp)
+        => metadata.EventTime = (ulong) timestamp.ToUnixTimeMilliseconds();
+
+    // Key
+    public static byte[]? GetKeyAsBytes(this Metadata metadata)
     {
-        // Deliver at
-        public static DateTime GetDeliverAtTimeAsDateTime(this Metadata metadata)
-            => metadata.GetDeliverAtTimeAsDateTimeOffset().UtcDateTime;
+        if (metadata.PartitionKey is null)
+            return null;
 
-        public static void SetDeliverAtTime(this Metadata metadata, DateTime timestamp)
-            => metadata.SetDeliverAtTime(new DateTimeOffset(timestamp));
+        if (metadata.PartitionKeyB64Encoded)
+            return Convert.FromBase64String(metadata.PartitionKey);
 
-        public static DateTimeOffset GetDeliverAtTimeAsDateTimeOffset(this Metadata metadata)
-            => DateTimeOffset.FromUnixTimeMilliseconds(metadata.DeliverAtTime);
+        return Encoding.UTF8.GetBytes(metadata.PartitionKey);
+    }
 
-        public static void SetDeliverAtTime(this Metadata metadata, DateTimeOffset timestamp)
-            => metadata.DeliverAtTime = timestamp.ToUnixTimeMilliseconds();
+    public static void SetKey(this Metadata metadata, string? key)
+    {
+        metadata.PartitionKey = key;
+        metadata.PartitionKeyB64Encoded = false;
+    }
 
-        // Event time
-        public static DateTime GetEventTimeAsDateTime(this Metadata metadata)
-            => metadata.GetEventTimeAsDateTimeOffset().UtcDateTime;
+    public static void SetKey(this Metadata metadata, byte[]? key)
+    {
+        if (key is null)
+            return;
 
-        public static void SetEventTime(this Metadata metadata, DateTime timestamp)
-            => metadata.SetEventTime(new DateTimeOffset(timestamp));
-
-        public static DateTimeOffset GetEventTimeAsDateTimeOffset(this Metadata metadata)
-            => DateTimeOffset.FromUnixTimeMilliseconds((long) metadata.EventTime);
-
-        public static void SetEventTime(this Metadata metadata, DateTimeOffset timestamp)
-            => metadata.EventTime = (ulong) timestamp.ToUnixTimeMilliseconds();
-
-        // Key
-        public static byte[]? GetKeyAsBytes(this Metadata metadata)
-        {
-            if (metadata.PartitionKey is null)
-                return null;
-
-            if (metadata.PartitionKeyB64Encoded)
-                return Convert.FromBase64String(metadata.PartitionKey);
-
-            return Encoding.UTF8.GetBytes(metadata.PartitionKey);
-        }
-
-        public static void SetKey(this Metadata metadata, string? key)
-        {
-            metadata.PartitionKey = key;
-            metadata.PartitionKeyB64Encoded = false;
-        }
-
-        public static void SetKey(this Metadata metadata, byte[]? key)
-        {
-            if (key is null)
-                return;
-
-            metadata.PartitionKey = Convert.ToBase64String(key);
-            metadata.PartitionKeyB64Encoded = true;
-        }
+        metadata.PartitionKey = Convert.ToBase64String(key);
+        metadata.PartitionKeyB64Encoded = true;
     }
 }
diff --git a/src/DotPulsar/Internal/Extensions/MessagePackageExtensions.cs b/src/DotPulsar/Internal/Extensions/MessagePackageExtensions.cs
index 4e8ead0..1c94e21 100644
--- a/src/DotPulsar/Internal/Extensions/MessagePackageExtensions.cs
+++ b/src/DotPulsar/Internal/Extensions/MessagePackageExtensions.cs
@@ -12,29 +12,28 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Extensions
+namespace DotPulsar.Internal.Extensions;
+
+using PulsarApi;
+using System.Buffers;
+
+public static class MessagePackageExtensions
 {
-    using PulsarApi;
-    using System.Buffers;
+    public static uint GetMetadataSize(this MessagePackage package)
+        => package.Data.ReadUInt32(Constants.MetadataSizeOffset, true);
 
-    public static class MessagePackageExtensions
-    {
-        public static uint GetMetadataSize(this MessagePackage package)
-            => package.Data.ReadUInt32(Constants.MetadataSizeOffset, true);
+    public static MessageMetadata ExtractMetadata(this MessagePackage package, uint metadataSize)
+        => Serializer.Deserialize<MessageMetadata>(package.Data.Slice(Constants.MetadataOffset, metadataSize));
 
-        public static MessageMetadata ExtractMetadata(this MessagePackage package, uint metadataSize)
-            => Serializer.Deserialize<MessageMetadata>(package.Data.Slice(Constants.MetadataOffset, metadataSize));
+    public static ReadOnlySequence<byte> ExtractData(this MessagePackage package, uint metadataSize)
+        => package.Data.Slice(Constants.MetadataOffset + metadataSize);
 
-        public static ReadOnlySequence<byte> ExtractData(this MessagePackage package, uint metadataSize)
-            => package.Data.Slice(Constants.MetadataOffset + metadataSize);
+    public static bool ValidateMagicNumberAndChecksum(this MessagePackage package)
+        => StartsWithMagicNumber(package.Data) && HasValidChecksum(package.Data);
 
-        public static bool ValidateMagicNumberAndChecksum(this MessagePackage package)
-            => StartsWithMagicNumber(package.Data) && HasValidChecksum(package.Data);
+    private static bool StartsWithMagicNumber(ReadOnlySequence<byte> input)
+        => input.StartsWith(Constants.MagicNumber);
 
-        private static bool StartsWithMagicNumber(ReadOnlySequence<byte> input)
-            => input.StartsWith(Constants.MagicNumber);
-
-        private static bool HasValidChecksum(ReadOnlySequence<byte> input)
-            => input.ReadUInt32(Constants.MagicNumber.Length, true) == Crc32C.Calculate(input.Slice(Constants.MetadataSizeOffset));
-    }
+    private static bool HasValidChecksum(ReadOnlySequence<byte> input)
+        => input.ReadUInt32(Constants.MagicNumber.Length, true) == Crc32C.Calculate(input.Slice(Constants.MetadataSizeOffset));
 }
diff --git a/src/DotPulsar/Internal/Extensions/ReadOnlySequenceExtensions.cs b/src/DotPulsar/Internal/Extensions/ReadOnlySequenceExtensions.cs
index 21994fb..6f66461 100644
--- a/src/DotPulsar/Internal/Extensions/ReadOnlySequenceExtensions.cs
+++ b/src/DotPulsar/Internal/Extensions/ReadOnlySequenceExtensions.cs
@@ -12,89 +12,88 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Extensions
+namespace DotPulsar.Internal.Extensions;
+
+using System;
+using System.Buffers;
+
+public static class ReadOnlySequenceExtensions
 {
-    using System;
-    using System.Buffers;
-
-    public static class ReadOnlySequenceExtensions
+    public static bool StartsWith<T>(this ReadOnlySequence<T> sequence, ReadOnlyMemory<T> target) where T : IEquatable<T>
     {
-        public static bool StartsWith<T>(this ReadOnlySequence<T> sequence, ReadOnlyMemory<T> target) where T : IEquatable<T>
-        {
-            if (target.Length > sequence.Length)
-                return false;
-
-            var targetIndex = 0;
-            var targetSpan = target.Span;
-
-            foreach (var memory in sequence)
-            {
-                var span = memory.Span;
-
-                for (var i = 0; i < span.Length; ++i)
-                {
-                    if (!span[i].Equals(targetSpan[targetIndex]))
-                        return false;
-
-                    ++targetIndex;
-
-                    if (targetIndex == targetSpan.Length)
-                        return true;
-                }
-            }
-
+        if (target.Length > sequence.Length)
             return false;
+
+        var targetIndex = 0;
+        var targetSpan = target.Span;
+
+        foreach (var memory in sequence)
+        {
+            var span = memory.Span;
+
+            for (var i = 0; i < span.Length; ++i)
+            {
+                if (!span[i].Equals(targetSpan[targetIndex]))
+                    return false;
+
+                ++targetIndex;
+
+                if (targetIndex == targetSpan.Length)
+                    return true;
+            }
         }
 
-        public static uint ReadUInt32(this ReadOnlySequence<byte> sequence, long start, bool isBigEndian)
+        return false;
+    }
+
+    public static uint ReadUInt32(this ReadOnlySequence<byte> sequence, long start, bool isBigEndian)
+    {
+        if (sequence.Length < 4 + start)
+            throw new ArgumentOutOfRangeException(nameof(start), start, "Sequence must be at least 4 bytes long from 'start' to end");
+
+        var reverse = isBigEndian != BitConverter.IsLittleEndian;
+        var union = new UIntUnion();
+        var read = 0;
+
+        foreach (var memory in sequence)
         {
-            if (sequence.Length < 4 + start)
-                throw new ArgumentOutOfRangeException(nameof(start), start, "Sequence must be at least 4 bytes long from 'start' to end");
-
-            var reverse = isBigEndian != BitConverter.IsLittleEndian;
-            var union = new UIntUnion();
-            var read = 0;
-
-            foreach (var memory in sequence)
+            if (start > memory.Length)
             {
-                if (start > memory.Length)
-                {
-                    start -= memory.Length;
-                    continue;
-                }
-
-                var span = memory.Span;
-
-                for (var i = (int) start; i < span.Length; ++i, ++read)
-                {
-                    switch (read)
-                    {
-                        case 0:
-                            if (reverse) union.B0 = span[i];
-                            else union.B3 = span[i];
-                            continue;
-                        case 1:
-                            if (reverse) union.B1 = span[i];
-                            else union.B2 = span[i];
-                            continue;
-                        case 2:
-                            if (reverse) union.B2 = span[i];
-                            else union.B1 = span[i];
-                            continue;
-                        case 3:
-                            if (reverse) union.B3 = span[i];
-                            else union.B0 = span[i];
-                            break;
-                    }
-                }
-
-                if (read == 4)
-                    break;
-
-                start = 0;
+                start -= memory.Length;
+                continue;
             }
 
-            return union.UInt;
+            var span = memory.Span;
+
+            for (var i = (int) start; i < span.Length; ++i, ++read)
+            {
+                switch (read)
+                {
+                    case 0:
+                        if (reverse) union.B0 = span[i];
+                        else union.B3 = span[i];
+                        continue;
+                    case 1:
+                        if (reverse) union.B1 = span[i];
+                        else union.B2 = span[i];
+                        continue;
+                    case 2:
+                        if (reverse) union.B2 = span[i];
+                        else union.B1 = span[i];
+                        continue;
+                    case 3:
+                        if (reverse) union.B3 = span[i];
+                        else union.B0 = span[i];
+                        break;
+                }
+            }
+
+            if (read == 4)
+                break;
+
+            start = 0;
         }
+
+        return union.UInt;
     }
 }
diff --git a/src/DotPulsar/Internal/FuncExceptionHandler.cs b/src/DotPulsar/Internal/FuncExceptionHandler.cs
index 8d99a9e..0ea2848 100644
--- a/src/DotPulsar/Internal/FuncExceptionHandler.cs
+++ b/src/DotPulsar/Internal/FuncExceptionHandler.cs
@@ -1,17 +1,30 @@
-namespace DotPulsar.Internal
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Threading.Tasks;
+
+public sealed class FuncExceptionHandler : IHandleException
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Threading.Tasks;
+    private readonly Func<ExceptionContext, ValueTask> _exceptionHandler;
 
-    public sealed class FuncExceptionHandler : IHandleException
-    {
-        private readonly Func<ExceptionContext, ValueTask> _exceptionHandler;
+    public FuncExceptionHandler(Func<ExceptionContext, ValueTask> exceptionHandler)
+        => _exceptionHandler = exceptionHandler;
 
-        public FuncExceptionHandler(Func<ExceptionContext, ValueTask> exceptionHandler)
-            => _exceptionHandler = exceptionHandler;
-
-        public ValueTask OnException(ExceptionContext exceptionContext)
-            => _exceptionHandler(exceptionContext);
-    }
+    public ValueTask OnException(ExceptionContext exceptionContext)
+        => _exceptionHandler(exceptionContext);
 }
diff --git a/src/DotPulsar/Internal/FuncStateChangedHandler.cs b/src/DotPulsar/Internal/FuncStateChangedHandler.cs
index ab97199..b881931 100644
--- a/src/DotPulsar/Internal/FuncStateChangedHandler.cs
+++ b/src/DotPulsar/Internal/FuncStateChangedHandler.cs
@@ -12,26 +12,25 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class FuncStateChangedHandler<TStateChanged> : IHandleStateChanged<TStateChanged>
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly Func<TStateChanged, CancellationToken, ValueTask> _stateChangedHandler;
 
-    public sealed class FuncStateChangedHandler<TStateChanged> : IHandleStateChanged<TStateChanged>
+    public FuncStateChangedHandler(Func<TStateChanged, CancellationToken, ValueTask> stateChangedHandler, CancellationToken cancellationToken)
     {
-        private readonly Func<TStateChanged, CancellationToken, ValueTask> _stateChangedHandler;
-
-        public FuncStateChangedHandler(Func<TStateChanged, CancellationToken, ValueTask> stateChangedHandler, CancellationToken cancellationToken)
-        {
-            _stateChangedHandler = stateChangedHandler;
-            CancellationToken = cancellationToken;
-        }
-
-        public CancellationToken CancellationToken { get; }
-
-        public async ValueTask OnStateChanged(TStateChanged stateChanged, CancellationToken cancellationToken)
-            => await _stateChangedHandler(stateChanged, cancellationToken).ConfigureAwait(false);
+        _stateChangedHandler = stateChangedHandler;
+        CancellationToken = cancellationToken;
     }
+
+    public CancellationToken CancellationToken { get; }
+
+    public async ValueTask OnStateChanged(TStateChanged stateChanged, CancellationToken cancellationToken)
+        => await _stateChangedHandler(stateChanged, cancellationToken).ConfigureAwait(false);
 }
diff --git a/src/DotPulsar/Internal/IdLookup.cs b/src/DotPulsar/Internal/IdLookup.cs
index 8b674e1..d326f7b 100644
--- a/src/DotPulsar/Internal/IdLookup.cs
+++ b/src/DotPulsar/Internal/IdLookup.cs
@@ -12,92 +12,91 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System.Collections.Generic;
+
+public sealed class IdLookup<T> where T : class
 {
-    using System.Collections.Generic;
+    private T?[] _items;
 
-    public sealed class IdLookup<T> where T : class
+    public IdLookup()
+        => _items = new T[1];
+
+    public bool IsEmpty()
     {
-        private T?[] _items;
+        lock (_items)
+        {
+            for (var i = 0; i < _items.Length; ++i)
+            {
+                if (_items[i] is not null)
+                    return false;
+            }
 
-        public IdLookup()
-            => _items = new T[1];
+            return true;
+        }
+    }
 
-        public bool IsEmpty()
+    public ulong Add(T item)
+    {
+        lock (_items)
+        {
+            for (var i = 0; i < _items.Length; ++i)
+            {
+                if (_items[i] is not null)
+                    continue;
+
+                _items[i] = item;
+                return (ulong) i;
+            }
+
+            var newArray = new T[_items.Length + 1];
+            _items.CopyTo(newArray, 0);
+            var id = newArray.Length - 1;
+            newArray[id] = item;
+            _items = newArray;
+            return (ulong) id;
+        }
+    }
+
+    public T? Remove(ulong id)
+    {
+        lock (_items)
+        {
+            var item = _items[(int) id];
+            _items[(int) id] = null;
+            return item;
+        }
+    }
+
+    public T[] RemoveAll()
+    {
+        lock (_items)
+        {
+            var items = new List<T>();
+
+            for (var i = 0; i < _items.Length; ++i)
+            {
+                var item = _items[i];
+
+                if (item is not null)
+                {
+                    items.Add(item);
+                    _items[i] = null;
+                }
+            }
+
+            return items.ToArray();
+        }
+    }
+
+    public T? this[ulong id]
+    {
+        get
         {
             lock (_items)
             {
-                for (var i = 0; i < _items.Length; ++i)
-                {
-                    if (_items[i] is not null)
-                        return false;
-                }
-
-                return true;
-            }
-        }
-
-        public ulong Add(T item)
-        {
-            lock (_items)
-            {
-                for (var i = 0; i < _items.Length; ++i)
-                {
-                    if (_items[i] is not null)
-                        continue;
-
-                    _items[i] = item;
-                    return (ulong) i;
-                }
-
-                var newArray = new T[_items.Length + 1];
-                _items.CopyTo(newArray, 0);
-                var id = newArray.Length - 1;
-                newArray[id] = item;
-                _items = newArray;
-                return (ulong) id;
-            }
-        }
-
-        public T? Remove(ulong id)
-        {
-            lock (_items)
-            {
-                var item = _items[(int) id];
-                _items[(int) id] = null;
-                return item;
-            }
-        }
-
-        public T[] RemoveAll()
-        {
-            lock (_items)
-            {
-                var items = new List<T>();
-
-                for (var i = 0; i < _items.Length; ++i)
-                {
-                    var item = _items[i];
-
-                    if (item is not null)
-                    {
-                        items.Add(item);
-                        _items[i] = null;
-                    }
-                }
-
-                return items.ToArray();
-            }
-        }
-
-        public T? this[ulong id]
-        {
-            get
-            {
-                lock (_items)
-                {
-                    return _items[(int) id];
-                }
+                return _items[(int) id];
             }
         }
     }
diff --git a/src/DotPulsar/Internal/Message.cs b/src/DotPulsar/Internal/Message.cs
index 8de1222..dc31286 100644
--- a/src/DotPulsar/Internal/Message.cs
+++ b/src/DotPulsar/Internal/Message.cs
@@ -12,87 +12,86 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+
+public sealed class Message<TValue> : IMessage<TValue>
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
+    private readonly ISchema<TValue> _schema;
 
-    public sealed class Message<TValue> : IMessage<TValue>
+    internal Message(
+        MessageId messageId,
+        ReadOnlySequence<byte> data,
+        string producerName,
+        ulong sequenceId,
+        uint redeliveryCount,
+        ulong eventTime,
+        ulong publishTime,
+        IReadOnlyDictionary<string, string> properties,
+        bool hasBase64EncodedKey,
+        string? key,
+        byte[]? orderingKey,
+        byte[]? schemaVersion,
+        ISchema<TValue> schema)
     {
-        private readonly ISchema<TValue> _schema;
-
-        internal Message(
-            MessageId messageId,
-            ReadOnlySequence<byte> data,
-            string producerName,
-            ulong sequenceId,
-            uint redeliveryCount,
-            ulong eventTime,
-            ulong publishTime,
-            IReadOnlyDictionary<string, string> properties,
-            bool hasBase64EncodedKey,
-            string? key,
-            byte[]? orderingKey,
-            byte[]? schemaVersion,
-            ISchema<TValue> schema)
-        {
-            MessageId = messageId;
-            Data = data;
-            ProducerName = producerName;
-            SequenceId = sequenceId;
-            RedeliveryCount = redeliveryCount;
-            EventTime = eventTime;
-            PublishTime = publishTime;
-            Properties = properties;
-            HasBase64EncodedKey = hasBase64EncodedKey;
-            Key = key;
-            OrderingKey = orderingKey;
-            SchemaVersion = schemaVersion;
-            _schema = schema;
-        }
-
-        public MessageId MessageId { get; }
-
-        public ReadOnlySequence<byte> Data { get; }
-
-        public string ProducerName { get; }
-
-        public byte[]? SchemaVersion { get; }
-
-        public ulong SequenceId { get; }
-
-        public uint RedeliveryCount { get; }
-
-        public bool HasEventTime => EventTime != 0;
-
-        public ulong EventTime { get; }
-
-        public DateTime EventTimeAsDateTime => EventTimeAsDateTimeOffset.UtcDateTime;
-
-        public DateTimeOffset EventTimeAsDateTimeOffset => DateTimeOffset.FromUnixTimeMilliseconds((long) EventTime);
-
-        public bool HasBase64EncodedKey { get; }
-
-        public bool HasKey => Key is not null;
-
-        public string? Key { get; }
-
-        public byte[]? KeyBytes => Key is not null ? Convert.FromBase64String(Key) : null;
-
-        public bool HasOrderingKey => OrderingKey is not null;
-
-        public byte[]? OrderingKey { get; }
-
-        public ulong PublishTime { get; }
-
-        public DateTime PublishTimeAsDateTime => PublishTimeAsDateTimeOffset.UtcDateTime;
-
-        public DateTimeOffset PublishTimeAsDateTimeOffset => DateTimeOffset.FromUnixTimeMilliseconds((long) PublishTime);
-
-        public IReadOnlyDictionary<string, string> Properties { get; }
-
-        public TValue Value() => _schema.Decode(Data);
+        MessageId = messageId;
+        Data = data;
+        ProducerName = producerName;
+        SequenceId = sequenceId;
+        RedeliveryCount = redeliveryCount;
+        EventTime = eventTime;
+        PublishTime = publishTime;
+        Properties = properties;
+        HasBase64EncodedKey = hasBase64EncodedKey;
+        Key = key;
+        OrderingKey = orderingKey;
+        SchemaVersion = schemaVersion;
+        _schema = schema;
     }
+
+    public MessageId MessageId { get; }
+
+    public ReadOnlySequence<byte> Data { get; }
+
+    public string ProducerName { get; }
+
+    public byte[]? SchemaVersion { get; }
+
+    public ulong SequenceId { get; }
+
+    public uint RedeliveryCount { get; }
+
+    public bool HasEventTime => EventTime != 0;
+
+    public ulong EventTime { get; }
+
+    public DateTime EventTimeAsDateTime => EventTimeAsDateTimeOffset.UtcDateTime;
+
+    public DateTimeOffset EventTimeAsDateTimeOffset => DateTimeOffset.FromUnixTimeMilliseconds((long) EventTime);
+
+    public bool HasBase64EncodedKey { get; }
+
+    public bool HasKey => Key is not null;
+
+    public string? Key { get; }
+
+    public byte[]? KeyBytes => Key is not null ? Convert.FromBase64String(Key) : null;
+
+    public bool HasOrderingKey => OrderingKey is not null;
+
+    public byte[]? OrderingKey { get; }
+
+    public ulong PublishTime { get; }
+
+    public DateTime PublishTimeAsDateTime => PublishTimeAsDateTimeOffset.UtcDateTime;
+
+    public DateTimeOffset PublishTimeAsDateTimeOffset => DateTimeOffset.FromUnixTimeMilliseconds((long) PublishTime);
+
+    public IReadOnlyDictionary<string, string> Properties { get; }
+
+    public TValue Value() => _schema.Decode(Data);
 }
diff --git a/src/DotPulsar/Internal/MessageBuilder.cs b/src/DotPulsar/Internal/MessageBuilder.cs
index 44b3812..5013596 100644
--- a/src/DotPulsar/Internal/MessageBuilder.cs
+++ b/src/DotPulsar/Internal/MessageBuilder.cs
@@ -12,98 +12,97 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using Extensions;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class MessageBuilder<TMessage> : IMessageBuilder<TMessage>
 {
-    using DotPulsar.Abstractions;
-    using Extensions;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly IProducer<TMessage> _producer;
+    private readonly MessageMetadata _metadata;
 
-    public sealed class MessageBuilder<TMessage> : IMessageBuilder<TMessage>
+    public MessageBuilder(IProducer<TMessage> producer)
     {
-        private readonly IProducer<TMessage> _producer;
-        private readonly MessageMetadata _metadata;
-
-        public MessageBuilder(IProducer<TMessage> producer)
-        {
-            _producer = producer;
-            _metadata = new MessageMetadata();
-        }
-
-        public IMessageBuilder<TMessage> DeliverAt(long timestamp)
-        {
-            _metadata.Metadata.DeliverAtTime = timestamp;
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> DeliverAt(DateTime timestamp)
-        {
-            _metadata.Metadata.SetDeliverAtTime(timestamp);
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> DeliverAt(DateTimeOffset timestamp)
-        {
-            _metadata.Metadata.SetDeliverAtTime(timestamp);
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> EventTime(ulong eventTime)
-        {
-            _metadata.Metadata.EventTime = eventTime;
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> EventTime(DateTime eventTime)
-        {
-            _metadata.Metadata.SetEventTime(eventTime);
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> EventTime(DateTimeOffset eventTime)
-        {
-            _metadata.Metadata.SetEventTime(eventTime);
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> Key(string key)
-        {
-            _metadata.Metadata.SetKey(key);
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> KeyBytes(byte[] key)
-        {
-            _metadata.Metadata.SetKey(key);
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> OrderingKey(byte[] key)
-        {
-            _metadata.Metadata.OrderingKey = key;
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> Property(string key, string value)
-        {
-            _metadata[key] = value;
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> SchemaVersion(byte[] schemaVersion)
-        {
-            _metadata.Metadata.SchemaVersion = schemaVersion;
-            return this;
-        }
-
-        public IMessageBuilder<TMessage> SequenceId(ulong sequenceId)
-        {
-            _metadata.Metadata.SequenceId = sequenceId;
-            return this;
-        }
-
-        public async ValueTask<MessageId> Send(TMessage message, CancellationToken cancellationToken)
-            => await _producer.Send(_metadata, message, cancellationToken).ConfigureAwait(false);
+        _producer = producer;
+        _metadata = new MessageMetadata();
     }
+
+    public IMessageBuilder<TMessage> DeliverAt(long timestamp)
+    {
+        _metadata.Metadata.DeliverAtTime = timestamp;
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> DeliverAt(DateTime timestamp)
+    {
+        _metadata.Metadata.SetDeliverAtTime(timestamp);
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> DeliverAt(DateTimeOffset timestamp)
+    {
+        _metadata.Metadata.SetDeliverAtTime(timestamp);
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> EventTime(ulong eventTime)
+    {
+        _metadata.Metadata.EventTime = eventTime;
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> EventTime(DateTime eventTime)
+    {
+        _metadata.Metadata.SetEventTime(eventTime);
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> EventTime(DateTimeOffset eventTime)
+    {
+        _metadata.Metadata.SetEventTime(eventTime);
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> Key(string key)
+    {
+        _metadata.Metadata.SetKey(key);
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> KeyBytes(byte[] key)
+    {
+        _metadata.Metadata.SetKey(key);
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> OrderingKey(byte[] key)
+    {
+        _metadata.Metadata.OrderingKey = key;
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> Property(string key, string value)
+    {
+        _metadata[key] = value;
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> SchemaVersion(byte[] schemaVersion)
+    {
+        _metadata.Metadata.SchemaVersion = schemaVersion;
+        return this;
+    }
+
+    public IMessageBuilder<TMessage> SequenceId(ulong sequenceId)
+    {
+        _metadata.Metadata.SequenceId = sequenceId;
+        return this;
+    }
+
+    public async ValueTask<MessageId> Send(TMessage message, CancellationToken cancellationToken)
+        => await _producer.Send(_metadata, message, cancellationToken).ConfigureAwait(false);
 }
diff --git a/src/DotPulsar/Internal/MessageFactory.cs b/src/DotPulsar/Internal/MessageFactory.cs
index 1f68425..4ecb94d 100644
--- a/src/DotPulsar/Internal/MessageFactory.cs
+++ b/src/DotPulsar/Internal/MessageFactory.cs
@@ -12,92 +12,91 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Internal.Abstractions;
+using DotPulsar.Internal.PulsarApi;
+using System.Buffers;
+using System.Collections.Generic;
+
+public sealed class MessageFactory<TValue> : IMessageFactory<TValue>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal.Abstractions;
-    using DotPulsar.Internal.PulsarApi;
-    using System.Buffers;
-    using System.Collections.Generic;
+    private static readonly Dictionary<string, string> _empty;
 
-    public sealed class MessageFactory<TValue> : IMessageFactory<TValue>
+    static MessageFactory() => _empty = new Dictionary<string, string>();
+
+    private static IReadOnlyDictionary<string, string> FromKeyValueList(List<KeyValue> keyValues)
     {
-        private static readonly Dictionary<string, string> _empty;
+        if (keyValues.Count == 0)
+            return _empty;
 
-        static MessageFactory() => _empty = new Dictionary<string, string>();
+        var dictionary = new Dictionary<string, string>(keyValues.Count);
 
-        private static IReadOnlyDictionary<string, string> FromKeyValueList(List<KeyValue> keyValues)
+        for (var i = 0; i < keyValues.Count; ++i)
         {
-            if (keyValues.Count == 0)
-                return _empty;
-
-            var dictionary = new Dictionary<string, string>(keyValues.Count);
-
-            for (var i = 0; i < keyValues.Count; ++i)
-            {
-                var keyValue = keyValues[i];
-                dictionary.Add(keyValue.Key, keyValue.Value);
-            }
-
-            return dictionary;
+            var keyValue = keyValues[i];
+            dictionary.Add(keyValue.Key, keyValue.Value);
         }
 
-        private readonly ISchema<TValue> _schema;
+        return dictionary;
+    }
 
-        public MessageFactory(ISchema<TValue> schema)
-            => _schema = schema;
+    private readonly ISchema<TValue> _schema;
 
-        public IMessage<TValue> Create(MessageId messageId, uint redeliveryCount, ReadOnlySequence<byte> data, MessageMetadata metadata, SingleMessageMetadata? singleMetadata = null)
-        {
-            if (singleMetadata is null)
-                return Create(messageId, redeliveryCount, metadata, data);
+    public MessageFactory(ISchema<TValue> schema)
+        => _schema = schema;
 
-            return Create(messageId, redeliveryCount, metadata, singleMetadata, data);
-        }
+    public IMessage<TValue> Create(MessageId messageId, uint redeliveryCount, ReadOnlySequence<byte> data, MessageMetadata metadata, SingleMessageMetadata? singleMetadata = null)
+    {
+        if (singleMetadata is null)
+            return Create(messageId, redeliveryCount, metadata, data);
 
-        private Message<TValue> Create(
-            MessageId messageId,
-            uint redeliveryCount,
-            MessageMetadata metadata,
-            ReadOnlySequence<byte> data)
-        {
-            return new Message<TValue>(
-                messageId: messageId,
-                data: data,
-                producerName: metadata.ProducerName,
-                sequenceId: metadata.SequenceId,
-                redeliveryCount: redeliveryCount,
-                eventTime: metadata.EventTime,
-                publishTime: metadata.PublishTime,
-                properties: FromKeyValueList(metadata.Properties),
-                hasBase64EncodedKey: metadata.PartitionKeyB64Encoded,
-                key: metadata.PartitionKey,
-                orderingKey: metadata.OrderingKey,
-                schemaVersion: metadata.SchemaVersion,
-                _schema);
-        }
+        return Create(messageId, redeliveryCount, metadata, singleMetadata, data);
+    }
 
-        private Message<TValue> Create(
-            MessageId messageId,
-            uint redeliveryCount,
-            MessageMetadata metadata,
-            SingleMessageMetadata singleMetadata,
-            ReadOnlySequence<byte> data)
-        {
-            return new Message<TValue>(
-                messageId: messageId,
-                data: data,
-                producerName: metadata.ProducerName,
-                sequenceId: singleMetadata.SequenceId,
-                redeliveryCount: redeliveryCount,
-                eventTime: singleMetadata.EventTime,
-                publishTime: metadata.PublishTime,
-                properties: FromKeyValueList(singleMetadata.Properties),
-                hasBase64EncodedKey: singleMetadata.PartitionKeyB64Encoded,
-                key: singleMetadata.PartitionKey,
-                orderingKey: singleMetadata.OrderingKey,
-                schemaVersion: metadata.SchemaVersion,
-                _schema);
-        }
+    private Message<TValue> Create(
+        MessageId messageId,
+        uint redeliveryCount,
+        MessageMetadata metadata,
+        ReadOnlySequence<byte> data)
+    {
+        return new Message<TValue>(
+            messageId: messageId,
+            data: data,
+            producerName: metadata.ProducerName,
+            sequenceId: metadata.SequenceId,
+            redeliveryCount: redeliveryCount,
+            eventTime: metadata.EventTime,
+            publishTime: metadata.PublishTime,
+            properties: FromKeyValueList(metadata.Properties),
+            hasBase64EncodedKey: metadata.PartitionKeyB64Encoded,
+            key: metadata.PartitionKey,
+            orderingKey: metadata.OrderingKey,
+            schemaVersion: metadata.SchemaVersion,
+            _schema);
+    }
+
+    private Message<TValue> Create(
+        MessageId messageId,
+        uint redeliveryCount,
+        MessageMetadata metadata,
+        SingleMessageMetadata singleMetadata,
+        ReadOnlySequence<byte> data)
+    {
+        return new Message<TValue>(
+            messageId: messageId,
+            data: data,
+            producerName: metadata.ProducerName,
+            sequenceId: singleMetadata.SequenceId,
+            redeliveryCount: redeliveryCount,
+            eventTime: singleMetadata.EventTime,
+            publishTime: metadata.PublishTime,
+            properties: FromKeyValueList(singleMetadata.Properties),
+            hasBase64EncodedKey: singleMetadata.PartitionKeyB64Encoded,
+            key: singleMetadata.PartitionKey,
+            orderingKey: singleMetadata.OrderingKey,
+            schemaVersion: metadata.SchemaVersion,
+            _schema);
     }
 }
diff --git a/src/DotPulsar/Internal/MessagePackage.cs b/src/DotPulsar/Internal/MessagePackage.cs
index ef0bb32..3f2b707 100644
--- a/src/DotPulsar/Internal/MessagePackage.cs
+++ b/src/DotPulsar/Internal/MessagePackage.cs
@@ -12,22 +12,21 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using PulsarApi;
+using System.Buffers;
+
+public readonly struct MessagePackage
 {
-    using PulsarApi;
-    using System.Buffers;
-
-    public readonly struct MessagePackage
+    public MessagePackage(MessageIdData messageId, uint redeliveryCount, ReadOnlySequence<byte> data)
     {
-        public MessagePackage(MessageIdData messageId, uint redeliveryCount, ReadOnlySequence<byte> data)
-        {
-            MessageId = messageId;
-            RedeliveryCount = redeliveryCount;
-            Data = data;
-        }
-
-        public MessageIdData MessageId { get; }
-        public uint RedeliveryCount { get; }
-        public ReadOnlySequence<byte> Data { get; }
+        MessageId = messageId;
+        RedeliveryCount = redeliveryCount;
+        Data = data;
     }
+
+    public MessageIdData MessageId { get; }
+    public uint RedeliveryCount { get; }
+    public ReadOnlySequence<byte> Data { get; }
 }
diff --git a/src/DotPulsar/Internal/MonitorState.cs b/src/DotPulsar/Internal/MonitorState.cs
index 7a50044..f1d9021 100644
--- a/src/DotPulsar/Internal/MonitorState.cs
+++ b/src/DotPulsar/Internal/MonitorState.cs
@@ -12,74 +12,73 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Extensions;
+using System.Threading.Tasks;
+
+public static class StateMonitor
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Extensions;
-    using System.Threading.Tasks;
-
-    public static class StateMonitor
+    public static async Task MonitorProducer(IProducer producer, IHandleStateChanged<ProducerStateChanged> handler)
     {
-        public static async Task MonitorProducer(IProducer producer, IHandleStateChanged<ProducerStateChanged> handler)
+        await Task.Yield();
+
+        var state = ProducerState.Disconnected;
+
+        while (!producer.IsFinalState(state))
         {
-            await Task.Yield();
-
-            var state = ProducerState.Disconnected;
-
-            while (!producer.IsFinalState(state))
+            var stateChanged = await producer.StateChangedFrom(state, handler.CancellationToken).ConfigureAwait(false);
+            state = stateChanged.ProducerState;
+            try
             {
-                var stateChanged = await producer.StateChangedFrom(state, handler.CancellationToken).ConfigureAwait(false);
-                state = stateChanged.ProducerState;
-                try
-                {
-                    await handler.OnStateChanged(stateChanged, handler.CancellationToken).ConfigureAwait(false);
-                }
-                catch
-                {
-                    // Ignore
-                }
+                await handler.OnStateChanged(stateChanged, handler.CancellationToken).ConfigureAwait(false);
+            }
+            catch
+            {
+                // Ignore
             }
         }
+    }
 
-        public static async Task MonitorConsumer(IConsumer consumer, IHandleStateChanged<ConsumerStateChanged> handler)
+    public static async Task MonitorConsumer(IConsumer consumer, IHandleStateChanged<ConsumerStateChanged> handler)
+    {
+        await Task.Yield();
+
+        var state = ConsumerState.Disconnected;
+
+        while (!consumer.IsFinalState(state))
         {
-            await Task.Yield();
-
-            var state = ConsumerState.Disconnected;
-
-            while (!consumer.IsFinalState(state))
+            var stateChanged = await consumer.StateChangedFrom(state, handler.CancellationToken).ConfigureAwait(false);
+            state = stateChanged.ConsumerState;
+            try
             {
-                var stateChanged = await consumer.StateChangedFrom(state, handler.CancellationToken).ConfigureAwait(false);
-                state = stateChanged.ConsumerState;
-                try
-                {
-                    await handler.OnStateChanged(stateChanged, handler.CancellationToken).ConfigureAwait(false);
-                }
-                catch
-                {
-                    // Ignore
-                }
+                await handler.OnStateChanged(stateChanged, handler.CancellationToken).ConfigureAwait(false);
+            }
+            catch
+            {
+                // Ignore
             }
         }
+    }
 
-        public static async Task MonitorReader(IReader reader, IHandleStateChanged<ReaderStateChanged> handler)
+    public static async Task MonitorReader(IReader reader, IHandleStateChanged<ReaderStateChanged> handler)
+    {
+        await Task.Yield();
+
+        var state = ReaderState.Disconnected;
+
+        while (!reader.IsFinalState(state))
         {
-            await Task.Yield();
-
-            var state = ReaderState.Disconnected;
-
-            while (!reader.IsFinalState(state))
+            var stateChanged = await reader.StateChangedFrom(state, handler.CancellationToken).ConfigureAwait(false);
+            state = stateChanged.ReaderState;
+            try
             {
-                var stateChanged = await reader.StateChangedFrom(state, handler.CancellationToken).ConfigureAwait(false);
-                state = stateChanged.ReaderState;
-                try
-                {
-                    await handler.OnStateChanged(stateChanged, handler.CancellationToken).ConfigureAwait(false);
-                }
-                catch
-                {
-                    // Ignore
-                }
+                await handler.OnStateChanged(stateChanged, handler.CancellationToken).ConfigureAwait(false);
+            }
+            catch
+            {
+                // Ignore
             }
         }
     }
diff --git a/src/DotPulsar/Internal/NotReadyChannel.cs b/src/DotPulsar/Internal/NotReadyChannel.cs
index 597387a..da1a7af 100644
--- a/src/DotPulsar/Internal/NotReadyChannel.cs
+++ b/src/DotPulsar/Internal/NotReadyChannel.cs
@@ -12,47 +12,46 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Abstractions;
+using Exceptions;
+using PulsarApi;
+using System;
+using System.Buffers;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class NotReadyChannel<TMessage> : IConsumerChannel<TMessage>, IProducerChannel
 {
-    using Abstractions;
-    using DotPulsar.Abstractions;
-    using Exceptions;
-    using PulsarApi;
-    using System;
-    using System.Buffers;
-    using System.Threading;
-    using System.Threading.Tasks;
+    public ValueTask DisposeAsync()
+        => new();
 
-    public sealed class NotReadyChannel<TMessage> : IConsumerChannel<TMessage>, IProducerChannel
-    {
-        public ValueTask DisposeAsync()
-            => new();
+    public ValueTask ClosedByClient(CancellationToken cancellationToken)
+        => new();
 
-        public ValueTask ClosedByClient(CancellationToken cancellationToken)
-            => new();
+    public ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken = default)
+        => throw GetException();
 
-        public ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken = default)
-            => throw GetException();
+    public Task<CommandSendReceipt> Send(MessageMetadata metadata, ReadOnlySequence<byte> payload, CancellationToken cancellationToken)
+        => throw GetException();
 
-        public Task<CommandSendReceipt> Send(MessageMetadata metadata, ReadOnlySequence<byte> payload, CancellationToken cancellationToken)
-            => throw GetException();
+    public Task Send(CommandAck command, CancellationToken cancellationToken)
+        => throw GetException();
 
-        public Task Send(CommandAck command, CancellationToken cancellationToken)
-            => throw GetException();
+    public Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken)
+        => throw GetException();
 
-        public Task Send(CommandRedeliverUnacknowledgedMessages command, CancellationToken cancellationToken)
-            => throw GetException();
+    public Task Send(CommandUnsubscribe command, CancellationToken cancellationToken)
+        => throw GetException();
 
-        public Task Send(CommandUnsubscribe command, CancellationToken cancellationToken)
-            => throw GetException();
+    public Task Send(CommandSeek command, CancellationToken cancellationToken)
+        => throw GetException();
 
-        public Task Send(CommandSeek command, CancellationToken cancellationToken)
-            => throw GetException();
+    public Task<MessageId> Send(CommandGetLastMessageId command, CancellationToken cancellationToken)
+        => throw GetException();
 
-        public Task<MessageId> Send(CommandGetLastMessageId command, CancellationToken cancellationToken)
-            => throw GetException();
-
-        private static Exception GetException()
-            => new ChannelNotReadyException();
-    }
+    private static Exception GetException()
+        => new ChannelNotReadyException();
 }
diff --git a/src/DotPulsar/Internal/PingPongHandler.cs b/src/DotPulsar/Internal/PingPongHandler.cs
index 9c4f1ca..13edaa3 100644
--- a/src/DotPulsar/Internal/PingPongHandler.cs
+++ b/src/DotPulsar/Internal/PingPongHandler.cs
@@ -12,98 +12,97 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using PulsarApi;
+using System;
+using System.Diagnostics;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class PingPongHandler : IAsyncDisposable
 {
-    using Abstractions;
-    using PulsarApi;
-    using System;
-    using System.Diagnostics;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly IConnection _connection;
+    private readonly TimeSpan _keepAliveInterval;
+    private readonly Timer _timer;
+    private readonly CommandPing _ping;
+    private readonly CommandPong _pong;
+    private long _lastCommand;
 
-    public sealed class PingPongHandler : IAsyncDisposable
+    public PingPongHandler(IConnection connection, TimeSpan keepAliveInterval)
     {
-        private readonly IConnection _connection;
-        private readonly TimeSpan _keepAliveInterval;
-        private readonly Timer _timer;
-        private readonly CommandPing _ping;
-        private readonly CommandPong _pong;
-        private long _lastCommand;
+        _connection = connection;
+        _keepAliveInterval = keepAliveInterval;
+        _timer = new Timer(Watch);
+        _timer.Change(_keepAliveInterval, TimeSpan.Zero);
+        _ping = new CommandPing();
+        _pong = new CommandPong();
+        _lastCommand = Stopwatch.GetTimestamp();
+    }
 
-        public PingPongHandler(IConnection connection, TimeSpan keepAliveInterval)
+    public bool Incoming(BaseCommand.Type commandType)
+    {
+        Interlocked.Exchange(ref _lastCommand, Stopwatch.GetTimestamp());
+
+        if (commandType == BaseCommand.Type.Ping)
         {
-            _connection = connection;
-            _keepAliveInterval = keepAliveInterval;
-            _timer = new Timer(Watch);
-            _timer.Change(_keepAliveInterval, TimeSpan.Zero);
-            _ping = new CommandPing();
-            _pong = new CommandPong();
-            _lastCommand = Stopwatch.GetTimestamp();
+            Task.Factory.StartNew(() => SendPong());
+            return true;
         }
 
-        public bool Incoming(BaseCommand.Type commandType)
+        return commandType == BaseCommand.Type.Pong;
+    }
+
+    private void Watch(object? state)
+    {
+        try
         {
-            Interlocked.Exchange(ref _lastCommand, Stopwatch.GetTimestamp());
-
-            if (commandType == BaseCommand.Type.Ping)
+            var lastCommand = Interlocked.Read(ref _lastCommand);
+            var now = Stopwatch.GetTimestamp();
+            var elapsed = TimeSpan.FromSeconds((now - lastCommand) / Stopwatch.Frequency);
+            if (elapsed >= _keepAliveInterval)
             {
-                Task.Factory.StartNew(() => SendPong());
-                return true;
+                Task.Factory.StartNew(() => SendPing());
+                _timer.Change(_keepAliveInterval, TimeSpan.Zero);
             }
-
-            return commandType == BaseCommand.Type.Pong;
+            else
+                _timer.Change(_keepAliveInterval.Subtract(elapsed), TimeSpan.Zero);
         }
-
-        private void Watch(object? state)
+        catch
         {
-            try
-            {
-                var lastCommand = Interlocked.Read(ref _lastCommand);
-                var now = Stopwatch.GetTimestamp();
-                var elapsed = TimeSpan.FromSeconds((now - lastCommand) / Stopwatch.Frequency);
-                if (elapsed >= _keepAliveInterval)
-                {
-                    Task.Factory.StartNew(() => SendPing());
-                    _timer.Change(_keepAliveInterval, TimeSpan.Zero);
-                }
-                else
-                    _timer.Change(_keepAliveInterval.Subtract(elapsed), TimeSpan.Zero);
-            }
-            catch
-            {
-                // Ignore
-            }
+            // Ignore
         }
+    }
 
-        private async Task SendPing()
+    private async Task SendPing()
+    {
+        try
         {
-            try
-            {
-                await _connection.Send(_ping, default).ConfigureAwait(false);
-            }
-            catch { }
+            await _connection.Send(_ping, default).ConfigureAwait(false);
         }
+        catch { }
+    }
 
-        private async Task SendPong()
+    private async Task SendPong()
+    {
+        try
         {
-            try
-            {
-                await _connection.Send(_pong, default).ConfigureAwait(false);
-            }
-            catch { }
+            await _connection.Send(_pong, default).ConfigureAwait(false);
         }
+        catch { }
+    }
 
 #if NETSTANDARD2_0
-        public ValueTask DisposeAsync()
-        {
-            _timer.Dispose();
-            return new ValueTask();
-        }
+    public ValueTask DisposeAsync()
+    {
+        _timer.Dispose();
+        return new ValueTask();
+    }
 #else
         public async ValueTask DisposeAsync()
         {
             await _timer.DisposeAsync().ConfigureAwait(false);
         }
 #endif
-    }
 }
diff --git a/src/DotPulsar/Internal/ProcessManager.cs b/src/DotPulsar/Internal/ProcessManager.cs
index 18714cc..4ceae48 100644
--- a/src/DotPulsar/Internal/ProcessManager.cs
+++ b/src/DotPulsar/Internal/ProcessManager.cs
@@ -12,73 +12,72 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using Events;
+using System;
+using System.Collections.Concurrent;
+using System.Linq;
+using System.Threading.Tasks;
+
+public sealed class ProcessManager : IRegisterEvent, IAsyncDisposable
 {
-    using Abstractions;
-    using Events;
-    using System;
-    using System.Collections.Concurrent;
-    using System.Linq;
-    using System.Threading.Tasks;
+    private readonly ConcurrentDictionary<Guid, IProcess> _processes;
+    private readonly IConnectionPool _connectionPool;
 
-    public sealed class ProcessManager : IRegisterEvent, IAsyncDisposable
+    public ProcessManager(IConnectionPool connectionPool)
     {
-        private readonly ConcurrentDictionary<Guid, IProcess> _processes;
-        private readonly IConnectionPool _connectionPool;
+        _processes = new ConcurrentDictionary<Guid, IProcess>();
+        _connectionPool = connectionPool;
+    }
 
-        public ProcessManager(IConnectionPool connectionPool)
+    public async ValueTask DisposeAsync()
+    {
+        foreach (var proc in _processes.Values.ToArray())
+            await proc.DisposeAsync().ConfigureAwait(false);
+
+        await _connectionPool.DisposeAsync().ConfigureAwait(false);
+    }
+
+    public void Add(IProcess process)
+        => _processes[process.CorrelationId] = process;
+
+    private async void Remove(Guid correlationId)
+    {
+        if (_processes.TryRemove(correlationId, out var process))
+            await process.DisposeAsync().ConfigureAwait(false);
+    }
+
+    public void Register(IEvent e)
+    {
+        switch (e)
         {
-            _processes = new ConcurrentDictionary<Guid, IProcess>();
-            _connectionPool = connectionPool;
-        }
-
-        public async ValueTask DisposeAsync()
-        {
-            foreach (var proc in _processes.Values.ToArray())
-                await proc.DisposeAsync().ConfigureAwait(false);
-
-            await _connectionPool.DisposeAsync().ConfigureAwait(false);
-        }
-
-        public void Add(IProcess process)
-            => _processes[process.CorrelationId] = process;
-
-        private async void Remove(Guid correlationId)
-        {
-            if (_processes.TryRemove(correlationId, out var process))
-                await process.DisposeAsync().ConfigureAwait(false);
-        }
-
-        public void Register(IEvent e)
-        {
-            switch (e)
-            {
-                case ConsumerCreated _:
-                    DotPulsarEventSource.Log.ConsumerCreated();
-                    break;
-                case ConsumerDisposed consumerDisposed:
-                    Remove(consumerDisposed.CorrelationId);
-                    DotPulsarEventSource.Log.ConsumerDisposed();
-                    break;
-                case ProducerCreated _:
-                    DotPulsarEventSource.Log.ProducerCreated();
-                    break;
-                case ProducerDisposed producerDisposed:
-                    Remove(producerDisposed.CorrelationId);
-                    DotPulsarEventSource.Log.ProducerDisposed();
-                    break;
-                case ReaderCreated _:
-                    DotPulsarEventSource.Log.ReaderCreated();
-                    break;
-                case ReaderDisposed readerDisposed:
-                    Remove(readerDisposed.CorrelationId);
-                    DotPulsarEventSource.Log.ReaderDisposed();
-                    break;
-                default:
-                    if (_processes.TryGetValue(e.CorrelationId, out var process))
-                        process.Handle(e);
-                    break;
-            }
+            case ConsumerCreated _:
+                DotPulsarEventSource.Log.ConsumerCreated();
+                break;
+            case ConsumerDisposed consumerDisposed:
+                Remove(consumerDisposed.CorrelationId);
+                DotPulsarEventSource.Log.ConsumerDisposed();
+                break;
+            case ProducerCreated _:
+                DotPulsarEventSource.Log.ProducerCreated();
+                break;
+            case ProducerDisposed producerDisposed:
+                Remove(producerDisposed.CorrelationId);
+                DotPulsarEventSource.Log.ProducerDisposed();
+                break;
+            case ReaderCreated _:
+                DotPulsarEventSource.Log.ReaderCreated();
+                break;
+            case ReaderDisposed readerDisposed:
+                Remove(readerDisposed.CorrelationId);
+                DotPulsarEventSource.Log.ReaderDisposed();
+                break;
+            default:
+                if (_processes.TryGetValue(e.CorrelationId, out var process))
+                    process.Handle(e);
+                break;
         }
     }
 }
diff --git a/src/DotPulsar/Internal/Producer.cs b/src/DotPulsar/Internal/Producer.cs
index 425d02d..a5808a4 100644
--- a/src/DotPulsar/Internal/Producer.cs
+++ b/src/DotPulsar/Internal/Producer.cs
@@ -12,271 +12,270 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using DotPulsar.Extensions;
+using DotPulsar.Internal.Extensions;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class Producer<TMessage> : IProducer<TMessage>, IRegisterEvent
 {
-    using Abstractions;
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using DotPulsar.Extensions;
-    using DotPulsar.Internal.Extensions;
-    using System;
-    using System.Collections.Concurrent;
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly string _operationName;
+    private readonly KeyValuePair<string, object?>[] _tags;
+    private readonly SequenceId _sequenceId;
+    private readonly StateManager<ProducerState> _state;
+    private readonly IConnectionPool _connectionPool;
+    private readonly IHandleException _exceptionHandler;
+    private readonly ICompressorFactory? _compressorFactory;
+    private readonly ProducerOptions<TMessage> _options;
+    private readonly ProcessManager _processManager;
+    private readonly ConcurrentDictionary<int, SubProducer<TMessage>> _producers;
+    private readonly IMessageRouter _messageRouter;
+    private readonly CancellationTokenSource _cts;
+    private readonly IExecute _executor;
+    private int _isDisposed;
+    private int _producerCount;
+    private Exception? _throw;
 
-    public sealed class Producer<TMessage> : IProducer<TMessage>, IRegisterEvent
+    public Uri ServiceUrl { get; }
+    public string Topic { get; }
+
+    public Producer(
+        Uri serviceUrl,
+        ProducerOptions<TMessage> options,
+        ProcessManager processManager,
+        IHandleException exceptionHandler,
+        IConnectionPool connectionPool,
+        ICompressorFactory? compressorFactory)
     {
-        private readonly string _operationName;
-        private readonly KeyValuePair<string, object?>[] _tags;
-        private readonly SequenceId _sequenceId;
-        private readonly StateManager<ProducerState> _state;
-        private readonly IConnectionPool _connectionPool;
-        private readonly IHandleException _exceptionHandler;
-        private readonly ICompressorFactory? _compressorFactory;
-        private readonly ProducerOptions<TMessage> _options;
-        private readonly ProcessManager _processManager;
-        private readonly ConcurrentDictionary<int, SubProducer<TMessage>> _producers;
-        private readonly IMessageRouter _messageRouter;
-        private readonly CancellationTokenSource _cts;
-        private readonly IExecute _executor;
-        private int _isDisposed;
-        private int _producerCount;
-        private Exception? _throw;
-
-        public Uri ServiceUrl { get; }
-        public string Topic { get; }
-
-        public Producer(
-            Uri serviceUrl,
-            ProducerOptions<TMessage> options,
-            ProcessManager processManager,
-            IHandleException exceptionHandler,
-            IConnectionPool connectionPool,
-            ICompressorFactory? compressorFactory)
+        _operationName = $"{options.Topic} send";
+        _tags = new KeyValuePair<string, object?>[]
         {
-            _operationName = $"{options.Topic} send";
-            _tags = new KeyValuePair<string, object?>[]
-            {
                 new KeyValuePair<string, object?>("messaging.destination", options.Topic),
                 new KeyValuePair<string, object?>("messaging.destination_kind", "topic"),
                 new KeyValuePair<string, object?>("messaging.system", "pulsar"),
                 new KeyValuePair<string, object?>("messaging.url", serviceUrl),
-            };
-            _sequenceId = new SequenceId(options.InitialSequenceId);
-            _state = new StateManager<ProducerState>(ProducerState.Disconnected, ProducerState.Closed, ProducerState.Faulted);
-            ServiceUrl = serviceUrl;
-            Topic = options.Topic;
-            _isDisposed = 0;
-            _options = options;
-            _exceptionHandler = exceptionHandler;
-            _connectionPool = connectionPool;
-            _compressorFactory = compressorFactory;
-            _processManager = processManager;
-            _messageRouter = options.MessageRouter;
-            _cts = new CancellationTokenSource();
-            _executor = new Executor(Guid.Empty, this, _exceptionHandler);
-            _producers = new ConcurrentDictionary<int, SubProducer<TMessage>>();
-            _ = Setup();
-        }
+        };
+        _sequenceId = new SequenceId(options.InitialSequenceId);
+        _state = new StateManager<ProducerState>(ProducerState.Disconnected, ProducerState.Closed, ProducerState.Faulted);
+        ServiceUrl = serviceUrl;
+        Topic = options.Topic;
+        _isDisposed = 0;
+        _options = options;
+        _exceptionHandler = exceptionHandler;
+        _connectionPool = connectionPool;
+        _compressorFactory = compressorFactory;
+        _processManager = processManager;
+        _messageRouter = options.MessageRouter;
+        _cts = new CancellationTokenSource();
+        _executor = new Executor(Guid.Empty, this, _exceptionHandler);
+        _producers = new ConcurrentDictionary<int, SubProducer<TMessage>>();
+        _ = Setup();
+    }
 
-        private async Task Setup()
+    private async Task Setup()
+    {
+        await Task.Yield();
+
+        try
         {
-            await Task.Yield();
-
-            try
-            {
-                await _executor.Execute(Monitor, _cts.Token).ConfigureAwait(false);
-            }
-            catch (Exception exception)
-            {
-                if (_cts.IsCancellationRequested)
-                    return;
-
-                _throw = exception;
-                _state.SetState(ProducerState.Faulted);
-            }
+            await _executor.Execute(Monitor, _cts.Token).ConfigureAwait(false);
         }
-
-        private async Task Monitor()
+        catch (Exception exception)
         {
-            var numberOfPartitions = await GetNumberOfPartitions(Topic, _cts.Token).ConfigureAwait(false);
-            var isPartitionedTopic = numberOfPartitions != 0;
-            var monitoringTasks = new Task<ProducerStateChanged>[isPartitionedTopic ? numberOfPartitions : 1];
-
-            var topic = Topic;
-
-            for (var partition = 0; partition < monitoringTasks.Length; ++partition)
-            {
-                if (isPartitionedTopic)
-                    topic = $"{Topic}-partition-{partition}";
-
-                var producer = CreateSubProducer(topic);
-                _ = _producers.TryAdd(partition, producer);
-                monitoringTasks[partition] = producer.StateChangedFrom(ProducerState.Disconnected, _cts.Token).AsTask();
-            }
-
-            Interlocked.Exchange(ref _producerCount, monitoringTasks.Length);
-
-            var connectedProducers = 0;
-
-            while (true)
-            {
-                await Task.WhenAny(monitoringTasks).ConfigureAwait(false);
-
-                for (var i = 0; i < monitoringTasks.Length; ++i)
-                {
-                    var task = monitoringTasks[i];
-                    if (!task.IsCompleted)
-                        continue;
-
-                    var state = task.Result.ProducerState;
-                    switch (state)
-                    {
-                        case ProducerState.Connected:
-                            ++connectedProducers;
-                            break;
-                        case ProducerState.Disconnected:
-                            --connectedProducers;
-                            break;
-                        case ProducerState.Faulted:
-                            _state.SetState(ProducerState.Faulted);
-                            return;
-                    }
-
-                    monitoringTasks[i] = task.Result.Producer.StateChangedFrom(state, _cts.Token).AsTask();
-                }
-
-                if (connectedProducers == 0)
-                    _state.SetState(ProducerState.Disconnected);
-                else if (connectedProducers == monitoringTasks.Length)
-                    _state.SetState(ProducerState.Connected);
-                else
-                    _state.SetState(ProducerState.PartiallyConnected);
-            }
-        }
-
-        private SubProducer<TMessage> CreateSubProducer(string topic)
-        {
-            var correlationId = Guid.NewGuid();
-            var producerName = _options.ProducerName;
-            var schema = _options.Schema;
-            var factory = new ProducerChannelFactory(correlationId, _processManager, _connectionPool, topic, producerName, schema.SchemaInfo, _compressorFactory);
-            var stateManager = new StateManager<ProducerState>(ProducerState.Disconnected, ProducerState.Closed, ProducerState.Faulted);
-            var initialChannel = new NotReadyChannel<TMessage>();
-            var executor = new Executor(correlationId, _processManager, _exceptionHandler);
-            var producer = new SubProducer<TMessage>(correlationId, ServiceUrl, topic, _processManager, initialChannel, executor, stateManager, factory, schema);
-            var process = new ProducerProcess(correlationId, stateManager, producer);
-            _processManager.Add(process);
-            process.Start();
-            return producer;
-        }
-
-        private async Task<uint> GetNumberOfPartitions(string topic, CancellationToken cancellationToken)
-        {
-            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);
-
-            if (response.PartitionMetadataResponse.Response == PulsarApi.CommandPartitionedTopicMetadataResponse.LookupType.Failed)
-                response.PartitionMetadataResponse.Throw();
-
-            return response.PartitionMetadataResponse.Partitions;
-        }
-
-        public bool IsFinalState()
-            => _state.IsFinalState();
-
-        public bool IsFinalState(ProducerState state)
-            => _state.IsFinalState(state);
-
-        public async ValueTask<ProducerState> OnStateChangeTo(ProducerState state, CancellationToken cancellationToken)
-            => await _state.StateChangedTo(state, cancellationToken).ConfigureAwait(false);
-
-        public async ValueTask<ProducerState> OnStateChangeFrom(ProducerState state, CancellationToken cancellationToken)
-            => await _state.StateChangedFrom(state, cancellationToken).ConfigureAwait(false);
-
-        public async ValueTask DisposeAsync()
-        {
-            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+            if (_cts.IsCancellationRequested)
                 return;
 
-            _cts.Cancel();
-            _cts.Dispose();
+            _throw = exception;
+            _state.SetState(ProducerState.Faulted);
+        }
+    }
 
-            _state.SetState(ProducerState.Closed);
+    private async Task Monitor()
+    {
+        var numberOfPartitions = await GetNumberOfPartitions(Topic, _cts.Token).ConfigureAwait(false);
+        var isPartitionedTopic = numberOfPartitions != 0;
+        var monitoringTasks = new Task<ProducerStateChanged>[isPartitionedTopic ? numberOfPartitions : 1];
 
-            foreach (var producer in _producers.Values)
-            {
-                await producer.DisposeAsync().ConfigureAwait(false);
-            }
+        var topic = Topic;
+
+        for (var partition = 0; partition < monitoringTasks.Length; ++partition)
+        {
+            if (isPartitionedTopic)
+                topic = $"{Topic}-partition-{partition}";
+
+            var producer = CreateSubProducer(topic);
+            _ = _producers.TryAdd(partition, producer);
+            monitoringTasks[partition] = producer.StateChangedFrom(ProducerState.Disconnected, _cts.Token).AsTask();
         }
 
-        private async ValueTask<int> ChoosePartitions(MessageMetadata metadata, CancellationToken cancellationToken)
+        Interlocked.Exchange(ref _producerCount, monitoringTasks.Length);
+
+        var connectedProducers = 0;
+
+        while (true)
         {
-            if (_producerCount == 0)
+            await Task.WhenAny(monitoringTasks).ConfigureAwait(false);
+
+            for (var i = 0; i < monitoringTasks.Length; ++i)
             {
-                _ = await _state.StateChangedFrom(ProducerState.Disconnected, cancellationToken).ConfigureAwait(false);
-                if (_throw is not null)
-                    throw _throw;
-            }
+                var task = monitoringTasks[i];
+                if (!task.IsCompleted)
+                    continue;
 
-            if (_producerCount == 1)
-                return 0;
-
-            return _messageRouter.ChoosePartition(metadata, _producerCount);
-        }
-
-        public async ValueTask<MessageId> Send(MessageMetadata metadata, TMessage message, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
-
-            var autoAssignSequenceId = metadata.SequenceId == 0;
-            if (autoAssignSequenceId)
-                metadata.SequenceId = _sequenceId.FetchNext();
-
-            var activity = DotPulsarActivitySource.StartProducerActivity(metadata, _operationName, _tags);
-
-            try
-            {
-                var partition = await ChoosePartitions(metadata, cancellationToken).ConfigureAwait(false);
-                var producer = _producers[partition];
-                var data = _options.Schema.Encode(message);
-                var messageId = await producer.Send(metadata.Metadata, data, cancellationToken).ConfigureAwait(false);
-
-                if (activity is not null && activity.IsAllDataRequested)
+                var state = task.Result.ProducerState;
+                switch (state)
                 {
-                    activity.SetMessageId(messageId);
-                    activity.SetPayloadSize(data.Length);
-                    activity.SetStatusCode("OK");
+                    case ProducerState.Connected:
+                        ++connectedProducers;
+                        break;
+                    case ProducerState.Disconnected:
+                        --connectedProducers;
+                        break;
+                    case ProducerState.Faulted:
+                        _state.SetState(ProducerState.Faulted);
+                        return;
                 }
 
-                return messageId;
+                monitoringTasks[i] = task.Result.Producer.StateChangedFrom(state, _cts.Token).AsTask();
             }
-            catch (Exception exception)
-            {
-                if (activity is not null && activity.IsAllDataRequested)
-                    activity.AddException(exception);
 
-                throw;
-            }
-            finally
-            {
-                activity?.Dispose();
-
-                if (autoAssignSequenceId)
-                    metadata.SequenceId = 0;
-            }
+            if (connectedProducers == 0)
+                _state.SetState(ProducerState.Disconnected);
+            else if (connectedProducers == monitoringTasks.Length)
+                _state.SetState(ProducerState.Connected);
+            else
+                _state.SetState(ProducerState.PartiallyConnected);
         }
-
-        private void ThrowIfDisposed()
-        {
-            if (_isDisposed != 0)
-                throw new ProducerDisposedException(GetType().FullName!);
-        }
-
-        public void Register(IEvent @event) { }
     }
+
+    private SubProducer<TMessage> CreateSubProducer(string topic)
+    {
+        var correlationId = Guid.NewGuid();
+        var producerName = _options.ProducerName;
+        var schema = _options.Schema;
+        var factory = new ProducerChannelFactory(correlationId, _processManager, _connectionPool, topic, producerName, schema.SchemaInfo, _compressorFactory);
+        var stateManager = new StateManager<ProducerState>(ProducerState.Disconnected, ProducerState.Closed, ProducerState.Faulted);
+        var initialChannel = new NotReadyChannel<TMessage>();
+        var executor = new Executor(correlationId, _processManager, _exceptionHandler);
+        var producer = new SubProducer<TMessage>(correlationId, ServiceUrl, topic, _processManager, initialChannel, executor, stateManager, factory, schema);
+        var process = new ProducerProcess(correlationId, stateManager, producer);
+        _processManager.Add(process);
+        process.Start();
+        return producer;
+    }
+
+    private async Task<uint> GetNumberOfPartitions(string topic, CancellationToken cancellationToken)
+    {
+        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);
+
+        if (response.PartitionMetadataResponse.Response == PulsarApi.CommandPartitionedTopicMetadataResponse.LookupType.Failed)
+            response.PartitionMetadataResponse.Throw();
+
+        return response.PartitionMetadataResponse.Partitions;
+    }
+
+    public bool IsFinalState()
+        => _state.IsFinalState();
+
+    public bool IsFinalState(ProducerState state)
+        => _state.IsFinalState(state);
+
+    public async ValueTask<ProducerState> OnStateChangeTo(ProducerState state, CancellationToken cancellationToken)
+        => await _state.StateChangedTo(state, cancellationToken).ConfigureAwait(false);
+
+    public async ValueTask<ProducerState> OnStateChangeFrom(ProducerState state, CancellationToken cancellationToken)
+        => await _state.StateChangedFrom(state, cancellationToken).ConfigureAwait(false);
+
+    public async ValueTask DisposeAsync()
+    {
+        if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+            return;
+
+        _cts.Cancel();
+        _cts.Dispose();
+
+        _state.SetState(ProducerState.Closed);
+
+        foreach (var producer in _producers.Values)
+        {
+            await producer.DisposeAsync().ConfigureAwait(false);
+        }
+    }
+
+    private async ValueTask<int> ChoosePartitions(MessageMetadata metadata, CancellationToken cancellationToken)
+    {
+        if (_producerCount == 0)
+        {
+            _ = await _state.StateChangedFrom(ProducerState.Disconnected, cancellationToken).ConfigureAwait(false);
+            if (_throw is not null)
+                throw _throw;
+        }
+
+        if (_producerCount == 1)
+            return 0;
+
+        return _messageRouter.ChoosePartition(metadata, _producerCount);
+    }
+
+    public async ValueTask<MessageId> Send(MessageMetadata metadata, TMessage message, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
+
+        var autoAssignSequenceId = metadata.SequenceId == 0;
+        if (autoAssignSequenceId)
+            metadata.SequenceId = _sequenceId.FetchNext();
+
+        var activity = DotPulsarActivitySource.StartProducerActivity(metadata, _operationName, _tags);
+
+        try
+        {
+            var partition = await ChoosePartitions(metadata, cancellationToken).ConfigureAwait(false);
+            var producer = _producers[partition];
+            var data = _options.Schema.Encode(message);
+            var messageId = await producer.Send(metadata.Metadata, data, cancellationToken).ConfigureAwait(false);
+
+            if (activity is not null && activity.IsAllDataRequested)
+            {
+                activity.SetMessageId(messageId);
+                activity.SetPayloadSize(data.Length);
+                activity.SetStatusCode("OK");
+            }
+
+            return messageId;
+        }
+        catch (Exception exception)
+        {
+            if (activity is not null && activity.IsAllDataRequested)
+                activity.AddException(exception);
+
+            throw;
+        }
+        finally
+        {
+            activity?.Dispose();
+
+            if (autoAssignSequenceId)
+                metadata.SequenceId = 0;
+        }
+    }
+
+    private void ThrowIfDisposed()
+    {
+        if (_isDisposed != 0)
+            throw new ProducerDisposedException(GetType().FullName!);
+    }
+
+    public void Register(IEvent @event) { }
 }
diff --git a/src/DotPulsar/Internal/ProducerBuilder.cs b/src/DotPulsar/Internal/ProducerBuilder.cs
index 84345e7..12859f4 100644
--- a/src/DotPulsar/Internal/ProducerBuilder.cs
+++ b/src/DotPulsar/Internal/ProducerBuilder.cs
@@ -12,83 +12,82 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+
+public sealed class ProducerBuilder<TMessage> : IProducerBuilder<TMessage>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
+    private readonly IPulsarClient _pulsarClient;
+    private readonly ISchema<TMessage> _schema;
+    private string? _producerName;
+    private CompressionType _compressionType;
+    private ulong _initialSequenceId;
+    private string? _topic;
+    private IHandleStateChanged<ProducerStateChanged>? _stateChangedHandler;
+    private IMessageRouter? _messageRouter;
 
-    public sealed class ProducerBuilder<TMessage> : IProducerBuilder<TMessage>
+    public ProducerBuilder(IPulsarClient pulsarClient, ISchema<TMessage> schema)
     {
-        private readonly IPulsarClient _pulsarClient;
-        private readonly ISchema<TMessage> _schema;
-        private string? _producerName;
-        private CompressionType _compressionType;
-        private ulong _initialSequenceId;
-        private string? _topic;
-        private IHandleStateChanged<ProducerStateChanged>? _stateChangedHandler;
-        private IMessageRouter? _messageRouter;
+        _pulsarClient = pulsarClient;
+        _schema = schema;
+        _compressionType = ProducerOptions<TMessage>.DefaultCompressionType;
+        _initialSequenceId = ProducerOptions<TMessage>.DefaultInitialSequenceId;
+    }
 
-        public ProducerBuilder(IPulsarClient pulsarClient, ISchema<TMessage> schema)
+    public IProducerBuilder<TMessage> CompressionType(CompressionType compressionType)
+    {
+        _compressionType = compressionType;
+        return this;
+    }
+
+    public IProducerBuilder<TMessage> InitialSequenceId(ulong initialSequenceId)
+    {
+        _initialSequenceId = initialSequenceId;
+        return this;
+    }
+
+    public IProducerBuilder<TMessage> ProducerName(string name)
+    {
+        _producerName = name;
+        return this;
+    }
+
+    public IProducerBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ProducerStateChanged> handler)
+    {
+        _stateChangedHandler = handler;
+        return this;
+    }
+
+    public IProducerBuilder<TMessage> Topic(string topic)
+    {
+        _topic = topic;
+        return this;
+    }
+
+    public IProducerBuilder<TMessage> MessageRouter(IMessageRouter messageRouter)
+    {
+        _messageRouter = messageRouter;
+        return this;
+    }
+
+    public IProducer<TMessage> Create()
+    {
+        if (string.IsNullOrEmpty(_topic))
+            throw new ConfigurationException("ProducerOptions.Topic may not be null or empty");
+
+        var options = new ProducerOptions<TMessage>(_topic!, _schema)
         {
-            _pulsarClient = pulsarClient;
-            _schema = schema;
-            _compressionType = ProducerOptions<TMessage>.DefaultCompressionType;
-            _initialSequenceId = ProducerOptions<TMessage>.DefaultInitialSequenceId;
-        }
+            CompressionType = _compressionType,
+            InitialSequenceId = _initialSequenceId,
+            ProducerName = _producerName,
+            StateChangedHandler = _stateChangedHandler
+        };
 
-        public IProducerBuilder<TMessage> CompressionType(CompressionType compressionType)
-        {
-            _compressionType = compressionType;
-            return this;
-        }
+        if (_messageRouter is not null)
+            options.MessageRouter = _messageRouter;
 
-        public IProducerBuilder<TMessage> InitialSequenceId(ulong initialSequenceId)
-        {
-            _initialSequenceId = initialSequenceId;
-            return this;
-        }
-
-        public IProducerBuilder<TMessage> ProducerName(string name)
-        {
-            _producerName = name;
-            return this;
-        }
-
-        public IProducerBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ProducerStateChanged> handler)
-        {
-            _stateChangedHandler = handler;
-            return this;
-        }
-
-        public IProducerBuilder<TMessage> Topic(string topic)
-        {
-            _topic = topic;
-            return this;
-        }
-
-        public IProducerBuilder<TMessage> MessageRouter(IMessageRouter messageRouter)
-        {
-            _messageRouter = messageRouter;
-            return this;
-        }
-
-        public IProducer<TMessage> Create()
-        {
-            if (string.IsNullOrEmpty(_topic))
-                throw new ConfigurationException("ProducerOptions.Topic may not be null or empty");
-
-            var options = new ProducerOptions<TMessage>(_topic!, _schema)
-            {
-                CompressionType = _compressionType,
-                InitialSequenceId = _initialSequenceId,
-                ProducerName = _producerName,
-                StateChangedHandler = _stateChangedHandler
-            };
-
-            if (_messageRouter is not null)
-                options.MessageRouter = _messageRouter;
-
-            return _pulsarClient.CreateProducer(options);
-        }
+        return _pulsarClient.CreateProducer(options);
     }
 }
diff --git a/src/DotPulsar/Internal/ProducerChannel.cs b/src/DotPulsar/Internal/ProducerChannel.cs
index d23aa62..fc72b67 100644
--- a/src/DotPulsar/Internal/ProducerChannel.cs
+++ b/src/DotPulsar/Internal/ProducerChannel.cs
@@ -12,99 +12,98 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using Extensions;
+using Microsoft.Extensions.ObjectPool;
+using PulsarApi;
+using System;
+using System.Buffers;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class ProducerChannel : IProducerChannel
 {
-    using Abstractions;
-    using Extensions;
-    using Microsoft.Extensions.ObjectPool;
-    using PulsarApi;
-    using System;
-    using System.Buffers;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly ObjectPool<SendPackage> _sendPackagePool;
+    private readonly ulong _id;
+    private readonly string _name;
+    private readonly IConnection _connection;
+    private readonly ICompressorFactory? _compressorFactory;
+    private readonly byte[]? _schemaVersion;
 
-    public sealed class ProducerChannel : IProducerChannel
+    public ProducerChannel(
+        ulong id,
+        string name,
+        IConnection connection,
+        ICompressorFactory? compressorFactory,
+        byte[]? schemaVersion)
     {
-        private readonly ObjectPool<SendPackage> _sendPackagePool;
-        private readonly ulong _id;
-        private readonly string _name;
-        private readonly IConnection _connection;
-        private readonly ICompressorFactory? _compressorFactory;
-        private readonly byte[]? _schemaVersion;
+        var sendPackagePolicy = new DefaultPooledObjectPolicy<SendPackage>();
+        _sendPackagePool = new DefaultObjectPool<SendPackage>(sendPackagePolicy);
+        _id = id;
+        _name = name;
+        _connection = connection;
+        _compressorFactory = compressorFactory;
+        _schemaVersion = schemaVersion;
+    }
 
-        public ProducerChannel(
-            ulong id,
-            string name,
-            IConnection connection,
-            ICompressorFactory? compressorFactory,
-            byte[]? schemaVersion)
+    public async ValueTask ClosedByClient(CancellationToken cancellationToken)
+    {
+        try
         {
-            var sendPackagePolicy = new DefaultPooledObjectPolicy<SendPackage>();
-            _sendPackagePool = new DefaultObjectPool<SendPackage>(sendPackagePolicy);
-            _id = id;
-            _name = name;
-            _connection = connection;
-            _compressorFactory = compressorFactory;
-            _schemaVersion = schemaVersion;
+            var closeProducer = new CommandCloseProducer { ProducerId = _id };
+            await _connection.Send(closeProducer, cancellationToken).ConfigureAwait(false);
         }
-
-        public async ValueTask ClosedByClient(CancellationToken cancellationToken)
+        catch
         {
-            try
-            {
-                var closeProducer = new CommandCloseProducer { ProducerId = _id };
-                await _connection.Send(closeProducer, cancellationToken).ConfigureAwait(false);
-            }
-            catch
-            {
-                // Ignore
-            }
+            // Ignore
         }
+    }
 
-        public ValueTask DisposeAsync() => new();
+    public ValueTask DisposeAsync() => new();
 
-        public async Task<CommandSendReceipt> Send(MessageMetadata metadata, ReadOnlySequence<byte> payload, CancellationToken cancellationToken)
+    public async Task<CommandSendReceipt> Send(MessageMetadata metadata, ReadOnlySequence<byte> payload, CancellationToken cancellationToken)
+    {
+        var sendPackage = _sendPackagePool.Get();
+
+        try
         {
-            var sendPackage = _sendPackagePool.Get();
+            metadata.PublishTime = (ulong) DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+            metadata.ProducerName = _name;
 
-            try
+            if (metadata.SchemaVersion is null && _schemaVersion is not null)
+                metadata.SchemaVersion = _schemaVersion;
+
+            if (sendPackage.Command is null)
             {
-                metadata.PublishTime = (ulong) DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-                metadata.ProducerName = _name;
-
-                if (metadata.SchemaVersion is null && _schemaVersion is not null)
-                    metadata.SchemaVersion = _schemaVersion;
-
-                if (sendPackage.Command is null)
+                sendPackage.Command = new CommandSend
                 {
-                    sendPackage.Command = new CommandSend
-                    {
-                        ProducerId = _id,
-                        NumMessages = 1
-                    };
-                }
-
-                sendPackage.Command.SequenceId = metadata.SequenceId;
-                sendPackage.Metadata = metadata;
-
-                if (_compressorFactory is null)
-                    sendPackage.Payload = payload;
-                else
-                {
-                    sendPackage.Metadata.Compression = _compressorFactory.CompressionType;
-                    sendPackage.Metadata.UncompressedSize = (uint) payload.Length;
-                    using var compressor = _compressorFactory.Create();
-                    sendPackage.Payload = compressor.Compress(payload);
-                }
-
-                var response = await _connection.Send(sendPackage, cancellationToken).ConfigureAwait(false);
-                response.Expect(BaseCommand.Type.SendReceipt);
-                return response.SendReceipt;
+                    ProducerId = _id,
+                    NumMessages = 1
+                };
             }
-            finally
+
+            sendPackage.Command.SequenceId = metadata.SequenceId;
+            sendPackage.Metadata = metadata;
+
+            if (_compressorFactory is null)
+                sendPackage.Payload = payload;
+            else
             {
-                _sendPackagePool.Return(sendPackage);
+                sendPackage.Metadata.Compression = _compressorFactory.CompressionType;
+                sendPackage.Metadata.UncompressedSize = (uint) payload.Length;
+                using var compressor = _compressorFactory.Create();
+                sendPackage.Payload = compressor.Compress(payload);
             }
+
+            var response = await _connection.Send(sendPackage, cancellationToken).ConfigureAwait(false);
+            response.Expect(BaseCommand.Type.SendReceipt);
+            return response.SendReceipt;
+        }
+        finally
+        {
+            _sendPackagePool.Return(sendPackage);
         }
     }
 }
diff --git a/src/DotPulsar/Internal/ProducerChannelFactory.cs b/src/DotPulsar/Internal/ProducerChannelFactory.cs
index 57fd701..74ab9a0 100644
--- a/src/DotPulsar/Internal/ProducerChannelFactory.cs
+++ b/src/DotPulsar/Internal/ProducerChannelFactory.cs
@@ -12,74 +12,73 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Internal.Extensions;
+using PulsarApi;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class ProducerChannelFactory : IProducerChannelFactory
 {
-    using Abstractions;
-    using DotPulsar.Internal.Extensions;
-    using PulsarApi;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly Guid _correlationId;
+    private readonly IRegisterEvent _eventRegister;
+    private readonly IConnectionPool _connectionPool;
+    private readonly CommandProducer _commandProducer;
+    private readonly ICompressorFactory? _compressorFactory;
+    private readonly Schema? _schema;
 
-    public sealed class ProducerChannelFactory : IProducerChannelFactory
+    public ProducerChannelFactory(
+        Guid correlationId,
+        IRegisterEvent eventRegister,
+        IConnectionPool connectionPool,
+        string topic,
+        string? producerName,
+        SchemaInfo schemaInfo,
+        ICompressorFactory? compressorFactory)
     {
-        private readonly Guid _correlationId;
-        private readonly IRegisterEvent _eventRegister;
-        private readonly IConnectionPool _connectionPool;
-        private readonly CommandProducer _commandProducer;
-        private readonly ICompressorFactory? _compressorFactory;
-        private readonly Schema? _schema;
+        _correlationId = correlationId;
+        _eventRegister = eventRegister;
+        _connectionPool = connectionPool;
 
-        public ProducerChannelFactory(
-            Guid correlationId,
-            IRegisterEvent eventRegister,
-            IConnectionPool connectionPool,
-            string topic,
-            string? producerName,
-            SchemaInfo schemaInfo,
-            ICompressorFactory? compressorFactory)
+        _commandProducer = new CommandProducer
         {
-            _correlationId = correlationId;
-            _eventRegister = eventRegister;
-            _connectionPool = connectionPool;
+            ProducerName = producerName,
+            Topic = topic
+        };
 
-            _commandProducer = new CommandProducer
-            {
-                ProducerName = producerName,
-                Topic = topic
-            };
+        _compressorFactory = compressorFactory;
+        _schema = schemaInfo.PulsarSchema;
+    }
 
-            _compressorFactory = compressorFactory;
-            _schema = schemaInfo.PulsarSchema;
-        }
+    public async Task<IProducerChannel> Create(CancellationToken cancellationToken)
+    {
+        var connection = await _connectionPool.FindConnectionForTopic(_commandProducer.Topic, cancellationToken).ConfigureAwait(false);
+        var channel = new Channel(_correlationId, _eventRegister, new AsyncQueue<MessagePackage>());
+        var response = await connection.Send(_commandProducer, channel, cancellationToken).ConfigureAwait(false);
+        var schemaVersion = await GetSchemaVersion(connection, cancellationToken).ConfigureAwait(false);
+        return new ProducerChannel(response.ProducerId, response.ProducerName, connection, _compressorFactory, schemaVersion);
+    }
 
-        public async Task<IProducerChannel> Create(CancellationToken cancellationToken)
+    private async ValueTask<byte[]?> GetSchemaVersion(IConnection connection, CancellationToken cancellationToken)
+    {
+        if (_schema is null || _schema.Type == Schema.SchemaType.None)
+            return null;
+
+        var command = new CommandGetOrCreateSchema
         {
-            var connection = await _connectionPool.FindConnectionForTopic(_commandProducer.Topic, cancellationToken).ConfigureAwait(false);
-            var channel = new Channel(_correlationId, _eventRegister, new AsyncQueue<MessagePackage>());
-            var response = await connection.Send(_commandProducer, channel, cancellationToken).ConfigureAwait(false);
-            var schemaVersion = await GetSchemaVersion(connection, cancellationToken).ConfigureAwait(false);
-            return new ProducerChannel(response.ProducerId, response.ProducerName, connection, _compressorFactory, schemaVersion);
-        }
+            Schema = _schema,
+            Topic = _commandProducer.Topic
+        };
 
-        private async ValueTask<byte[]?> GetSchemaVersion(IConnection connection, CancellationToken cancellationToken)
-        {
-            if (_schema is null || _schema.Type == Schema.SchemaType.None)
-                return null;
+        var response = await connection.Send(command, cancellationToken).ConfigureAwait(false);
 
-            var command = new CommandGetOrCreateSchema
-            {
-                Schema = _schema,
-                Topic = _commandProducer.Topic
-            };
+        response.Expect(BaseCommand.Type.GetOrCreateSchemaResponse);
+        if (response.GetOrCreateSchemaResponse.ShouldSerializeErrorCode())
+            response.GetOrCreateSchemaResponse.Throw();
 
-            var response = await connection.Send(command, cancellationToken).ConfigureAwait(false);
-
-            response.Expect(BaseCommand.Type.GetOrCreateSchemaResponse);
-            if (response.GetOrCreateSchemaResponse.ShouldSerializeErrorCode())
-                response.GetOrCreateSchemaResponse.Throw();
-
-            return response.GetOrCreateSchemaResponse.SchemaVersion;
-        }
+        return response.GetOrCreateSchemaResponse.SchemaVersion;
     }
 }
diff --git a/src/DotPulsar/Internal/ProducerProcess.cs b/src/DotPulsar/Internal/ProducerProcess.cs
index 7e0b37f..9a39bdc 100644
--- a/src/DotPulsar/Internal/ProducerProcess.cs
+++ b/src/DotPulsar/Internal/ProducerProcess.cs
@@ -12,55 +12,54 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using System;
+using System.Threading.Tasks;
+
+public sealed class ProducerProcess : Process
 {
-    using Abstractions;
-    using System;
-    using System.Threading.Tasks;
+    private readonly IStateManager<ProducerState> _stateManager;
+    private readonly IEstablishNewChannel _producer;
 
-    public sealed class ProducerProcess : Process
+    public ProducerProcess(
+        Guid correlationId,
+        IStateManager<ProducerState> stateManager,
+        IEstablishNewChannel producer) : base(correlationId)
     {
-        private readonly IStateManager<ProducerState> _stateManager;
-        private readonly IEstablishNewChannel _producer;
+        _stateManager = stateManager;
+        _producer = producer;
+    }
 
-        public ProducerProcess(
-            Guid correlationId,
-            IStateManager<ProducerState> stateManager,
-            IEstablishNewChannel producer) : base(correlationId)
+    public override async ValueTask DisposeAsync()
+    {
+        _stateManager.SetState(ProducerState.Closed);
+        CancellationTokenSource.Cancel();
+        await _producer.DisposeAsync().ConfigureAwait(false);
+    }
+
+    protected override void CalculateState()
+    {
+        if (_stateManager.IsFinalState())
+            return;
+
+        if (ExecutorState == ExecutorState.Faulted)
         {
-            _stateManager = stateManager;
-            _producer = producer;
+            _stateManager.SetState(ProducerState.Faulted);
+            return;
         }
 
-        public override async ValueTask DisposeAsync()
+        switch (ChannelState)
         {
-            _stateManager.SetState(ProducerState.Closed);
-            CancellationTokenSource.Cancel();
-            await _producer.DisposeAsync().ConfigureAwait(false);
-        }
-
-        protected override void CalculateState()
-        {
-            if (_stateManager.IsFinalState())
+            case ChannelState.ClosedByServer:
+            case ChannelState.Disconnected:
+                _stateManager.SetState(ProducerState.Disconnected);
+                _ = _producer.EstablishNewChannel(CancellationTokenSource.Token);
                 return;
-
-            if (ExecutorState == ExecutorState.Faulted)
-            {
-                _stateManager.SetState(ProducerState.Faulted);
+            case ChannelState.Connected:
+                _stateManager.SetState(ProducerState.Connected);
                 return;
-            }
-
-            switch (ChannelState)
-            {
-                case ChannelState.ClosedByServer:
-                case ChannelState.Disconnected:
-                    _stateManager.SetState(ProducerState.Disconnected);
-                    _ = _producer.EstablishNewChannel(CancellationTokenSource.Token);
-                    return;
-                case ChannelState.Connected:
-                    _stateManager.SetState(ProducerState.Connected);
-                    return;
-            }
         }
     }
 }
diff --git a/src/DotPulsar/Internal/ProducerResponse.cs b/src/DotPulsar/Internal/ProducerResponse.cs
index 8867945..474dc5f 100644
--- a/src/DotPulsar/Internal/ProducerResponse.cs
+++ b/src/DotPulsar/Internal/ProducerResponse.cs
@@ -12,17 +12,16 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
-{
-    public sealed class ProducerResponse
-    {
-        public ProducerResponse(ulong producerId, string producerName)
-        {
-            ProducerId = producerId;
-            ProducerName = producerName;
-        }
+namespace DotPulsar.Internal;
 
-        public ulong ProducerId { get; }
-        public string ProducerName { get; }
+public sealed class ProducerResponse
+{
+    public ProducerResponse(ulong producerId, string producerName)
+    {
+        ProducerId = producerId;
+        ProducerName = producerName;
     }
+
+    public ulong ProducerId { get; }
+    public string ProducerName { get; }
 }
diff --git a/src/DotPulsar/Internal/PulsarApi/GeneratedCode.cs b/src/DotPulsar/Internal/PulsarApi/GeneratedCode.cs
index e5ca9aa..3201bf2 100644
--- a/src/DotPulsar/Internal/PulsarApi/GeneratedCode.cs
+++ b/src/DotPulsar/Internal/PulsarApi/GeneratedCode.cs
@@ -16,3198 +16,3197 @@
 #region Designer generated code
 #pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
 
-namespace DotPulsar.Internal.PulsarApi
+namespace DotPulsar.Internal.PulsarApi;
+
+// <auto-generated>
+//   This file was generated by a tool; you should avoid making direct changes.
+//   Consider using 'partial classes' to extend these types
+//   Input: PulsarApi.proto (281163b)
+// </auto-generated>
+
+[global::ProtoBuf.ProtoContract()]
+public partial class Schema : global::ProtoBuf.IExtensible
 {
-    // <auto-generated>
-    //   This file was generated by a tool; you should avoid making direct changes.
-    //   Consider using 'partial classes' to extend these types
-    //   Input: PulsarApi.proto (281163b)
-    // </auto-generated>
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
 
-    [global::ProtoBuf.ProtoContract()]
-    public partial class Schema : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+    [global::ProtoBuf.ProtoMember(1, Name = @"name", IsRequired = true)]
+    public string Name { get; set; }
 
-        [global::ProtoBuf.ProtoMember(1, Name = @"name", IsRequired = true)]
-        public string Name { get; set; }
+    [global::ProtoBuf.ProtoMember(3, Name = @"schema_data", IsRequired = true)]
+    public byte[] SchemaData { get; set; }
 
-        [global::ProtoBuf.ProtoMember(3, Name = @"schema_data", IsRequired = true)]
-        public byte[] SchemaData { get; set; }
+    [global::ProtoBuf.ProtoMember(4, IsRequired = true)]
+    public SchemaType Type { get; set; }
 
-        [global::ProtoBuf.ProtoMember(4, IsRequired = true)]
-        public SchemaType Type { get; set; }
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"properties")]
-        public global::System.Collections.Generic.List<KeyValue> Properties { get; } = new global::System.Collections.Generic.List<KeyValue>();
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum SchemaType
-        {
-            None = 0,
-            String = 1,
-            Json = 2,
-            Protobuf = 3,
-            Avro = 4,
-            Bool = 5,
-            Int8 = 6,
-            Int16 = 7,
-            Int32 = 8,
-            Int64 = 9,
-            Float = 10,
-            Double = 11,
-            Date = 12,
-            Time = 13,
-            Timestamp = 14,
-            KeyValue = 15,
-            Instant = 16,
-            LocalDate = 17,
-            LocalTime = 18,
-            LocalDateTime = 19,
-            ProtobufNative = 20,
-        }
-
-    }
+    [global::ProtoBuf.ProtoMember(5, Name = @"properties")]
+    public global::System.Collections.Generic.List<KeyValue> Properties { get; } = new global::System.Collections.Generic.List<KeyValue>();
 
     [global::ProtoBuf.ProtoContract()]
-    public partial class MessageIdData : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, IsRequired = true)]
-        public ulong LedgerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, IsRequired = true)]
-        public ulong EntryId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"partition")]
-        [global::System.ComponentModel.DefaultValue(-1)]
-        public int Partition
-        {
-            get => __pbn__Partition ?? -1;
-            set => __pbn__Partition = value;
-        }
-        public bool ShouldSerializePartition() => __pbn__Partition != null;
-        public void ResetPartition() => __pbn__Partition = null;
-        private int? __pbn__Partition;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"batch_index")]
-        [global::System.ComponentModel.DefaultValue(-1)]
-        public int BatchIndex
-        {
-            get => __pbn__BatchIndex ?? -1;
-            set => __pbn__BatchIndex = value;
-        }
-        public bool ShouldSerializeBatchIndex() => __pbn__BatchIndex != null;
-        public void ResetBatchIndex() => __pbn__BatchIndex = null;
-        private int? __pbn__BatchIndex;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"ack_set")]
-        public long[] AckSets { get; set; }
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"batch_size")]
-        public int BatchSize
-        {
-            get => __pbn__BatchSize.GetValueOrDefault();
-            set => __pbn__BatchSize = value;
-        }
-        public bool ShouldSerializeBatchSize() => __pbn__BatchSize != null;
-        public void ResetBatchSize() => __pbn__BatchSize = null;
-        private int? __pbn__BatchSize;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class KeyValue : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"key", IsRequired = true)]
-        public string Key { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"value", IsRequired = true)]
-        public string Value { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class KeyLongValue : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"key", IsRequired = true)]
-        public string Key { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"value", IsRequired = true)]
-        public ulong Value { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class IntRange : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"start", IsRequired = true)]
-        public int Start { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"end", IsRequired = true)]
-        public int End { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class EncryptionKeys : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"key", IsRequired = true)]
-        public string Key { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"value", IsRequired = true)]
-        public byte[] Value { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"metadata")]
-        public global::System.Collections.Generic.List<KeyValue> Metadatas { get; } = new global::System.Collections.Generic.List<KeyValue>();
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class MessageMetadata : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"producer_name", IsRequired = true)]
-        public string ProducerName { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"sequence_id", IsRequired = true)]
-        public ulong SequenceId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"publish_time", IsRequired = true)]
-        public ulong PublishTime { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"properties")]
-        public global::System.Collections.Generic.List<KeyValue> Properties { get; } = new global::System.Collections.Generic.List<KeyValue>();
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"replicated_from")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ReplicatedFrom
-        {
-            get => __pbn__ReplicatedFrom ?? "";
-            set => __pbn__ReplicatedFrom = value;
-        }
-        public bool ShouldSerializeReplicatedFrom() => __pbn__ReplicatedFrom != null;
-        public void ResetReplicatedFrom() => __pbn__ReplicatedFrom = null;
-        private string __pbn__ReplicatedFrom;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"partition_key")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string PartitionKey
-        {
-            get => __pbn__PartitionKey ?? "";
-            set => __pbn__PartitionKey = value;
-        }
-        public bool ShouldSerializePartitionKey() => __pbn__PartitionKey != null;
-        public void ResetPartitionKey() => __pbn__PartitionKey = null;
-        private string __pbn__PartitionKey;
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"replicate_to")]
-        public global::System.Collections.Generic.List<string> ReplicateToes { get; } = new global::System.Collections.Generic.List<string>();
-
-        [global::ProtoBuf.ProtoMember(8, Name = @"compression")]
-        [global::System.ComponentModel.DefaultValue(CompressionType.None)]
-        public CompressionType Compression
-        {
-            get => __pbn__Compression ?? CompressionType.None;
-            set => __pbn__Compression = value;
-        }
-        public bool ShouldSerializeCompression() => __pbn__Compression != null;
-        public void ResetCompression() => __pbn__Compression = null;
-        private CompressionType? __pbn__Compression;
-
-        [global::ProtoBuf.ProtoMember(9, Name = @"uncompressed_size")]
-        [global::System.ComponentModel.DefaultValue(0)]
-        public uint UncompressedSize
-        {
-            get => __pbn__UncompressedSize ?? 0;
-            set => __pbn__UncompressedSize = value;
-        }
-        public bool ShouldSerializeUncompressedSize() => __pbn__UncompressedSize != null;
-        public void ResetUncompressedSize() => __pbn__UncompressedSize = null;
-        private uint? __pbn__UncompressedSize;
-
-        [global::ProtoBuf.ProtoMember(11, Name = @"num_messages_in_batch")]
-        [global::System.ComponentModel.DefaultValue(1)]
-        public int NumMessagesInBatch
-        {
-            get => __pbn__NumMessagesInBatch ?? 1;
-            set => __pbn__NumMessagesInBatch = value;
-        }
-        public bool ShouldSerializeNumMessagesInBatch() => __pbn__NumMessagesInBatch != null;
-        public void ResetNumMessagesInBatch() => __pbn__NumMessagesInBatch = null;
-        private int? __pbn__NumMessagesInBatch;
-
-        [global::ProtoBuf.ProtoMember(12, Name = @"event_time")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong EventTime
-        {
-            get => __pbn__EventTime ?? 0;
-            set => __pbn__EventTime = value;
-        }
-        public bool ShouldSerializeEventTime() => __pbn__EventTime != null;
-        public void ResetEventTime() => __pbn__EventTime = null;
-        private ulong? __pbn__EventTime;
-
-        [global::ProtoBuf.ProtoMember(13, Name = @"encryption_keys")]
-        public global::System.Collections.Generic.List<EncryptionKeys> EncryptionKeys { get; } = new global::System.Collections.Generic.List<EncryptionKeys>();
-
-        [global::ProtoBuf.ProtoMember(14, Name = @"encryption_algo")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string EncryptionAlgo
-        {
-            get => __pbn__EncryptionAlgo ?? "";
-            set => __pbn__EncryptionAlgo = value;
-        }
-        public bool ShouldSerializeEncryptionAlgo() => __pbn__EncryptionAlgo != null;
-        public void ResetEncryptionAlgo() => __pbn__EncryptionAlgo = null;
-        private string __pbn__EncryptionAlgo;
-
-        [global::ProtoBuf.ProtoMember(15, Name = @"encryption_param")]
-        public byte[] EncryptionParam
-        {
-            get => __pbn__EncryptionParam;
-            set => __pbn__EncryptionParam = value;
-        }
-        public bool ShouldSerializeEncryptionParam() => __pbn__EncryptionParam != null;
-        public void ResetEncryptionParam() => __pbn__EncryptionParam = null;
-        private byte[] __pbn__EncryptionParam;
-
-        [global::ProtoBuf.ProtoMember(16, Name = @"schema_version")]
-        public byte[] SchemaVersion
-        {
-            get => __pbn__SchemaVersion;
-            set => __pbn__SchemaVersion = value;
-        }
-        public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
-        public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
-        private byte[] __pbn__SchemaVersion;
-
-        [global::ProtoBuf.ProtoMember(17, Name = @"partition_key_b64_encoded")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool PartitionKeyB64Encoded
-        {
-            get => __pbn__PartitionKeyB64Encoded ?? false;
-            set => __pbn__PartitionKeyB64Encoded = value;
-        }
-        public bool ShouldSerializePartitionKeyB64Encoded() => __pbn__PartitionKeyB64Encoded != null;
-        public void ResetPartitionKeyB64Encoded() => __pbn__PartitionKeyB64Encoded = null;
-        private bool? __pbn__PartitionKeyB64Encoded;
-
-        [global::ProtoBuf.ProtoMember(18, Name = @"ordering_key")]
-        public byte[] OrderingKey
-        {
-            get => __pbn__OrderingKey;
-            set => __pbn__OrderingKey = value;
-        }
-        public bool ShouldSerializeOrderingKey() => __pbn__OrderingKey != null;
-        public void ResetOrderingKey() => __pbn__OrderingKey = null;
-        private byte[] __pbn__OrderingKey;
-
-        [global::ProtoBuf.ProtoMember(19, Name = @"deliver_at_time")]
-        public long DeliverAtTime
-        {
-            get => __pbn__DeliverAtTime.GetValueOrDefault();
-            set => __pbn__DeliverAtTime = value;
-        }
-        public bool ShouldSerializeDeliverAtTime() => __pbn__DeliverAtTime != null;
-        public void ResetDeliverAtTime() => __pbn__DeliverAtTime = null;
-        private long? __pbn__DeliverAtTime;
-
-        [global::ProtoBuf.ProtoMember(20, Name = @"marker_type")]
-        public int MarkerType
-        {
-            get => __pbn__MarkerType.GetValueOrDefault();
-            set => __pbn__MarkerType = value;
-        }
-        public bool ShouldSerializeMarkerType() => __pbn__MarkerType != null;
-        public void ResetMarkerType() => __pbn__MarkerType = null;
-        private int? __pbn__MarkerType;
-
-        [global::ProtoBuf.ProtoMember(22, Name = @"txnid_least_bits")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits.GetValueOrDefault();
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(23, Name = @"txnid_most_bits")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits.GetValueOrDefault();
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(24, Name = @"highest_sequence_id")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong HighestSequenceId
-        {
-            get => __pbn__HighestSequenceId ?? 0;
-            set => __pbn__HighestSequenceId = value;
-        }
-        public bool ShouldSerializeHighestSequenceId() => __pbn__HighestSequenceId != null;
-        public void ResetHighestSequenceId() => __pbn__HighestSequenceId = null;
-        private ulong? __pbn__HighestSequenceId;
-
-        [global::ProtoBuf.ProtoMember(25, Name = @"null_value")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool NullValue
-        {
-            get => __pbn__NullValue ?? false;
-            set => __pbn__NullValue = value;
-        }
-        public bool ShouldSerializeNullValue() => __pbn__NullValue != null;
-        public void ResetNullValue() => __pbn__NullValue = null;
-        private bool? __pbn__NullValue;
-
-        [global::ProtoBuf.ProtoMember(26, Name = @"uuid")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Uuid
-        {
-            get => __pbn__Uuid ?? "";
-            set => __pbn__Uuid = value;
-        }
-        public bool ShouldSerializeUuid() => __pbn__Uuid != null;
-        public void ResetUuid() => __pbn__Uuid = null;
-        private string __pbn__Uuid;
-
-        [global::ProtoBuf.ProtoMember(27, Name = @"num_chunks_from_msg")]
-        public int NumChunksFromMsg
-        {
-            get => __pbn__NumChunksFromMsg.GetValueOrDefault();
-            set => __pbn__NumChunksFromMsg = value;
-        }
-        public bool ShouldSerializeNumChunksFromMsg() => __pbn__NumChunksFromMsg != null;
-        public void ResetNumChunksFromMsg() => __pbn__NumChunksFromMsg = null;
-        private int? __pbn__NumChunksFromMsg;
-
-        [global::ProtoBuf.ProtoMember(28, Name = @"total_chunk_msg_size")]
-        public int TotalChunkMsgSize
-        {
-            get => __pbn__TotalChunkMsgSize.GetValueOrDefault();
-            set => __pbn__TotalChunkMsgSize = value;
-        }
-        public bool ShouldSerializeTotalChunkMsgSize() => __pbn__TotalChunkMsgSize != null;
-        public void ResetTotalChunkMsgSize() => __pbn__TotalChunkMsgSize = null;
-        private int? __pbn__TotalChunkMsgSize;
-
-        [global::ProtoBuf.ProtoMember(29, Name = @"chunk_id")]
-        public int ChunkId
-        {
-            get => __pbn__ChunkId.GetValueOrDefault();
-            set => __pbn__ChunkId = value;
-        }
-        public bool ShouldSerializeChunkId() => __pbn__ChunkId != null;
-        public void ResetChunkId() => __pbn__ChunkId = null;
-        private int? __pbn__ChunkId;
-
-        [global::ProtoBuf.ProtoMember(30, Name = @"null_partition_key")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool NullPartitionKey
-        {
-            get => __pbn__NullPartitionKey ?? false;
-            set => __pbn__NullPartitionKey = value;
-        }
-        public bool ShouldSerializeNullPartitionKey() => __pbn__NullPartitionKey != null;
-        public void ResetNullPartitionKey() => __pbn__NullPartitionKey = null;
-        private bool? __pbn__NullPartitionKey;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class SingleMessageMetadata : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"properties")]
-        public global::System.Collections.Generic.List<KeyValue> Properties { get; } = new global::System.Collections.Generic.List<KeyValue>();
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"partition_key")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string PartitionKey
-        {
-            get => __pbn__PartitionKey ?? "";
-            set => __pbn__PartitionKey = value;
-        }
-        public bool ShouldSerializePartitionKey() => __pbn__PartitionKey != null;
-        public void ResetPartitionKey() => __pbn__PartitionKey = null;
-        private string __pbn__PartitionKey;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"payload_size", IsRequired = true)]
-        public int PayloadSize { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"compacted_out")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool CompactedOut
-        {
-            get => __pbn__CompactedOut ?? false;
-            set => __pbn__CompactedOut = value;
-        }
-        public bool ShouldSerializeCompactedOut() => __pbn__CompactedOut != null;
-        public void ResetCompactedOut() => __pbn__CompactedOut = null;
-        private bool? __pbn__CompactedOut;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"event_time")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong EventTime
-        {
-            get => __pbn__EventTime ?? 0;
-            set => __pbn__EventTime = value;
-        }
-        public bool ShouldSerializeEventTime() => __pbn__EventTime != null;
-        public void ResetEventTime() => __pbn__EventTime = null;
-        private ulong? __pbn__EventTime;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"partition_key_b64_encoded")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool PartitionKeyB64Encoded
-        {
-            get => __pbn__PartitionKeyB64Encoded ?? false;
-            set => __pbn__PartitionKeyB64Encoded = value;
-        }
-        public bool ShouldSerializePartitionKeyB64Encoded() => __pbn__PartitionKeyB64Encoded != null;
-        public void ResetPartitionKeyB64Encoded() => __pbn__PartitionKeyB64Encoded = null;
-        private bool? __pbn__PartitionKeyB64Encoded;
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"ordering_key")]
-        public byte[] OrderingKey
-        {
-            get => __pbn__OrderingKey;
-            set => __pbn__OrderingKey = value;
-        }
-        public bool ShouldSerializeOrderingKey() => __pbn__OrderingKey != null;
-        public void ResetOrderingKey() => __pbn__OrderingKey = null;
-        private byte[] __pbn__OrderingKey;
-
-        [global::ProtoBuf.ProtoMember(8, Name = @"sequence_id")]
-        public ulong SequenceId
-        {
-            get => __pbn__SequenceId.GetValueOrDefault();
-            set => __pbn__SequenceId = value;
-        }
-        public bool ShouldSerializeSequenceId() => __pbn__SequenceId != null;
-        public void ResetSequenceId() => __pbn__SequenceId = null;
-        private ulong? __pbn__SequenceId;
-
-        [global::ProtoBuf.ProtoMember(9, Name = @"null_value")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool NullValue
-        {
-            get => __pbn__NullValue ?? false;
-            set => __pbn__NullValue = value;
-        }
-        public bool ShouldSerializeNullValue() => __pbn__NullValue != null;
-        public void ResetNullValue() => __pbn__NullValue = null;
-        private bool? __pbn__NullValue;
-
-        [global::ProtoBuf.ProtoMember(10, Name = @"null_partition_key")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool NullPartitionKey
-        {
-            get => __pbn__NullPartitionKey ?? false;
-            set => __pbn__NullPartitionKey = value;
-        }
-        public bool ShouldSerializeNullPartitionKey() => __pbn__NullPartitionKey != null;
-        public void ResetNullPartitionKey() => __pbn__NullPartitionKey = null;
-        private bool? __pbn__NullPartitionKey;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandConnect : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"client_version", IsRequired = true)]
-        public string ClientVersion { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"auth_method")]
-        [global::System.ComponentModel.DefaultValue(AuthMethod.AuthMethodNone)]
-        public AuthMethod AuthMethod
-        {
-            get => __pbn__AuthMethod ?? AuthMethod.AuthMethodNone;
-            set => __pbn__AuthMethod = value;
-        }
-        public bool ShouldSerializeAuthMethod() => __pbn__AuthMethod != null;
-        public void ResetAuthMethod() => __pbn__AuthMethod = null;
-        private AuthMethod? __pbn__AuthMethod;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"auth_method_name")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string AuthMethodName
-        {
-            get => __pbn__AuthMethodName ?? "";
-            set => __pbn__AuthMethodName = value;
-        }
-        public bool ShouldSerializeAuthMethodName() => __pbn__AuthMethodName != null;
-        public void ResetAuthMethodName() => __pbn__AuthMethodName = null;
-        private string __pbn__AuthMethodName;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"auth_data")]
-        public byte[] AuthData
-        {
-            get => __pbn__AuthData;
-            set => __pbn__AuthData = value;
-        }
-        public bool ShouldSerializeAuthData() => __pbn__AuthData != null;
-        public void ResetAuthData() => __pbn__AuthData = null;
-        private byte[] __pbn__AuthData;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"protocol_version")]
-        [global::System.ComponentModel.DefaultValue(0)]
-        public int ProtocolVersion
-        {
-            get => __pbn__ProtocolVersion ?? 0;
-            set => __pbn__ProtocolVersion = value;
-        }
-        public bool ShouldSerializeProtocolVersion() => __pbn__ProtocolVersion != null;
-        public void ResetProtocolVersion() => __pbn__ProtocolVersion = null;
-        private int? __pbn__ProtocolVersion;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"proxy_to_broker_url")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ProxyToBrokerUrl
-        {
-            get => __pbn__ProxyToBrokerUrl ?? "";
-            set => __pbn__ProxyToBrokerUrl = value;
-        }
-        public bool ShouldSerializeProxyToBrokerUrl() => __pbn__ProxyToBrokerUrl != null;
-        public void ResetProxyToBrokerUrl() => __pbn__ProxyToBrokerUrl = null;
-        private string __pbn__ProxyToBrokerUrl;
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"original_principal")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalPrincipal
-        {
-            get => __pbn__OriginalPrincipal ?? "";
-            set => __pbn__OriginalPrincipal = value;
-        }
-        public bool ShouldSerializeOriginalPrincipal() => __pbn__OriginalPrincipal != null;
-        public void ResetOriginalPrincipal() => __pbn__OriginalPrincipal = null;
-        private string __pbn__OriginalPrincipal;
-
-        [global::ProtoBuf.ProtoMember(8, Name = @"original_auth_data")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalAuthData
-        {
-            get => __pbn__OriginalAuthData ?? "";
-            set => __pbn__OriginalAuthData = value;
-        }
-        public bool ShouldSerializeOriginalAuthData() => __pbn__OriginalAuthData != null;
-        public void ResetOriginalAuthData() => __pbn__OriginalAuthData = null;
-        private string __pbn__OriginalAuthData;
-
-        [global::ProtoBuf.ProtoMember(9, Name = @"original_auth_method")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalAuthMethod
-        {
-            get => __pbn__OriginalAuthMethod ?? "";
-            set => __pbn__OriginalAuthMethod = value;
-        }
-        public bool ShouldSerializeOriginalAuthMethod() => __pbn__OriginalAuthMethod != null;
-        public void ResetOriginalAuthMethod() => __pbn__OriginalAuthMethod = null;
-        private string __pbn__OriginalAuthMethod;
-
-        [global::ProtoBuf.ProtoMember(10, Name = @"feature_flags")]
-        public FeatureFlags FeatureFlags { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class FeatureFlags : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"supports_auth_refresh")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool SupportsAuthRefresh
-        {
-            get => __pbn__SupportsAuthRefresh ?? false;
-            set => __pbn__SupportsAuthRefresh = value;
-        }
-        public bool ShouldSerializeSupportsAuthRefresh() => __pbn__SupportsAuthRefresh != null;
-        public void ResetSupportsAuthRefresh() => __pbn__SupportsAuthRefresh = null;
-        private bool? __pbn__SupportsAuthRefresh;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandConnected : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"server_version", IsRequired = true)]
-        public string ServerVersion { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"protocol_version")]
-        [global::System.ComponentModel.DefaultValue(0)]
-        public int ProtocolVersion
-        {
-            get => __pbn__ProtocolVersion ?? 0;
-            set => __pbn__ProtocolVersion = value;
-        }
-        public bool ShouldSerializeProtocolVersion() => __pbn__ProtocolVersion != null;
-        public void ResetProtocolVersion() => __pbn__ProtocolVersion = null;
-        private int? __pbn__ProtocolVersion;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"max_message_size")]
-        public int MaxMessageSize
-        {
-            get => __pbn__MaxMessageSize.GetValueOrDefault();
-            set => __pbn__MaxMessageSize = value;
-        }
-        public bool ShouldSerializeMaxMessageSize() => __pbn__MaxMessageSize != null;
-        public void ResetMaxMessageSize() => __pbn__MaxMessageSize = null;
-        private int? __pbn__MaxMessageSize;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandAuthResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"client_version")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ClientVersion
-        {
-            get => __pbn__ClientVersion ?? "";
-            set => __pbn__ClientVersion = value;
-        }
-        public bool ShouldSerializeClientVersion() => __pbn__ClientVersion != null;
-        public void ResetClientVersion() => __pbn__ClientVersion = null;
-        private string __pbn__ClientVersion;
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"response")]
-        public AuthData Response { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"protocol_version")]
-        [global::System.ComponentModel.DefaultValue(0)]
-        public int ProtocolVersion
-        {
-            get => __pbn__ProtocolVersion ?? 0;
-            set => __pbn__ProtocolVersion = value;
-        }
-        public bool ShouldSerializeProtocolVersion() => __pbn__ProtocolVersion != null;
-        public void ResetProtocolVersion() => __pbn__ProtocolVersion = null;
-        private int? __pbn__ProtocolVersion;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandAuthChallenge : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"server_version")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ServerVersion
-        {
-            get => __pbn__ServerVersion ?? "";
-            set => __pbn__ServerVersion = value;
-        }
-        public bool ShouldSerializeServerVersion() => __pbn__ServerVersion != null;
-        public void ResetServerVersion() => __pbn__ServerVersion = null;
-        private string __pbn__ServerVersion;
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"challenge")]
-        public AuthData Challenge { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"protocol_version")]
-        [global::System.ComponentModel.DefaultValue(0)]
-        public int ProtocolVersion
-        {
-            get => __pbn__ProtocolVersion ?? 0;
-            set => __pbn__ProtocolVersion = value;
-        }
-        public bool ShouldSerializeProtocolVersion() => __pbn__ProtocolVersion != null;
-        public void ResetProtocolVersion() => __pbn__ProtocolVersion = null;
-        private int? __pbn__ProtocolVersion;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class AuthData : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"auth_method_name")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string AuthMethodName
-        {
-            get => __pbn__AuthMethodName ?? "";
-            set => __pbn__AuthMethodName = value;
-        }
-        public bool ShouldSerializeAuthMethodName() => __pbn__AuthMethodName != null;
-        public void ResetAuthMethodName() => __pbn__AuthMethodName = null;
-        private string __pbn__AuthMethodName;
-
-        [global::ProtoBuf.ProtoMember(2)]
-        public byte[] Data
-        {
-            get => __pbn__auth_data;
-            set => __pbn__auth_data = value;
-        }
-        public bool ShouldSerializeauth_data() => __pbn__auth_data != null;
-        public void Resetauth_data() => __pbn__auth_data = null;
-        private byte[] __pbn__auth_data;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class KeySharedMeta : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, IsRequired = true)]
-        public KeySharedMode KeySharedMode { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3)]
-        public global::System.Collections.Generic.List<IntRange> hashRanges { get; } = new global::System.Collections.Generic.List<IntRange>();
-
-        [global::ProtoBuf.ProtoMember(4)]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool allowOutOfOrderDelivery
-        {
-            get => __pbn__allowOutOfOrderDelivery ?? false;
-            set => __pbn__allowOutOfOrderDelivery = value;
-        }
-        public bool ShouldSerializeallowOutOfOrderDelivery() => __pbn__allowOutOfOrderDelivery != null;
-        public void ResetallowOutOfOrderDelivery() => __pbn__allowOutOfOrderDelivery = null;
-        private bool? __pbn__allowOutOfOrderDelivery;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandSubscribe : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
-        public string Topic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"subscription", IsRequired = true)]
-        public string Subscription { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, IsRequired = true)]
-        public SubType Type { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"consumer_name")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ConsumerName
-        {
-            get => __pbn__ConsumerName ?? "";
-            set => __pbn__ConsumerName = value;
-        }
-        public bool ShouldSerializeConsumerName() => __pbn__ConsumerName != null;
-        public void ResetConsumerName() => __pbn__ConsumerName = null;
-        private string __pbn__ConsumerName;
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"priority_level")]
-        public int PriorityLevel
-        {
-            get => __pbn__PriorityLevel.GetValueOrDefault();
-            set => __pbn__PriorityLevel = value;
-        }
-        public bool ShouldSerializePriorityLevel() => __pbn__PriorityLevel != null;
-        public void ResetPriorityLevel() => __pbn__PriorityLevel = null;
-        private int? __pbn__PriorityLevel;
-
-        [global::ProtoBuf.ProtoMember(8, Name = @"durable")]
-        [global::System.ComponentModel.DefaultValue(true)]
-        public bool Durable
-        {
-            get => __pbn__Durable ?? true;
-            set => __pbn__Durable = value;
-        }
-        public bool ShouldSerializeDurable() => __pbn__Durable != null;
-        public void ResetDurable() => __pbn__Durable = null;
-        private bool? __pbn__Durable;
-
-        [global::ProtoBuf.ProtoMember(9, Name = @"start_message_id")]
-        public MessageIdData StartMessageId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(10, Name = @"metadata")]
-        public global::System.Collections.Generic.List<KeyValue> Metadatas { get; } = new global::System.Collections.Generic.List<KeyValue>();
-
-        [global::ProtoBuf.ProtoMember(11, Name = @"read_compacted")]
-        public bool ReadCompacted
-        {
-            get => __pbn__ReadCompacted.GetValueOrDefault();
-            set => __pbn__ReadCompacted = value;
-        }
-        public bool ShouldSerializeReadCompacted() => __pbn__ReadCompacted != null;
-        public void ResetReadCompacted() => __pbn__ReadCompacted = null;
-        private bool? __pbn__ReadCompacted;
-
-        [global::ProtoBuf.ProtoMember(12, Name = @"schema")]
-        public Schema Schema { get; set; }
-
-        [global::ProtoBuf.ProtoMember(13)]
-        [global::System.ComponentModel.DefaultValue(InitialPositionType.Latest)]
-        public InitialPositionType InitialPosition
-        {
-            get => __pbn__initialPosition ?? InitialPositionType.Latest;
-            set => __pbn__initialPosition = value;
-        }
-        public bool ShouldSerializeinitialPosition() => __pbn__initialPosition != null;
-        public void ResetinitialPosition() => __pbn__initialPosition = null;
-        private InitialPositionType? __pbn__initialPosition;
-
-        [global::ProtoBuf.ProtoMember(14, Name = @"replicate_subscription_state")]
-        public bool ReplicateSubscriptionState
-        {
-            get => __pbn__ReplicateSubscriptionState.GetValueOrDefault();
-            set => __pbn__ReplicateSubscriptionState = value;
-        }
-        public bool ShouldSerializeReplicateSubscriptionState() => __pbn__ReplicateSubscriptionState != null;
-        public void ResetReplicateSubscriptionState() => __pbn__ReplicateSubscriptionState = null;
-        private bool? __pbn__ReplicateSubscriptionState;
-
-        [global::ProtoBuf.ProtoMember(15, Name = @"force_topic_creation")]
-        [global::System.ComponentModel.DefaultValue(true)]
-        public bool ForceTopicCreation
-        {
-            get => __pbn__ForceTopicCreation ?? true;
-            set => __pbn__ForceTopicCreation = value;
-        }
-        public bool ShouldSerializeForceTopicCreation() => __pbn__ForceTopicCreation != null;
-        public void ResetForceTopicCreation() => __pbn__ForceTopicCreation = null;
-        private bool? __pbn__ForceTopicCreation;
-
-        [global::ProtoBuf.ProtoMember(16, Name = @"start_message_rollback_duration_sec")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong StartMessageRollbackDurationSec
-        {
-            get => __pbn__StartMessageRollbackDurationSec ?? 0;
-            set => __pbn__StartMessageRollbackDurationSec = value;
-        }
-        public bool ShouldSerializeStartMessageRollbackDurationSec() => __pbn__StartMessageRollbackDurationSec != null;
-        public void ResetStartMessageRollbackDurationSec() => __pbn__StartMessageRollbackDurationSec = null;
-        private ulong? __pbn__StartMessageRollbackDurationSec;
-
-        [global::ProtoBuf.ProtoMember(17)]
-        public KeySharedMeta KeySharedMeta { get; set; }
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum SubType
-        {
-            Exclusive = 0,
-            Shared = 1,
-            Failover = 2,
-            [global::ProtoBuf.ProtoEnum(Name = @"Key_Shared")]
-            KeyShared = 3,
-        }
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum InitialPositionType
-        {
-            Latest = 0,
-            Earliest = 1,
-        }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandPartitionedTopicMetadata : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
-        public string Topic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"original_principal")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalPrincipal
-        {
-            get => __pbn__OriginalPrincipal ?? "";
-            set => __pbn__OriginalPrincipal = value;
-        }
-        public bool ShouldSerializeOriginalPrincipal() => __pbn__OriginalPrincipal != null;
-        public void ResetOriginalPrincipal() => __pbn__OriginalPrincipal = null;
-        private string __pbn__OriginalPrincipal;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"original_auth_data")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalAuthData
-        {
-            get => __pbn__OriginalAuthData ?? "";
-            set => __pbn__OriginalAuthData = value;
-        }
-        public bool ShouldSerializeOriginalAuthData() => __pbn__OriginalAuthData != null;
-        public void ResetOriginalAuthData() => __pbn__OriginalAuthData = null;
-        private string __pbn__OriginalAuthData;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"original_auth_method")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalAuthMethod
-        {
-            get => __pbn__OriginalAuthMethod ?? "";
-            set => __pbn__OriginalAuthMethod = value;
-        }
-        public bool ShouldSerializeOriginalAuthMethod() => __pbn__OriginalAuthMethod != null;
-        public void ResetOriginalAuthMethod() => __pbn__OriginalAuthMethod = null;
-        private string __pbn__OriginalAuthMethod;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandPartitionedTopicMetadataResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"partitions")]
-        public uint Partitions
-        {
-            get => __pbn__Partitions.GetValueOrDefault();
-            set => __pbn__Partitions = value;
-        }
-        public bool ShouldSerializePartitions() => __pbn__Partitions != null;
-        public void ResetPartitions() => __pbn__Partitions = null;
-        private uint? __pbn__Partitions;
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"response")]
-        [global::System.ComponentModel.DefaultValue(LookupType.Success)]
-        public LookupType Response
-        {
-            get => __pbn__Response ?? LookupType.Success;
-            set => __pbn__Response = value;
-        }
-        public bool ShouldSerializeResponse() => __pbn__Response != null;
-        public void ResetResponse() => __pbn__Response = null;
-        private LookupType? __pbn__Response;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum LookupType
-        {
-            Success = 0,
-            Failed = 1,
-        }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandLookupTopic : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
-        public string Topic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"authoritative")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool Authoritative
-        {
-            get => __pbn__Authoritative ?? false;
-            set => __pbn__Authoritative = value;
-        }
-        public bool ShouldSerializeAuthoritative() => __pbn__Authoritative != null;
-        public void ResetAuthoritative() => __pbn__Authoritative = null;
-        private bool? __pbn__Authoritative;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"original_principal")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalPrincipal
-        {
-            get => __pbn__OriginalPrincipal ?? "";
-            set => __pbn__OriginalPrincipal = value;
-        }
-        public bool ShouldSerializeOriginalPrincipal() => __pbn__OriginalPrincipal != null;
-        public void ResetOriginalPrincipal() => __pbn__OriginalPrincipal = null;
-        private string __pbn__OriginalPrincipal;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"original_auth_data")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalAuthData
-        {
-            get => __pbn__OriginalAuthData ?? "";
-            set => __pbn__OriginalAuthData = value;
-        }
-        public bool ShouldSerializeOriginalAuthData() => __pbn__OriginalAuthData != null;
-        public void ResetOriginalAuthData() => __pbn__OriginalAuthData = null;
-        private string __pbn__OriginalAuthData;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"original_auth_method")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string OriginalAuthMethod
-        {
-            get => __pbn__OriginalAuthMethod ?? "";
-            set => __pbn__OriginalAuthMethod = value;
-        }
-        public bool ShouldSerializeOriginalAuthMethod() => __pbn__OriginalAuthMethod != null;
-        public void ResetOriginalAuthMethod() => __pbn__OriginalAuthMethod = null;
-        private string __pbn__OriginalAuthMethod;
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"advertised_listener_name")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string AdvertisedListenerName
-        {
-            get => __pbn__AdvertisedListenerName ?? "";
-            set => __pbn__AdvertisedListenerName = value;
-        }
-        public bool ShouldSerializeAdvertisedListenerName() => __pbn__AdvertisedListenerName != null;
-        public void ResetAdvertisedListenerName() => __pbn__AdvertisedListenerName = null;
-        private string __pbn__AdvertisedListenerName;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandLookupTopicResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1)]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string BrokerServiceUrl
-        {
-            get => __pbn__brokerServiceUrl ?? "";
-            set => __pbn__brokerServiceUrl = value;
-        }
-        public bool ShouldSerializebrokerServiceUrl() => __pbn__brokerServiceUrl != null;
-        public void ResetbrokerServiceUrl() => __pbn__brokerServiceUrl = null;
-        private string __pbn__brokerServiceUrl;
-
-        [global::ProtoBuf.ProtoMember(2)]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string BrokerServiceUrlTls
-        {
-            get => __pbn__brokerServiceUrlTls ?? "";
-            set => __pbn__brokerServiceUrlTls = value;
-        }
-        public bool ShouldSerializebrokerServiceUrlTls() => __pbn__brokerServiceUrlTls != null;
-        public void ResetbrokerServiceUrlTls() => __pbn__brokerServiceUrlTls = null;
-        private string __pbn__brokerServiceUrlTls;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"response")]
-        [global::System.ComponentModel.DefaultValue(LookupType.Redirect)]
-        public LookupType Response
-        {
-            get => __pbn__Response ?? LookupType.Redirect;
-            set => __pbn__Response = value;
-        }
-        public bool ShouldSerializeResponse() => __pbn__Response != null;
-        public void ResetResponse() => __pbn__Response = null;
-        private LookupType? __pbn__Response;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"authoritative")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool Authoritative
-        {
-            get => __pbn__Authoritative ?? false;
-            set => __pbn__Authoritative = value;
-        }
-        public bool ShouldSerializeAuthoritative() => __pbn__Authoritative != null;
-        public void ResetAuthoritative() => __pbn__Authoritative = null;
-        private bool? __pbn__Authoritative;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-        [global::ProtoBuf.ProtoMember(8, Name = @"proxy_through_service_url")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool ProxyThroughServiceUrl
-        {
-            get => __pbn__ProxyThroughServiceUrl ?? false;
-            set => __pbn__ProxyThroughServiceUrl = value;
-        }
-        public bool ShouldSerializeProxyThroughServiceUrl() => __pbn__ProxyThroughServiceUrl != null;
-        public void ResetProxyThroughServiceUrl() => __pbn__ProxyThroughServiceUrl = null;
-        private bool? __pbn__ProxyThroughServiceUrl;
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum LookupType
-        {
-            Redirect = 0,
-            Connect = 1,
-            Failed = 2,
-        }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandProducer : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
-        public string Topic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"producer_id", IsRequired = true)]
-        public ulong ProducerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"producer_name")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ProducerName
-        {
-            get => __pbn__ProducerName ?? "";
-            set => __pbn__ProducerName = value;
-        }
-        public bool ShouldSerializeProducerName() => __pbn__ProducerName != null;
-        public void ResetProducerName() => __pbn__ProducerName = null;
-        private string __pbn__ProducerName;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"encrypted")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool Encrypted
-        {
-            get => __pbn__Encrypted ?? false;
-            set => __pbn__Encrypted = value;
-        }
-        public bool ShouldSerializeEncrypted() => __pbn__Encrypted != null;
-        public void ResetEncrypted() => __pbn__Encrypted = null;
-        private bool? __pbn__Encrypted;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"metadata")]
-        public global::System.Collections.Generic.List<KeyValue> Metadatas { get; } = new global::System.Collections.Generic.List<KeyValue>();
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"schema")]
-        public Schema Schema { get; set; }
-
-        [global::ProtoBuf.ProtoMember(8, Name = @"epoch")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong Epoch
-        {
-            get => __pbn__Epoch ?? 0;
-            set => __pbn__Epoch = value;
-        }
-        public bool ShouldSerializeEpoch() => __pbn__Epoch != null;
-        public void ResetEpoch() => __pbn__Epoch = null;
-        private ulong? __pbn__Epoch;
-
-        [global::ProtoBuf.ProtoMember(9, Name = @"user_provided_producer_name")]
-        [global::System.ComponentModel.DefaultValue(true)]
-        public bool UserProvidedProducerName
-        {
-            get => __pbn__UserProvidedProducerName ?? true;
-            set => __pbn__UserProvidedProducerName = value;
-        }
-        public bool ShouldSerializeUserProvidedProducerName() => __pbn__UserProvidedProducerName != null;
-        public void ResetUserProvidedProducerName() => __pbn__UserProvidedProducerName = null;
-        private bool? __pbn__UserProvidedProducerName;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandSend : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"producer_id", IsRequired = true)]
-        public ulong ProducerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"sequence_id", IsRequired = true)]
-        public ulong SequenceId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"num_messages")]
-        [global::System.ComponentModel.DefaultValue(1)]
-        public int NumMessages
-        {
-            get => __pbn__NumMessages ?? 1;
-            set => __pbn__NumMessages = value;
-        }
-        public bool ShouldSerializeNumMessages() => __pbn__NumMessages != null;
-        public void ResetNumMessages() => __pbn__NumMessages = null;
-        private int? __pbn__NumMessages;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"highest_sequence_id")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong HighestSequenceId
-        {
-            get => __pbn__HighestSequenceId ?? 0;
-            set => __pbn__HighestSequenceId = value;
-        }
-        public bool ShouldSerializeHighestSequenceId() => __pbn__HighestSequenceId != null;
-        public void ResetHighestSequenceId() => __pbn__HighestSequenceId = null;
-        private ulong? __pbn__HighestSequenceId;
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"is_chunk")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool IsChunk
-        {
-            get => __pbn__IsChunk ?? false;
-            set => __pbn__IsChunk = value;
-        }
-        public bool ShouldSerializeIsChunk() => __pbn__IsChunk != null;
-        public void ResetIsChunk() => __pbn__IsChunk = null;
-        private bool? __pbn__IsChunk;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandSendReceipt : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"producer_id", IsRequired = true)]
-        public ulong ProducerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"sequence_id", IsRequired = true)]
-        public ulong SequenceId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"message_id")]
-        public MessageIdData MessageId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"highest_sequence_id")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong HighestSequenceId
-        {
-            get => __pbn__HighestSequenceId ?? 0;
-            set => __pbn__HighestSequenceId = value;
-        }
-        public bool ShouldSerializeHighestSequenceId() => __pbn__HighestSequenceId != null;
-        public void ResetHighestSequenceId() => __pbn__HighestSequenceId = null;
-        private ulong? __pbn__HighestSequenceId;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandSendError : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"producer_id", IsRequired = true)]
-        public ulong ProducerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"sequence_id", IsRequired = true)]
-        public ulong SequenceId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"error", IsRequired = true)]
-        public ServerError Error { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"message", IsRequired = true)]
-        public string Message { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandMessage : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"message_id", IsRequired = true)]
-        public MessageIdData MessageId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"redelivery_count")]
-        [global::System.ComponentModel.DefaultValue(0)]
-        public uint RedeliveryCount
-        {
-            get => __pbn__RedeliveryCount ?? 0;
-            set => __pbn__RedeliveryCount = value;
-        }
-        public bool ShouldSerializeRedeliveryCount() => __pbn__RedeliveryCount != null;
-        public void ResetRedeliveryCount() => __pbn__RedeliveryCount = null;
-        private uint? __pbn__RedeliveryCount;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"ack_set")]
-        public long[] AckSets { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandAck : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, IsRequired = true)]
-        public AckType Type { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"message_id")]
-        public global::System.Collections.Generic.List<MessageIdData> MessageIds { get; } = new global::System.Collections.Generic.List<MessageIdData>();
-
-        [global::ProtoBuf.ProtoMember(4)]
-        [global::System.ComponentModel.DefaultValue(ValidationErrorType.UncompressedSizeCorruption)]
-        public ValidationErrorType ValidationError
-        {
-            get => __pbn__validation_error ?? ValidationErrorType.UncompressedSizeCorruption;
-            set => __pbn__validation_error = value;
-        }
-        public bool ShouldSerializevalidation_error() => __pbn__validation_error != null;
-        public void Resetvalidation_error() => __pbn__validation_error = null;
-        private ValidationErrorType? __pbn__validation_error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"properties")]
-        public global::System.Collections.Generic.List<KeyLongValue> Properties { get; } = new global::System.Collections.Generic.List<KeyLongValue>();
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(8, Name = @"request_id")]
-        public ulong RequestId
-        {
-            get => __pbn__RequestId.GetValueOrDefault();
-            set => __pbn__RequestId = value;
-        }
-        public bool ShouldSerializeRequestId() => __pbn__RequestId != null;
-        public void ResetRequestId() => __pbn__RequestId = null;
-        private ulong? __pbn__RequestId;
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum AckType
-        {
-            Individual = 0,
-            Cumulative = 1,
-        }
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum ValidationErrorType
-        {
-            UncompressedSizeCorruption = 0,
-            DecompressionError = 1,
-            ChecksumMismatch = 2,
-            BatchDeSerializeError = 3,
-            DecryptionError = 4,
-        }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandAckResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"request_id")]
-        public ulong RequestId
-        {
-            get => __pbn__RequestId.GetValueOrDefault();
-            set => __pbn__RequestId = value;
-        }
-        public bool ShouldSerializeRequestId() => __pbn__RequestId != null;
-        public void ResetRequestId() => __pbn__RequestId = null;
-        private ulong? __pbn__RequestId;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandActiveConsumerChange : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"is_active")]
-        [global::System.ComponentModel.DefaultValue(false)]
-        public bool IsActive
-        {
-            get => __pbn__IsActive ?? false;
-            set => __pbn__IsActive = value;
-        }
-        public bool ShouldSerializeIsActive() => __pbn__IsActive != null;
-        public void ResetIsActive() => __pbn__IsActive = null;
-        private bool? __pbn__IsActive;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandFlow : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, IsRequired = true)]
-        public uint MessagePermits { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandUnsubscribe : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandSeek : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"message_id")]
-        public MessageIdData MessageId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"message_publish_time")]
-        public ulong MessagePublishTime
-        {
-            get => __pbn__MessagePublishTime.GetValueOrDefault();
-            set => __pbn__MessagePublishTime = value;
-        }
-        public bool ShouldSerializeMessagePublishTime() => __pbn__MessagePublishTime != null;
-        public void ResetMessagePublishTime() => __pbn__MessagePublishTime = null;
-        private ulong? __pbn__MessagePublishTime;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandReachedEndOfTopic : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandCloseProducer : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"producer_id", IsRequired = true)]
-        public ulong ProducerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandCloseConsumer : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandRedeliverUnacknowledgedMessages : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"message_ids")]
-        public global::System.Collections.Generic.List<MessageIdData> MessageIds { get; } = new global::System.Collections.Generic.List<MessageIdData>();
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandSuccess : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"schema")]
-        public Schema Schema { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandProducerSuccess : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"producer_name", IsRequired = true)]
-        public string ProducerName { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"last_sequence_id")]
-        [global::System.ComponentModel.DefaultValue(-1)]
-        public long LastSequenceId
-        {
-            get => __pbn__LastSequenceId ?? -1;
-            set => __pbn__LastSequenceId = value;
-        }
-        public bool ShouldSerializeLastSequenceId() => __pbn__LastSequenceId != null;
-        public void ResetLastSequenceId() => __pbn__LastSequenceId = null;
-        private long? __pbn__LastSequenceId;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"schema_version")]
-        public byte[] SchemaVersion
-        {
-            get => __pbn__SchemaVersion;
-            set => __pbn__SchemaVersion = value;
-        }
-        public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
-        public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
-        private byte[] __pbn__SchemaVersion;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandError : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"error", IsRequired = true)]
-        public ServerError Error { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"message", IsRequired = true)]
-        public string Message { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandPing : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandPong : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandConsumerStats : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandConsumerStatsResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"error_code")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError ErrorCode
-        {
-            get => __pbn__ErrorCode ?? ServerError.UnknownError;
-            set => __pbn__ErrorCode = value;
-        }
-        public bool ShouldSerializeErrorCode() => __pbn__ErrorCode != null;
-        public void ResetErrorCode() => __pbn__ErrorCode = null;
-        private ServerError? __pbn__ErrorCode;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"error_message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ErrorMessage
-        {
-            get => __pbn__ErrorMessage ?? "";
-            set => __pbn__ErrorMessage = value;
-        }
-        public bool ShouldSerializeErrorMessage() => __pbn__ErrorMessage != null;
-        public void ResetErrorMessage() => __pbn__ErrorMessage = null;
-        private string __pbn__ErrorMessage;
-
-        [global::ProtoBuf.ProtoMember(4)]
-        public double MsgRateOut
-        {
-            get => __pbn__msgRateOut.GetValueOrDefault();
-            set => __pbn__msgRateOut = value;
-        }
-        public bool ShouldSerializemsgRateOut() => __pbn__msgRateOut != null;
-        public void ResetmsgRateOut() => __pbn__msgRateOut = null;
-        private double? __pbn__msgRateOut;
-
-        [global::ProtoBuf.ProtoMember(5)]
-        public double MsgThroughputOut
-        {
-            get => __pbn__msgThroughputOut.GetValueOrDefault();
-            set => __pbn__msgThroughputOut = value;
-        }
-        public bool ShouldSerializemsgThroughputOut() => __pbn__msgThroughputOut != null;
-        public void ResetmsgThroughputOut() => __pbn__msgThroughputOut = null;
-        private double? __pbn__msgThroughputOut;
-
-        [global::ProtoBuf.ProtoMember(6)]
-        public double MsgRateRedeliver
-        {
-            get => __pbn__msgRateRedeliver.GetValueOrDefault();
-            set => __pbn__msgRateRedeliver = value;
-        }
-        public bool ShouldSerializemsgRateRedeliver() => __pbn__msgRateRedeliver != null;
-        public void ResetmsgRateRedeliver() => __pbn__msgRateRedeliver = null;
-        private double? __pbn__msgRateRedeliver;
-
-        [global::ProtoBuf.ProtoMember(7)]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ConsumerName
-        {
-            get => __pbn__consumerName ?? "";
-            set => __pbn__consumerName = value;
-        }
-        public bool ShouldSerializeconsumerName() => __pbn__consumerName != null;
-        public void ResetconsumerName() => __pbn__consumerName = null;
-        private string __pbn__consumerName;
-
-        [global::ProtoBuf.ProtoMember(8)]
-        public ulong AvailablePermits
-        {
-            get => __pbn__availablePermits.GetValueOrDefault();
-            set => __pbn__availablePermits = value;
-        }
-        public bool ShouldSerializeavailablePermits() => __pbn__availablePermits != null;
-        public void ResetavailablePermits() => __pbn__availablePermits = null;
-        private ulong? __pbn__availablePermits;
-
-        [global::ProtoBuf.ProtoMember(9)]
-        public ulong UnackedMessages
-        {
-            get => __pbn__unackedMessages.GetValueOrDefault();
-            set => __pbn__unackedMessages = value;
-        }
-        public bool ShouldSerializeunackedMessages() => __pbn__unackedMessages != null;
-        public void ResetunackedMessages() => __pbn__unackedMessages = null;
-        private ulong? __pbn__unackedMessages;
-
-        [global::ProtoBuf.ProtoMember(10)]
-        public bool BlockedConsumerOnUnackedMsgs
-        {
-            get => __pbn__blockedConsumerOnUnackedMsgs.GetValueOrDefault();
-            set => __pbn__blockedConsumerOnUnackedMsgs = value;
-        }
-        public bool ShouldSerializeblockedConsumerOnUnackedMsgs() => __pbn__blockedConsumerOnUnackedMsgs != null;
-        public void ResetblockedConsumerOnUnackedMsgs() => __pbn__blockedConsumerOnUnackedMsgs = null;
-        private bool? __pbn__blockedConsumerOnUnackedMsgs;
-
-        [global::ProtoBuf.ProtoMember(11, Name = @"address")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Address
-        {
-            get => __pbn__Address ?? "";
-            set => __pbn__Address = value;
-        }
-        public bool ShouldSerializeAddress() => __pbn__Address != null;
-        public void ResetAddress() => __pbn__Address = null;
-        private string __pbn__Address;
-
-        [global::ProtoBuf.ProtoMember(12)]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ConnectedSince
-        {
-            get => __pbn__connectedSince ?? "";
-            set => __pbn__connectedSince = value;
-        }
-        public bool ShouldSerializeconnectedSince() => __pbn__connectedSince != null;
-        public void ResetconnectedSince() => __pbn__connectedSince = null;
-        private string __pbn__connectedSince;
-
-        [global::ProtoBuf.ProtoMember(13, Name = @"type")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Type
-        {
-            get => __pbn__Type ?? "";
-            set => __pbn__Type = value;
-        }
-        public bool ShouldSerializeType() => __pbn__Type != null;
-        public void ResetType() => __pbn__Type = null;
-        private string __pbn__Type;
-
-        [global::ProtoBuf.ProtoMember(14)]
-        public double MsgRateExpired
-        {
-            get => __pbn__msgRateExpired.GetValueOrDefault();
-            set => __pbn__msgRateExpired = value;
-        }
-        public bool ShouldSerializemsgRateExpired() => __pbn__msgRateExpired != null;
-        public void ResetmsgRateExpired() => __pbn__msgRateExpired = null;
-        private double? __pbn__msgRateExpired;
-
-        [global::ProtoBuf.ProtoMember(15)]
-        public ulong MsgBacklog
-        {
-            get => __pbn__msgBacklog.GetValueOrDefault();
-            set => __pbn__msgBacklog = value;
-        }
-        public bool ShouldSerializemsgBacklog() => __pbn__msgBacklog != null;
-        public void ResetmsgBacklog() => __pbn__msgBacklog = null;
-        private ulong? __pbn__msgBacklog;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandGetLastMessageId : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
-        public ulong ConsumerId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandGetLastMessageIdResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"last_message_id", IsRequired = true)]
-        public MessageIdData LastMessageId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandGetTopicsOfNamespace : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"namespace", IsRequired = true)]
-        public string Namespace { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3)]
-        [global::System.ComponentModel.DefaultValue(ModeType.Persistent)]
-        public ModeType Mode
-        {
-            get => __pbn__mode ?? ModeType.Persistent;
-            set => __pbn__mode = value;
-        }
-        public bool ShouldSerializemode() => __pbn__mode != null;
-        public void Resetmode() => __pbn__mode = null;
-        private ModeType? __pbn__mode;
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum ModeType
-        {
-            [global::ProtoBuf.ProtoEnum(Name = @"PERSISTENT")]
-            Persistent = 0,
-            [global::ProtoBuf.ProtoEnum(Name = @"NON_PERSISTENT")]
-            NonPersistent = 1,
-            [global::ProtoBuf.ProtoEnum(Name = @"ALL")]
-            All = 2,
-        }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandGetTopicsOfNamespaceResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"topics")]
-        public global::System.Collections.Generic.List<string> Topics { get; } = new global::System.Collections.Generic.List<string>();
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandGetSchema : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"topic", IsRequired = true)]
-        public string Topic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"schema_version")]
-        public byte[] SchemaVersion
-        {
-            get => __pbn__SchemaVersion;
-            set => __pbn__SchemaVersion = value;
-        }
-        public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
-        public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
-        private byte[] __pbn__SchemaVersion;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandGetSchemaResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"error_code")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError ErrorCode
-        {
-            get => __pbn__ErrorCode ?? ServerError.UnknownError;
-            set => __pbn__ErrorCode = value;
-        }
-        public bool ShouldSerializeErrorCode() => __pbn__ErrorCode != null;
-        public void ResetErrorCode() => __pbn__ErrorCode = null;
-        private ServerError? __pbn__ErrorCode;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"error_message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ErrorMessage
-        {
-            get => __pbn__ErrorMessage ?? "";
-            set => __pbn__ErrorMessage = value;
-        }
-        public bool ShouldSerializeErrorMessage() => __pbn__ErrorMessage != null;
-        public void ResetErrorMessage() => __pbn__ErrorMessage = null;
-        private string __pbn__ErrorMessage;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"schema")]
-        public Schema Schema { get; set; }
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"schema_version")]
-        public byte[] SchemaVersion
-        {
-            get => __pbn__SchemaVersion;
-            set => __pbn__SchemaVersion = value;
-        }
-        public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
-        public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
-        private byte[] __pbn__SchemaVersion;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandGetOrCreateSchema : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"topic", IsRequired = true)]
-        public string Topic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"schema", IsRequired = true)]
-        public Schema Schema { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandGetOrCreateSchemaResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"error_code")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError ErrorCode
-        {
-            get => __pbn__ErrorCode ?? ServerError.UnknownError;
-            set => __pbn__ErrorCode = value;
-        }
-        public bool ShouldSerializeErrorCode() => __pbn__ErrorCode != null;
-        public void ResetErrorCode() => __pbn__ErrorCode = null;
-        private ServerError? __pbn__ErrorCode;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"error_message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string ErrorMessage
-        {
-            get => __pbn__ErrorMessage ?? "";
-            set => __pbn__ErrorMessage = value;
-        }
-        public bool ShouldSerializeErrorMessage() => __pbn__ErrorMessage != null;
-        public void ResetErrorMessage() => __pbn__ErrorMessage = null;
-        private string __pbn__ErrorMessage;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"schema_version")]
-        public byte[] SchemaVersion
-        {
-            get => __pbn__SchemaVersion;
-            set => __pbn__SchemaVersion = value;
-        }
-        public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
-        public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
-        private byte[] __pbn__SchemaVersion;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandNewTxn : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txn_ttl_seconds")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnTtlSeconds
-        {
-            get => __pbn__TxnTtlSeconds ?? 0;
-            set => __pbn__TxnTtlSeconds = value;
-        }
-        public bool ShouldSerializeTxnTtlSeconds() => __pbn__TxnTtlSeconds != null;
-        public void ResetTxnTtlSeconds() => __pbn__TxnTtlSeconds = null;
-        private ulong? __pbn__TxnTtlSeconds;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"tc_id")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TcId
-        {
-            get => __pbn__TcId ?? 0;
-            set => __pbn__TcId = value;
-        }
-        public bool ShouldSerializeTcId() => __pbn__TcId != null;
-        public void ResetTcId() => __pbn__TcId = null;
-        private ulong? __pbn__TcId;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandNewTxnResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandAddPartitionToTxn : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"partitions")]
-        public global::System.Collections.Generic.List<string> Partitions { get; } = new global::System.Collections.Generic.List<string>();
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandAddPartitionToTxnResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class Subscription : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
-        public string Topic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, IsRequired = true)]
-        public string SubscriptionName { get; set; }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandAddSubscriptionToTxn : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"subscription")]
-        public global::System.Collections.Generic.List<Subscription> Subscriptions { get; } = new global::System.Collections.Generic.List<Subscription>();
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandAddSubscriptionToTxnResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandEndTxn : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"txn_action")]
-        [global::System.ComponentModel.DefaultValue(TxnAction.Commit)]
-        public TxnAction TxnAction
-        {
-            get => __pbn__TxnAction ?? TxnAction.Commit;
-            set => __pbn__TxnAction = value;
-        }
-        public bool ShouldSerializeTxnAction() => __pbn__TxnAction != null;
-        public void ResetTxnAction() => __pbn__TxnAction = null;
-        private TxnAction? __pbn__TxnAction;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message_id")]
-        public global::System.Collections.Generic.List<MessageIdData> MessageIds { get; } = new global::System.Collections.Generic.List<MessageIdData>();
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandEndTxnResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandEndTxnOnPartition : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"topic")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Topic
-        {
-            get => __pbn__Topic ?? "";
-            set => __pbn__Topic = value;
-        }
-        public bool ShouldSerializeTopic() => __pbn__Topic != null;
-        public void ResetTopic() => __pbn__Topic = null;
-        private string __pbn__Topic;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"txn_action")]
-        [global::System.ComponentModel.DefaultValue(TxnAction.Commit)]
-        public TxnAction TxnAction
-        {
-            get => __pbn__TxnAction ?? TxnAction.Commit;
-            set => __pbn__TxnAction = value;
-        }
-        public bool ShouldSerializeTxnAction() => __pbn__TxnAction != null;
-        public void ResetTxnAction() => __pbn__TxnAction = null;
-        private TxnAction? __pbn__TxnAction;
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"message_id")]
-        public global::System.Collections.Generic.List<MessageIdData> MessageIds { get; } = new global::System.Collections.Generic.List<MessageIdData>();
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandEndTxnOnPartitionResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandEndTxnOnSubscription : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"subscription")]
-        public Subscription Subscription { get; set; }
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"txn_action")]
-        [global::System.ComponentModel.DefaultValue(TxnAction.Commit)]
-        public TxnAction TxnAction
-        {
-            get => __pbn__TxnAction ?? TxnAction.Commit;
-            set => __pbn__TxnAction = value;
-        }
-        public bool ShouldSerializeTxnAction() => __pbn__TxnAction != null;
-        public void ResetTxnAction() => __pbn__TxnAction = null;
-        private TxnAction? __pbn__TxnAction;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class CommandEndTxnOnSubscriptionResponse : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
-        public ulong RequestId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidLeastBits
-        {
-            get => __pbn__TxnidLeastBits ?? 0;
-            set => __pbn__TxnidLeastBits = value;
-        }
-        public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
-        public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
-        private ulong? __pbn__TxnidLeastBits;
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
-        [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
-        public ulong TxnidMostBits
-        {
-            get => __pbn__TxnidMostBits ?? 0;
-            set => __pbn__TxnidMostBits = value;
-        }
-        public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
-        public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
-        private ulong? __pbn__TxnidMostBits;
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"error")]
-        [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
-        public ServerError Error
-        {
-            get => __pbn__Error ?? ServerError.UnknownError;
-            set => __pbn__Error = value;
-        }
-        public bool ShouldSerializeError() => __pbn__Error != null;
-        public void ResetError() => __pbn__Error = null;
-        private ServerError? __pbn__Error;
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"message")]
-        [global::System.ComponentModel.DefaultValue("")]
-        public string Message
-        {
-            get => __pbn__Message ?? "";
-            set => __pbn__Message = value;
-        }
-        public bool ShouldSerializeMessage() => __pbn__Message != null;
-        public void ResetMessage() => __pbn__Message = null;
-        private string __pbn__Message;
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public partial class BaseCommand : global::ProtoBuf.IExtensible
-    {
-        private global::ProtoBuf.IExtension __pbn__extensionData;
-        global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
-            => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
-
-        [global::ProtoBuf.ProtoMember(1, IsRequired = true)]
-        public Type CommandType { get; set; } = Type.Connect;
-
-        [global::ProtoBuf.ProtoMember(2, Name = @"connect")]
-        public CommandConnect Connect { get; set; }
-
-        [global::ProtoBuf.ProtoMember(3, Name = @"connected")]
-        public CommandConnected Connected { get; set; }
-
-        [global::ProtoBuf.ProtoMember(4, Name = @"subscribe")]
-        public CommandSubscribe Subscribe { get; set; }
-
-        [global::ProtoBuf.ProtoMember(5, Name = @"producer")]
-        public CommandProducer Producer { get; set; }
-
-        [global::ProtoBuf.ProtoMember(6, Name = @"send")]
-        public CommandSend Send { get; set; }
-
-        [global::ProtoBuf.ProtoMember(7, Name = @"send_receipt")]
-        public CommandSendReceipt SendReceipt { get; set; }
-
-        [global::ProtoBuf.ProtoMember(8, Name = @"send_error")]
-        public CommandSendError SendError { get; set; }
-
-        [global::ProtoBuf.ProtoMember(9, Name = @"message")]
-        public CommandMessage Message { get; set; }
-
-        [global::ProtoBuf.ProtoMember(10, Name = @"ack")]
-        public CommandAck Ack { get; set; }
-
-        [global::ProtoBuf.ProtoMember(11, Name = @"flow")]
-        public CommandFlow Flow { get; set; }
-
-        [global::ProtoBuf.ProtoMember(12, Name = @"unsubscribe")]
-        public CommandUnsubscribe Unsubscribe { get; set; }
-
-        [global::ProtoBuf.ProtoMember(13, Name = @"success")]
-        public CommandSuccess Success { get; set; }
-
-        [global::ProtoBuf.ProtoMember(14, Name = @"error")]
-        public CommandError Error { get; set; }
-
-        [global::ProtoBuf.ProtoMember(15, Name = @"close_producer")]
-        public CommandCloseProducer CloseProducer { get; set; }
-
-        [global::ProtoBuf.ProtoMember(16, Name = @"close_consumer")]
-        public CommandCloseConsumer CloseConsumer { get; set; }
-
-        [global::ProtoBuf.ProtoMember(17, Name = @"producer_success")]
-        public CommandProducerSuccess ProducerSuccess { get; set; }
-
-        [global::ProtoBuf.ProtoMember(18, Name = @"ping")]
-        public CommandPing Ping { get; set; }
-
-        [global::ProtoBuf.ProtoMember(19, Name = @"pong")]
-        public CommandPong Pong { get; set; }
-
-        [global::ProtoBuf.ProtoMember(20)]
-        public CommandRedeliverUnacknowledgedMessages RedeliverUnacknowledgedMessages { get; set; }
-
-        [global::ProtoBuf.ProtoMember(21)]
-        public CommandPartitionedTopicMetadata PartitionMetadata { get; set; }
-
-        [global::ProtoBuf.ProtoMember(22)]
-        public CommandPartitionedTopicMetadataResponse PartitionMetadataResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(23)]
-        public CommandLookupTopic LookupTopic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(24)]
-        public CommandLookupTopicResponse LookupTopicResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(25)]
-        public CommandConsumerStats ConsumerStats { get; set; }
-
-        [global::ProtoBuf.ProtoMember(26)]
-        public CommandConsumerStatsResponse ConsumerStatsResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(27)]
-        public CommandReachedEndOfTopic ReachedEndOfTopic { get; set; }
-
-        [global::ProtoBuf.ProtoMember(28, Name = @"seek")]
-        public CommandSeek Seek { get; set; }
-
-        [global::ProtoBuf.ProtoMember(29)]
-        public CommandGetLastMessageId GetLastMessageId { get; set; }
-
-        [global::ProtoBuf.ProtoMember(30)]
-        public CommandGetLastMessageIdResponse GetLastMessageIdResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(31, Name = @"active_consumer_change")]
-        public CommandActiveConsumerChange ActiveConsumerChange { get; set; }
-
-        [global::ProtoBuf.ProtoMember(32)]
-        public CommandGetTopicsOfNamespace GetTopicsOfNamespace { get; set; }
-
-        [global::ProtoBuf.ProtoMember(33)]
-        public CommandGetTopicsOfNamespaceResponse GetTopicsOfNamespaceResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(34)]
-        public CommandGetSchema GetSchema { get; set; }
-
-        [global::ProtoBuf.ProtoMember(35)]
-        public CommandGetSchemaResponse GetSchemaResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(36)]
-        public CommandAuthChallenge AuthChallenge { get; set; }
-
-        [global::ProtoBuf.ProtoMember(37)]
-        public CommandAuthResponse AuthResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(38)]
-        public CommandAckResponse AckResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(39)]
-        public CommandGetOrCreateSchema GetOrCreateSchema { get; set; }
-
-        [global::ProtoBuf.ProtoMember(40)]
-        public CommandGetOrCreateSchemaResponse GetOrCreateSchemaResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(50)]
-        public CommandNewTxn NewTxn { get; set; }
-
-        [global::ProtoBuf.ProtoMember(51)]
-        public CommandNewTxnResponse NewTxnResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(52)]
-        public CommandAddPartitionToTxn AddPartitionToTxn { get; set; }
-
-        [global::ProtoBuf.ProtoMember(53)]
-        public CommandAddPartitionToTxnResponse AddPartitionToTxnResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(54)]
-        public CommandAddSubscriptionToTxn AddSubscriptionToTxn { get; set; }
-
-        [global::ProtoBuf.ProtoMember(55)]
-        public CommandAddSubscriptionToTxnResponse AddSubscriptionToTxnResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(56)]
-        public CommandEndTxn EndTxn { get; set; }
-
-        [global::ProtoBuf.ProtoMember(57)]
-        public CommandEndTxnResponse EndTxnResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(58)]
-        public CommandEndTxnOnPartition EndTxnOnPartition { get; set; }
-
-        [global::ProtoBuf.ProtoMember(59)]
-        public CommandEndTxnOnPartitionResponse EndTxnOnPartitionResponse { get; set; }
-
-        [global::ProtoBuf.ProtoMember(60)]
-        public CommandEndTxnOnSubscription EndTxnOnSubscription { get; set; }
-
-        [global::ProtoBuf.ProtoMember(61)]
-        public CommandEndTxnOnSubscriptionResponse EndTxnOnSubscriptionResponse { get; set; }
-
-        [global::ProtoBuf.ProtoContract()]
-        public enum Type
-        {
-            [global::ProtoBuf.ProtoEnum(Name = @"CONNECT")]
-            Connect = 2,
-            [global::ProtoBuf.ProtoEnum(Name = @"CONNECTED")]
-            Connected = 3,
-            [global::ProtoBuf.ProtoEnum(Name = @"SUBSCRIBE")]
-            Subscribe = 4,
-            [global::ProtoBuf.ProtoEnum(Name = @"PRODUCER")]
-            Producer = 5,
-            [global::ProtoBuf.ProtoEnum(Name = @"SEND")]
-            Send = 6,
-            [global::ProtoBuf.ProtoEnum(Name = @"SEND_RECEIPT")]
-            SendReceipt = 7,
-            [global::ProtoBuf.ProtoEnum(Name = @"SEND_ERROR")]
-            SendError = 8,
-            [global::ProtoBuf.ProtoEnum(Name = @"MESSAGE")]
-            Message = 9,
-            [global::ProtoBuf.ProtoEnum(Name = @"ACK")]
-            Ack = 10,
-            [global::ProtoBuf.ProtoEnum(Name = @"FLOW")]
-            Flow = 11,
-            [global::ProtoBuf.ProtoEnum(Name = @"UNSUBSCRIBE")]
-            Unsubscribe = 12,
-            [global::ProtoBuf.ProtoEnum(Name = @"SUCCESS")]
-            Success = 13,
-            [global::ProtoBuf.ProtoEnum(Name = @"ERROR")]
-            Error = 14,
-            [global::ProtoBuf.ProtoEnum(Name = @"CLOSE_PRODUCER")]
-            CloseProducer = 15,
-            [global::ProtoBuf.ProtoEnum(Name = @"CLOSE_CONSUMER")]
-            CloseConsumer = 16,
-            [global::ProtoBuf.ProtoEnum(Name = @"PRODUCER_SUCCESS")]
-            ProducerSuccess = 17,
-            [global::ProtoBuf.ProtoEnum(Name = @"PING")]
-            Ping = 18,
-            [global::ProtoBuf.ProtoEnum(Name = @"PONG")]
-            Pong = 19,
-            [global::ProtoBuf.ProtoEnum(Name = @"REDELIVER_UNACKNOWLEDGED_MESSAGES")]
-            RedeliverUnacknowledgedMessages = 20,
-            [global::ProtoBuf.ProtoEnum(Name = @"PARTITIONED_METADATA")]
-            PartitionedMetadata = 21,
-            [global::ProtoBuf.ProtoEnum(Name = @"PARTITIONED_METADATA_RESPONSE")]
-            PartitionedMetadataResponse = 22,
-            [global::ProtoBuf.ProtoEnum(Name = @"LOOKUP")]
-            Lookup = 23,
-            [global::ProtoBuf.ProtoEnum(Name = @"LOOKUP_RESPONSE")]
-            LookupResponse = 24,
-            [global::ProtoBuf.ProtoEnum(Name = @"CONSUMER_STATS")]
-            ConsumerStats = 25,
-            [global::ProtoBuf.ProtoEnum(Name = @"CONSUMER_STATS_RESPONSE")]
-            ConsumerStatsResponse = 26,
-            [global::ProtoBuf.ProtoEnum(Name = @"REACHED_END_OF_TOPIC")]
-            ReachedEndOfTopic = 27,
-            [global::ProtoBuf.ProtoEnum(Name = @"SEEK")]
-            Seek = 28,
-            [global::ProtoBuf.ProtoEnum(Name = @"GET_LAST_MESSAGE_ID")]
-            GetLastMessageId = 29,
-            [global::ProtoBuf.ProtoEnum(Name = @"GET_LAST_MESSAGE_ID_RESPONSE")]
-            GetLastMessageIdResponse = 30,
-            [global::ProtoBuf.ProtoEnum(Name = @"ACTIVE_CONSUMER_CHANGE")]
-            ActiveConsumerChange = 31,
-            [global::ProtoBuf.ProtoEnum(Name = @"GET_TOPICS_OF_NAMESPACE")]
-            GetTopicsOfNamespace = 32,
-            [global::ProtoBuf.ProtoEnum(Name = @"GET_TOPICS_OF_NAMESPACE_RESPONSE")]
-            GetTopicsOfNamespaceResponse = 33,
-            [global::ProtoBuf.ProtoEnum(Name = @"GET_SCHEMA")]
-            GetSchema = 34,
-            [global::ProtoBuf.ProtoEnum(Name = @"GET_SCHEMA_RESPONSE")]
-            GetSchemaResponse = 35,
-            [global::ProtoBuf.ProtoEnum(Name = @"AUTH_CHALLENGE")]
-            AuthChallenge = 36,
-            [global::ProtoBuf.ProtoEnum(Name = @"AUTH_RESPONSE")]
-            AuthResponse = 37,
-            [global::ProtoBuf.ProtoEnum(Name = @"ACK_RESPONSE")]
-            AckResponse = 38,
-            [global::ProtoBuf.ProtoEnum(Name = @"GET_OR_CREATE_SCHEMA")]
-            GetOrCreateSchema = 39,
-            [global::ProtoBuf.ProtoEnum(Name = @"GET_OR_CREATE_SCHEMA_RESPONSE")]
-            GetOrCreateSchemaResponse = 40,
-            [global::ProtoBuf.ProtoEnum(Name = @"NEW_TXN")]
-            NewTxn = 50,
-            [global::ProtoBuf.ProtoEnum(Name = @"NEW_TXN_RESPONSE")]
-            NewTxnResponse = 51,
-            [global::ProtoBuf.ProtoEnum(Name = @"ADD_PARTITION_TO_TXN")]
-            AddPartitionToTxn = 52,
-            [global::ProtoBuf.ProtoEnum(Name = @"ADD_PARTITION_TO_TXN_RESPONSE")]
-            AddPartitionToTxnResponse = 53,
-            [global::ProtoBuf.ProtoEnum(Name = @"ADD_SUBSCRIPTION_TO_TXN")]
-            AddSubscriptionToTxn = 54,
-            [global::ProtoBuf.ProtoEnum(Name = @"ADD_SUBSCRIPTION_TO_TXN_RESPONSE")]
-            AddSubscriptionToTxnResponse = 55,
-            [global::ProtoBuf.ProtoEnum(Name = @"END_TXN")]
-            EndTxn = 56,
-            [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_RESPONSE")]
-            EndTxnResponse = 57,
-            [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_ON_PARTITION")]
-            EndTxnOnPartition = 58,
-            [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_ON_PARTITION_RESPONSE")]
-            EndTxnOnPartitionResponse = 59,
-            [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_ON_SUBSCRIPTION")]
-            EndTxnOnSubscription = 60,
-            [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_ON_SUBSCRIPTION_RESPONSE")]
-            EndTxnOnSubscriptionResponse = 61,
-        }
-
-    }
-
-    [global::ProtoBuf.ProtoContract()]
-    public enum CompressionType
+    public enum SchemaType
     {
-        [global::ProtoBuf.ProtoEnum(Name = @"NONE")]
         None = 0,
-        [global::ProtoBuf.ProtoEnum(Name = @"LZ4")]
-        Lz4 = 1,
-        [global::ProtoBuf.ProtoEnum(Name = @"ZLIB")]
-        Zlib = 2,
-        [global::ProtoBuf.ProtoEnum(Name = @"ZSTD")]
-        Zstd = 3,
-        [global::ProtoBuf.ProtoEnum(Name = @"SNAPPY")]
-        Snappy = 4,
+        String = 1,
+        Json = 2,
+        Protobuf = 3,
+        Avro = 4,
+        Bool = 5,
+        Int8 = 6,
+        Int16 = 7,
+        Int32 = 8,
+        Int64 = 9,
+        Float = 10,
+        Double = 11,
+        Date = 12,
+        Time = 13,
+        Timestamp = 14,
+        KeyValue = 15,
+        Instant = 16,
+        LocalDate = 17,
+        LocalTime = 18,
+        LocalDateTime = 19,
+        ProtobufNative = 20,
+    }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class MessageIdData : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, IsRequired = true)]
+    public ulong LedgerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, IsRequired = true)]
+    public ulong EntryId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"partition")]
+    [global::System.ComponentModel.DefaultValue(-1)]
+    public int Partition
+    {
+        get => __pbn__Partition ?? -1;
+        set => __pbn__Partition = value;
+    }
+    public bool ShouldSerializePartition() => __pbn__Partition != null;
+    public void ResetPartition() => __pbn__Partition = null;
+    private int? __pbn__Partition;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"batch_index")]
+    [global::System.ComponentModel.DefaultValue(-1)]
+    public int BatchIndex
+    {
+        get => __pbn__BatchIndex ?? -1;
+        set => __pbn__BatchIndex = value;
+    }
+    public bool ShouldSerializeBatchIndex() => __pbn__BatchIndex != null;
+    public void ResetBatchIndex() => __pbn__BatchIndex = null;
+    private int? __pbn__BatchIndex;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"ack_set")]
+    public long[] AckSets { get; set; }
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"batch_size")]
+    public int BatchSize
+    {
+        get => __pbn__BatchSize.GetValueOrDefault();
+        set => __pbn__BatchSize = value;
+    }
+    public bool ShouldSerializeBatchSize() => __pbn__BatchSize != null;
+    public void ResetBatchSize() => __pbn__BatchSize = null;
+    private int? __pbn__BatchSize;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class KeyValue : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"key", IsRequired = true)]
+    public string Key { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"value", IsRequired = true)]
+    public string Value { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class KeyLongValue : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"key", IsRequired = true)]
+    public string Key { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"value", IsRequired = true)]
+    public ulong Value { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class IntRange : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"start", IsRequired = true)]
+    public int Start { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"end", IsRequired = true)]
+    public int End { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class EncryptionKeys : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"key", IsRequired = true)]
+    public string Key { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"value", IsRequired = true)]
+    public byte[] Value { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"metadata")]
+    public global::System.Collections.Generic.List<KeyValue> Metadatas { get; } = new global::System.Collections.Generic.List<KeyValue>();
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class MessageMetadata : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"producer_name", IsRequired = true)]
+    public string ProducerName { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"sequence_id", IsRequired = true)]
+    public ulong SequenceId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"publish_time", IsRequired = true)]
+    public ulong PublishTime { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"properties")]
+    public global::System.Collections.Generic.List<KeyValue> Properties { get; } = new global::System.Collections.Generic.List<KeyValue>();
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"replicated_from")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ReplicatedFrom
+    {
+        get => __pbn__ReplicatedFrom ?? "";
+        set => __pbn__ReplicatedFrom = value;
+    }
+    public bool ShouldSerializeReplicatedFrom() => __pbn__ReplicatedFrom != null;
+    public void ResetReplicatedFrom() => __pbn__ReplicatedFrom = null;
+    private string __pbn__ReplicatedFrom;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"partition_key")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string PartitionKey
+    {
+        get => __pbn__PartitionKey ?? "";
+        set => __pbn__PartitionKey = value;
+    }
+    public bool ShouldSerializePartitionKey() => __pbn__PartitionKey != null;
+    public void ResetPartitionKey() => __pbn__PartitionKey = null;
+    private string __pbn__PartitionKey;
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"replicate_to")]
+    public global::System.Collections.Generic.List<string> ReplicateToes { get; } = new global::System.Collections.Generic.List<string>();
+
+    [global::ProtoBuf.ProtoMember(8, Name = @"compression")]
+    [global::System.ComponentModel.DefaultValue(CompressionType.None)]
+    public CompressionType Compression
+    {
+        get => __pbn__Compression ?? CompressionType.None;
+        set => __pbn__Compression = value;
+    }
+    public bool ShouldSerializeCompression() => __pbn__Compression != null;
+    public void ResetCompression() => __pbn__Compression = null;
+    private CompressionType? __pbn__Compression;
+
+    [global::ProtoBuf.ProtoMember(9, Name = @"uncompressed_size")]
+    [global::System.ComponentModel.DefaultValue(0)]
+    public uint UncompressedSize
+    {
+        get => __pbn__UncompressedSize ?? 0;
+        set => __pbn__UncompressedSize = value;
+    }
+    public bool ShouldSerializeUncompressedSize() => __pbn__UncompressedSize != null;
+    public void ResetUncompressedSize() => __pbn__UncompressedSize = null;
+    private uint? __pbn__UncompressedSize;
+
+    [global::ProtoBuf.ProtoMember(11, Name = @"num_messages_in_batch")]
+    [global::System.ComponentModel.DefaultValue(1)]
+    public int NumMessagesInBatch
+    {
+        get => __pbn__NumMessagesInBatch ?? 1;
+        set => __pbn__NumMessagesInBatch = value;
+    }
+    public bool ShouldSerializeNumMessagesInBatch() => __pbn__NumMessagesInBatch != null;
+    public void ResetNumMessagesInBatch() => __pbn__NumMessagesInBatch = null;
+    private int? __pbn__NumMessagesInBatch;
+
+    [global::ProtoBuf.ProtoMember(12, Name = @"event_time")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong EventTime
+    {
+        get => __pbn__EventTime ?? 0;
+        set => __pbn__EventTime = value;
+    }
+    public bool ShouldSerializeEventTime() => __pbn__EventTime != null;
+    public void ResetEventTime() => __pbn__EventTime = null;
+    private ulong? __pbn__EventTime;
+
+    [global::ProtoBuf.ProtoMember(13, Name = @"encryption_keys")]
+    public global::System.Collections.Generic.List<EncryptionKeys> EncryptionKeys { get; } = new global::System.Collections.Generic.List<EncryptionKeys>();
+
+    [global::ProtoBuf.ProtoMember(14, Name = @"encryption_algo")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string EncryptionAlgo
+    {
+        get => __pbn__EncryptionAlgo ?? "";
+        set => __pbn__EncryptionAlgo = value;
+    }
+    public bool ShouldSerializeEncryptionAlgo() => __pbn__EncryptionAlgo != null;
+    public void ResetEncryptionAlgo() => __pbn__EncryptionAlgo = null;
+    private string __pbn__EncryptionAlgo;
+
+    [global::ProtoBuf.ProtoMember(15, Name = @"encryption_param")]
+    public byte[] EncryptionParam
+    {
+        get => __pbn__EncryptionParam;
+        set => __pbn__EncryptionParam = value;
+    }
+    public bool ShouldSerializeEncryptionParam() => __pbn__EncryptionParam != null;
+    public void ResetEncryptionParam() => __pbn__EncryptionParam = null;
+    private byte[] __pbn__EncryptionParam;
+
+    [global::ProtoBuf.ProtoMember(16, Name = @"schema_version")]
+    public byte[] SchemaVersion
+    {
+        get => __pbn__SchemaVersion;
+        set => __pbn__SchemaVersion = value;
+    }
+    public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
+    public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
+    private byte[] __pbn__SchemaVersion;
+
+    [global::ProtoBuf.ProtoMember(17, Name = @"partition_key_b64_encoded")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool PartitionKeyB64Encoded
+    {
+        get => __pbn__PartitionKeyB64Encoded ?? false;
+        set => __pbn__PartitionKeyB64Encoded = value;
+    }
+    public bool ShouldSerializePartitionKeyB64Encoded() => __pbn__PartitionKeyB64Encoded != null;
+    public void ResetPartitionKeyB64Encoded() => __pbn__PartitionKeyB64Encoded = null;
+    private bool? __pbn__PartitionKeyB64Encoded;
+
+    [global::ProtoBuf.ProtoMember(18, Name = @"ordering_key")]
+    public byte[] OrderingKey
+    {
+        get => __pbn__OrderingKey;
+        set => __pbn__OrderingKey = value;
+    }
+    public bool ShouldSerializeOrderingKey() => __pbn__OrderingKey != null;
+    public void ResetOrderingKey() => __pbn__OrderingKey = null;
+    private byte[] __pbn__OrderingKey;
+
+    [global::ProtoBuf.ProtoMember(19, Name = @"deliver_at_time")]
+    public long DeliverAtTime
+    {
+        get => __pbn__DeliverAtTime.GetValueOrDefault();
+        set => __pbn__DeliverAtTime = value;
+    }
+    public bool ShouldSerializeDeliverAtTime() => __pbn__DeliverAtTime != null;
+    public void ResetDeliverAtTime() => __pbn__DeliverAtTime = null;
+    private long? __pbn__DeliverAtTime;
+
+    [global::ProtoBuf.ProtoMember(20, Name = @"marker_type")]
+    public int MarkerType
+    {
+        get => __pbn__MarkerType.GetValueOrDefault();
+        set => __pbn__MarkerType = value;
+    }
+    public bool ShouldSerializeMarkerType() => __pbn__MarkerType != null;
+    public void ResetMarkerType() => __pbn__MarkerType = null;
+    private int? __pbn__MarkerType;
+
+    [global::ProtoBuf.ProtoMember(22, Name = @"txnid_least_bits")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits.GetValueOrDefault();
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(23, Name = @"txnid_most_bits")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits.GetValueOrDefault();
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(24, Name = @"highest_sequence_id")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong HighestSequenceId
+    {
+        get => __pbn__HighestSequenceId ?? 0;
+        set => __pbn__HighestSequenceId = value;
+    }
+    public bool ShouldSerializeHighestSequenceId() => __pbn__HighestSequenceId != null;
+    public void ResetHighestSequenceId() => __pbn__HighestSequenceId = null;
+    private ulong? __pbn__HighestSequenceId;
+
+    [global::ProtoBuf.ProtoMember(25, Name = @"null_value")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool NullValue
+    {
+        get => __pbn__NullValue ?? false;
+        set => __pbn__NullValue = value;
+    }
+    public bool ShouldSerializeNullValue() => __pbn__NullValue != null;
+    public void ResetNullValue() => __pbn__NullValue = null;
+    private bool? __pbn__NullValue;
+
+    [global::ProtoBuf.ProtoMember(26, Name = @"uuid")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Uuid
+    {
+        get => __pbn__Uuid ?? "";
+        set => __pbn__Uuid = value;
+    }
+    public bool ShouldSerializeUuid() => __pbn__Uuid != null;
+    public void ResetUuid() => __pbn__Uuid = null;
+    private string __pbn__Uuid;
+
+    [global::ProtoBuf.ProtoMember(27, Name = @"num_chunks_from_msg")]
+    public int NumChunksFromMsg
+    {
+        get => __pbn__NumChunksFromMsg.GetValueOrDefault();
+        set => __pbn__NumChunksFromMsg = value;
+    }
+    public bool ShouldSerializeNumChunksFromMsg() => __pbn__NumChunksFromMsg != null;
+    public void ResetNumChunksFromMsg() => __pbn__NumChunksFromMsg = null;
+    private int? __pbn__NumChunksFromMsg;
+
+    [global::ProtoBuf.ProtoMember(28, Name = @"total_chunk_msg_size")]
+    public int TotalChunkMsgSize
+    {
+        get => __pbn__TotalChunkMsgSize.GetValueOrDefault();
+        set => __pbn__TotalChunkMsgSize = value;
+    }
+    public bool ShouldSerializeTotalChunkMsgSize() => __pbn__TotalChunkMsgSize != null;
+    public void ResetTotalChunkMsgSize() => __pbn__TotalChunkMsgSize = null;
+    private int? __pbn__TotalChunkMsgSize;
+
+    [global::ProtoBuf.ProtoMember(29, Name = @"chunk_id")]
+    public int ChunkId
+    {
+        get => __pbn__ChunkId.GetValueOrDefault();
+        set => __pbn__ChunkId = value;
+    }
+    public bool ShouldSerializeChunkId() => __pbn__ChunkId != null;
+    public void ResetChunkId() => __pbn__ChunkId = null;
+    private int? __pbn__ChunkId;
+
+    [global::ProtoBuf.ProtoMember(30, Name = @"null_partition_key")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool NullPartitionKey
+    {
+        get => __pbn__NullPartitionKey ?? false;
+        set => __pbn__NullPartitionKey = value;
+    }
+    public bool ShouldSerializeNullPartitionKey() => __pbn__NullPartitionKey != null;
+    public void ResetNullPartitionKey() => __pbn__NullPartitionKey = null;
+    private bool? __pbn__NullPartitionKey;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class SingleMessageMetadata : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"properties")]
+    public global::System.Collections.Generic.List<KeyValue> Properties { get; } = new global::System.Collections.Generic.List<KeyValue>();
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"partition_key")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string PartitionKey
+    {
+        get => __pbn__PartitionKey ?? "";
+        set => __pbn__PartitionKey = value;
+    }
+    public bool ShouldSerializePartitionKey() => __pbn__PartitionKey != null;
+    public void ResetPartitionKey() => __pbn__PartitionKey = null;
+    private string __pbn__PartitionKey;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"payload_size", IsRequired = true)]
+    public int PayloadSize { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"compacted_out")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool CompactedOut
+    {
+        get => __pbn__CompactedOut ?? false;
+        set => __pbn__CompactedOut = value;
+    }
+    public bool ShouldSerializeCompactedOut() => __pbn__CompactedOut != null;
+    public void ResetCompactedOut() => __pbn__CompactedOut = null;
+    private bool? __pbn__CompactedOut;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"event_time")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong EventTime
+    {
+        get => __pbn__EventTime ?? 0;
+        set => __pbn__EventTime = value;
+    }
+    public bool ShouldSerializeEventTime() => __pbn__EventTime != null;
+    public void ResetEventTime() => __pbn__EventTime = null;
+    private ulong? __pbn__EventTime;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"partition_key_b64_encoded")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool PartitionKeyB64Encoded
+    {
+        get => __pbn__PartitionKeyB64Encoded ?? false;
+        set => __pbn__PartitionKeyB64Encoded = value;
+    }
+    public bool ShouldSerializePartitionKeyB64Encoded() => __pbn__PartitionKeyB64Encoded != null;
+    public void ResetPartitionKeyB64Encoded() => __pbn__PartitionKeyB64Encoded = null;
+    private bool? __pbn__PartitionKeyB64Encoded;
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"ordering_key")]
+    public byte[] OrderingKey
+    {
+        get => __pbn__OrderingKey;
+        set => __pbn__OrderingKey = value;
+    }
+    public bool ShouldSerializeOrderingKey() => __pbn__OrderingKey != null;
+    public void ResetOrderingKey() => __pbn__OrderingKey = null;
+    private byte[] __pbn__OrderingKey;
+
+    [global::ProtoBuf.ProtoMember(8, Name = @"sequence_id")]
+    public ulong SequenceId
+    {
+        get => __pbn__SequenceId.GetValueOrDefault();
+        set => __pbn__SequenceId = value;
+    }
+    public bool ShouldSerializeSequenceId() => __pbn__SequenceId != null;
+    public void ResetSequenceId() => __pbn__SequenceId = null;
+    private ulong? __pbn__SequenceId;
+
+    [global::ProtoBuf.ProtoMember(9, Name = @"null_value")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool NullValue
+    {
+        get => __pbn__NullValue ?? false;
+        set => __pbn__NullValue = value;
+    }
+    public bool ShouldSerializeNullValue() => __pbn__NullValue != null;
+    public void ResetNullValue() => __pbn__NullValue = null;
+    private bool? __pbn__NullValue;
+
+    [global::ProtoBuf.ProtoMember(10, Name = @"null_partition_key")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool NullPartitionKey
+    {
+        get => __pbn__NullPartitionKey ?? false;
+        set => __pbn__NullPartitionKey = value;
+    }
+    public bool ShouldSerializeNullPartitionKey() => __pbn__NullPartitionKey != null;
+    public void ResetNullPartitionKey() => __pbn__NullPartitionKey = null;
+    private bool? __pbn__NullPartitionKey;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandConnect : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"client_version", IsRequired = true)]
+    public string ClientVersion { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"auth_method")]
+    [global::System.ComponentModel.DefaultValue(AuthMethod.AuthMethodNone)]
+    public AuthMethod AuthMethod
+    {
+        get => __pbn__AuthMethod ?? AuthMethod.AuthMethodNone;
+        set => __pbn__AuthMethod = value;
+    }
+    public bool ShouldSerializeAuthMethod() => __pbn__AuthMethod != null;
+    public void ResetAuthMethod() => __pbn__AuthMethod = null;
+    private AuthMethod? __pbn__AuthMethod;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"auth_method_name")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string AuthMethodName
+    {
+        get => __pbn__AuthMethodName ?? "";
+        set => __pbn__AuthMethodName = value;
+    }
+    public bool ShouldSerializeAuthMethodName() => __pbn__AuthMethodName != null;
+    public void ResetAuthMethodName() => __pbn__AuthMethodName = null;
+    private string __pbn__AuthMethodName;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"auth_data")]
+    public byte[] AuthData
+    {
+        get => __pbn__AuthData;
+        set => __pbn__AuthData = value;
+    }
+    public bool ShouldSerializeAuthData() => __pbn__AuthData != null;
+    public void ResetAuthData() => __pbn__AuthData = null;
+    private byte[] __pbn__AuthData;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"protocol_version")]
+    [global::System.ComponentModel.DefaultValue(0)]
+    public int ProtocolVersion
+    {
+        get => __pbn__ProtocolVersion ?? 0;
+        set => __pbn__ProtocolVersion = value;
+    }
+    public bool ShouldSerializeProtocolVersion() => __pbn__ProtocolVersion != null;
+    public void ResetProtocolVersion() => __pbn__ProtocolVersion = null;
+    private int? __pbn__ProtocolVersion;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"proxy_to_broker_url")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ProxyToBrokerUrl
+    {
+        get => __pbn__ProxyToBrokerUrl ?? "";
+        set => __pbn__ProxyToBrokerUrl = value;
+    }
+    public bool ShouldSerializeProxyToBrokerUrl() => __pbn__ProxyToBrokerUrl != null;
+    public void ResetProxyToBrokerUrl() => __pbn__ProxyToBrokerUrl = null;
+    private string __pbn__ProxyToBrokerUrl;
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"original_principal")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalPrincipal
+    {
+        get => __pbn__OriginalPrincipal ?? "";
+        set => __pbn__OriginalPrincipal = value;
+    }
+    public bool ShouldSerializeOriginalPrincipal() => __pbn__OriginalPrincipal != null;
+    public void ResetOriginalPrincipal() => __pbn__OriginalPrincipal = null;
+    private string __pbn__OriginalPrincipal;
+
+    [global::ProtoBuf.ProtoMember(8, Name = @"original_auth_data")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalAuthData
+    {
+        get => __pbn__OriginalAuthData ?? "";
+        set => __pbn__OriginalAuthData = value;
+    }
+    public bool ShouldSerializeOriginalAuthData() => __pbn__OriginalAuthData != null;
+    public void ResetOriginalAuthData() => __pbn__OriginalAuthData = null;
+    private string __pbn__OriginalAuthData;
+
+    [global::ProtoBuf.ProtoMember(9, Name = @"original_auth_method")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalAuthMethod
+    {
+        get => __pbn__OriginalAuthMethod ?? "";
+        set => __pbn__OriginalAuthMethod = value;
+    }
+    public bool ShouldSerializeOriginalAuthMethod() => __pbn__OriginalAuthMethod != null;
+    public void ResetOriginalAuthMethod() => __pbn__OriginalAuthMethod = null;
+    private string __pbn__OriginalAuthMethod;
+
+    [global::ProtoBuf.ProtoMember(10, Name = @"feature_flags")]
+    public FeatureFlags FeatureFlags { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class FeatureFlags : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"supports_auth_refresh")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool SupportsAuthRefresh
+    {
+        get => __pbn__SupportsAuthRefresh ?? false;
+        set => __pbn__SupportsAuthRefresh = value;
+    }
+    public bool ShouldSerializeSupportsAuthRefresh() => __pbn__SupportsAuthRefresh != null;
+    public void ResetSupportsAuthRefresh() => __pbn__SupportsAuthRefresh = null;
+    private bool? __pbn__SupportsAuthRefresh;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandConnected : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"server_version", IsRequired = true)]
+    public string ServerVersion { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"protocol_version")]
+    [global::System.ComponentModel.DefaultValue(0)]
+    public int ProtocolVersion
+    {
+        get => __pbn__ProtocolVersion ?? 0;
+        set => __pbn__ProtocolVersion = value;
+    }
+    public bool ShouldSerializeProtocolVersion() => __pbn__ProtocolVersion != null;
+    public void ResetProtocolVersion() => __pbn__ProtocolVersion = null;
+    private int? __pbn__ProtocolVersion;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"max_message_size")]
+    public int MaxMessageSize
+    {
+        get => __pbn__MaxMessageSize.GetValueOrDefault();
+        set => __pbn__MaxMessageSize = value;
+    }
+    public bool ShouldSerializeMaxMessageSize() => __pbn__MaxMessageSize != null;
+    public void ResetMaxMessageSize() => __pbn__MaxMessageSize = null;
+    private int? __pbn__MaxMessageSize;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandAuthResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"client_version")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ClientVersion
+    {
+        get => __pbn__ClientVersion ?? "";
+        set => __pbn__ClientVersion = value;
+    }
+    public bool ShouldSerializeClientVersion() => __pbn__ClientVersion != null;
+    public void ResetClientVersion() => __pbn__ClientVersion = null;
+    private string __pbn__ClientVersion;
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"response")]
+    public AuthData Response { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"protocol_version")]
+    [global::System.ComponentModel.DefaultValue(0)]
+    public int ProtocolVersion
+    {
+        get => __pbn__ProtocolVersion ?? 0;
+        set => __pbn__ProtocolVersion = value;
+    }
+    public bool ShouldSerializeProtocolVersion() => __pbn__ProtocolVersion != null;
+    public void ResetProtocolVersion() => __pbn__ProtocolVersion = null;
+    private int? __pbn__ProtocolVersion;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandAuthChallenge : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"server_version")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ServerVersion
+    {
+        get => __pbn__ServerVersion ?? "";
+        set => __pbn__ServerVersion = value;
+    }
+    public bool ShouldSerializeServerVersion() => __pbn__ServerVersion != null;
+    public void ResetServerVersion() => __pbn__ServerVersion = null;
+    private string __pbn__ServerVersion;
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"challenge")]
+    public AuthData Challenge { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"protocol_version")]
+    [global::System.ComponentModel.DefaultValue(0)]
+    public int ProtocolVersion
+    {
+        get => __pbn__ProtocolVersion ?? 0;
+        set => __pbn__ProtocolVersion = value;
+    }
+    public bool ShouldSerializeProtocolVersion() => __pbn__ProtocolVersion != null;
+    public void ResetProtocolVersion() => __pbn__ProtocolVersion = null;
+    private int? __pbn__ProtocolVersion;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class AuthData : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"auth_method_name")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string AuthMethodName
+    {
+        get => __pbn__AuthMethodName ?? "";
+        set => __pbn__AuthMethodName = value;
+    }
+    public bool ShouldSerializeAuthMethodName() => __pbn__AuthMethodName != null;
+    public void ResetAuthMethodName() => __pbn__AuthMethodName = null;
+    private string __pbn__AuthMethodName;
+
+    [global::ProtoBuf.ProtoMember(2)]
+    public byte[] Data
+    {
+        get => __pbn__auth_data;
+        set => __pbn__auth_data = value;
+    }
+    public bool ShouldSerializeauth_data() => __pbn__auth_data != null;
+    public void Resetauth_data() => __pbn__auth_data = null;
+    private byte[] __pbn__auth_data;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class KeySharedMeta : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, IsRequired = true)]
+    public KeySharedMode KeySharedMode { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3)]
+    public global::System.Collections.Generic.List<IntRange> hashRanges { get; } = new global::System.Collections.Generic.List<IntRange>();
+
+    [global::ProtoBuf.ProtoMember(4)]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool allowOutOfOrderDelivery
+    {
+        get => __pbn__allowOutOfOrderDelivery ?? false;
+        set => __pbn__allowOutOfOrderDelivery = value;
+    }
+    public bool ShouldSerializeallowOutOfOrderDelivery() => __pbn__allowOutOfOrderDelivery != null;
+    public void ResetallowOutOfOrderDelivery() => __pbn__allowOutOfOrderDelivery = null;
+    private bool? __pbn__allowOutOfOrderDelivery;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandSubscribe : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
+    public string Topic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"subscription", IsRequired = true)]
+    public string Subscription { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, IsRequired = true)]
+    public SubType Type { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"consumer_name")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ConsumerName
+    {
+        get => __pbn__ConsumerName ?? "";
+        set => __pbn__ConsumerName = value;
+    }
+    public bool ShouldSerializeConsumerName() => __pbn__ConsumerName != null;
+    public void ResetConsumerName() => __pbn__ConsumerName = null;
+    private string __pbn__ConsumerName;
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"priority_level")]
+    public int PriorityLevel
+    {
+        get => __pbn__PriorityLevel.GetValueOrDefault();
+        set => __pbn__PriorityLevel = value;
+    }
+    public bool ShouldSerializePriorityLevel() => __pbn__PriorityLevel != null;
+    public void ResetPriorityLevel() => __pbn__PriorityLevel = null;
+    private int? __pbn__PriorityLevel;
+
+    [global::ProtoBuf.ProtoMember(8, Name = @"durable")]
+    [global::System.ComponentModel.DefaultValue(true)]
+    public bool Durable
+    {
+        get => __pbn__Durable ?? true;
+        set => __pbn__Durable = value;
+    }
+    public bool ShouldSerializeDurable() => __pbn__Durable != null;
+    public void ResetDurable() => __pbn__Durable = null;
+    private bool? __pbn__Durable;
+
+    [global::ProtoBuf.ProtoMember(9, Name = @"start_message_id")]
+    public MessageIdData StartMessageId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(10, Name = @"metadata")]
+    public global::System.Collections.Generic.List<KeyValue> Metadatas { get; } = new global::System.Collections.Generic.List<KeyValue>();
+
+    [global::ProtoBuf.ProtoMember(11, Name = @"read_compacted")]
+    public bool ReadCompacted
+    {
+        get => __pbn__ReadCompacted.GetValueOrDefault();
+        set => __pbn__ReadCompacted = value;
+    }
+    public bool ShouldSerializeReadCompacted() => __pbn__ReadCompacted != null;
+    public void ResetReadCompacted() => __pbn__ReadCompacted = null;
+    private bool? __pbn__ReadCompacted;
+
+    [global::ProtoBuf.ProtoMember(12, Name = @"schema")]
+    public Schema Schema { get; set; }
+
+    [global::ProtoBuf.ProtoMember(13)]
+    [global::System.ComponentModel.DefaultValue(InitialPositionType.Latest)]
+    public InitialPositionType InitialPosition
+    {
+        get => __pbn__initialPosition ?? InitialPositionType.Latest;
+        set => __pbn__initialPosition = value;
+    }
+    public bool ShouldSerializeinitialPosition() => __pbn__initialPosition != null;
+    public void ResetinitialPosition() => __pbn__initialPosition = null;
+    private InitialPositionType? __pbn__initialPosition;
+
+    [global::ProtoBuf.ProtoMember(14, Name = @"replicate_subscription_state")]
+    public bool ReplicateSubscriptionState
+    {
+        get => __pbn__ReplicateSubscriptionState.GetValueOrDefault();
+        set => __pbn__ReplicateSubscriptionState = value;
+    }
+    public bool ShouldSerializeReplicateSubscriptionState() => __pbn__ReplicateSubscriptionState != null;
+    public void ResetReplicateSubscriptionState() => __pbn__ReplicateSubscriptionState = null;
+    private bool? __pbn__ReplicateSubscriptionState;
+
+    [global::ProtoBuf.ProtoMember(15, Name = @"force_topic_creation")]
+    [global::System.ComponentModel.DefaultValue(true)]
+    public bool ForceTopicCreation
+    {
+        get => __pbn__ForceTopicCreation ?? true;
+        set => __pbn__ForceTopicCreation = value;
+    }
+    public bool ShouldSerializeForceTopicCreation() => __pbn__ForceTopicCreation != null;
+    public void ResetForceTopicCreation() => __pbn__ForceTopicCreation = null;
+    private bool? __pbn__ForceTopicCreation;
+
+    [global::ProtoBuf.ProtoMember(16, Name = @"start_message_rollback_duration_sec")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong StartMessageRollbackDurationSec
+    {
+        get => __pbn__StartMessageRollbackDurationSec ?? 0;
+        set => __pbn__StartMessageRollbackDurationSec = value;
+    }
+    public bool ShouldSerializeStartMessageRollbackDurationSec() => __pbn__StartMessageRollbackDurationSec != null;
+    public void ResetStartMessageRollbackDurationSec() => __pbn__StartMessageRollbackDurationSec = null;
+    private ulong? __pbn__StartMessageRollbackDurationSec;
+
+    [global::ProtoBuf.ProtoMember(17)]
+    public KeySharedMeta KeySharedMeta { get; set; }
+
+    [global::ProtoBuf.ProtoContract()]
+    public enum SubType
+    {
+        Exclusive = 0,
+        Shared = 1,
+        Failover = 2,
+        [global::ProtoBuf.ProtoEnum(Name = @"Key_Shared")]
+        KeyShared = 3,
     }
 
     [global::ProtoBuf.ProtoContract()]
-    public enum ServerError
+    public enum InitialPositionType
     {
-        UnknownError = 0,
-        MetadataError = 1,
-        PersistenceError = 2,
-        AuthenticationError = 3,
-        AuthorizationError = 4,
-        ConsumerBusy = 5,
-        ServiceNotReady = 6,
-        ProducerBlockedQuotaExceededError = 7,
-        ProducerBlockedQuotaExceededException = 8,
-        ChecksumError = 9,
-        UnsupportedVersionError = 10,
-        TopicNotFound = 11,
-        SubscriptionNotFound = 12,
-        ConsumerNotFound = 13,
-        TooManyRequests = 14,
-        TopicTerminatedError = 15,
-        ProducerBusy = 16,
-        InvalidTopicName = 17,
-        IncompatibleSchema = 18,
-        ConsumerAssignError = 19,
-        TransactionCoordinatorNotFound = 20,
-        InvalidTxnStatus = 21,
-        NotAllowedError = 22,
-        TransactionConflict = 23,
+        Latest = 0,
+        Earliest = 1,
+    }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandPartitionedTopicMetadata : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
+    public string Topic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"original_principal")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalPrincipal
+    {
+        get => __pbn__OriginalPrincipal ?? "";
+        set => __pbn__OriginalPrincipal = value;
+    }
+    public bool ShouldSerializeOriginalPrincipal() => __pbn__OriginalPrincipal != null;
+    public void ResetOriginalPrincipal() => __pbn__OriginalPrincipal = null;
+    private string __pbn__OriginalPrincipal;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"original_auth_data")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalAuthData
+    {
+        get => __pbn__OriginalAuthData ?? "";
+        set => __pbn__OriginalAuthData = value;
+    }
+    public bool ShouldSerializeOriginalAuthData() => __pbn__OriginalAuthData != null;
+    public void ResetOriginalAuthData() => __pbn__OriginalAuthData = null;
+    private string __pbn__OriginalAuthData;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"original_auth_method")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalAuthMethod
+    {
+        get => __pbn__OriginalAuthMethod ?? "";
+        set => __pbn__OriginalAuthMethod = value;
+    }
+    public bool ShouldSerializeOriginalAuthMethod() => __pbn__OriginalAuthMethod != null;
+    public void ResetOriginalAuthMethod() => __pbn__OriginalAuthMethod = null;
+    private string __pbn__OriginalAuthMethod;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandPartitionedTopicMetadataResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"partitions")]
+    public uint Partitions
+    {
+        get => __pbn__Partitions.GetValueOrDefault();
+        set => __pbn__Partitions = value;
+    }
+    public bool ShouldSerializePartitions() => __pbn__Partitions != null;
+    public void ResetPartitions() => __pbn__Partitions = null;
+    private uint? __pbn__Partitions;
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"response")]
+    [global::System.ComponentModel.DefaultValue(LookupType.Success)]
+    public LookupType Response
+    {
+        get => __pbn__Response ?? LookupType.Success;
+        set => __pbn__Response = value;
+    }
+    public bool ShouldSerializeResponse() => __pbn__Response != null;
+    public void ResetResponse() => __pbn__Response = null;
+    private LookupType? __pbn__Response;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+    [global::ProtoBuf.ProtoContract()]
+    public enum LookupType
+    {
+        Success = 0,
+        Failed = 1,
+    }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandLookupTopic : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
+    public string Topic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"authoritative")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool Authoritative
+    {
+        get => __pbn__Authoritative ?? false;
+        set => __pbn__Authoritative = value;
+    }
+    public bool ShouldSerializeAuthoritative() => __pbn__Authoritative != null;
+    public void ResetAuthoritative() => __pbn__Authoritative = null;
+    private bool? __pbn__Authoritative;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"original_principal")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalPrincipal
+    {
+        get => __pbn__OriginalPrincipal ?? "";
+        set => __pbn__OriginalPrincipal = value;
+    }
+    public bool ShouldSerializeOriginalPrincipal() => __pbn__OriginalPrincipal != null;
+    public void ResetOriginalPrincipal() => __pbn__OriginalPrincipal = null;
+    private string __pbn__OriginalPrincipal;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"original_auth_data")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalAuthData
+    {
+        get => __pbn__OriginalAuthData ?? "";
+        set => __pbn__OriginalAuthData = value;
+    }
+    public bool ShouldSerializeOriginalAuthData() => __pbn__OriginalAuthData != null;
+    public void ResetOriginalAuthData() => __pbn__OriginalAuthData = null;
+    private string __pbn__OriginalAuthData;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"original_auth_method")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string OriginalAuthMethod
+    {
+        get => __pbn__OriginalAuthMethod ?? "";
+        set => __pbn__OriginalAuthMethod = value;
+    }
+    public bool ShouldSerializeOriginalAuthMethod() => __pbn__OriginalAuthMethod != null;
+    public void ResetOriginalAuthMethod() => __pbn__OriginalAuthMethod = null;
+    private string __pbn__OriginalAuthMethod;
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"advertised_listener_name")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string AdvertisedListenerName
+    {
+        get => __pbn__AdvertisedListenerName ?? "";
+        set => __pbn__AdvertisedListenerName = value;
+    }
+    public bool ShouldSerializeAdvertisedListenerName() => __pbn__AdvertisedListenerName != null;
+    public void ResetAdvertisedListenerName() => __pbn__AdvertisedListenerName = null;
+    private string __pbn__AdvertisedListenerName;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandLookupTopicResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1)]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string BrokerServiceUrl
+    {
+        get => __pbn__brokerServiceUrl ?? "";
+        set => __pbn__brokerServiceUrl = value;
+    }
+    public bool ShouldSerializebrokerServiceUrl() => __pbn__brokerServiceUrl != null;
+    public void ResetbrokerServiceUrl() => __pbn__brokerServiceUrl = null;
+    private string __pbn__brokerServiceUrl;
+
+    [global::ProtoBuf.ProtoMember(2)]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string BrokerServiceUrlTls
+    {
+        get => __pbn__brokerServiceUrlTls ?? "";
+        set => __pbn__brokerServiceUrlTls = value;
+    }
+    public bool ShouldSerializebrokerServiceUrlTls() => __pbn__brokerServiceUrlTls != null;
+    public void ResetbrokerServiceUrlTls() => __pbn__brokerServiceUrlTls = null;
+    private string __pbn__brokerServiceUrlTls;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"response")]
+    [global::System.ComponentModel.DefaultValue(LookupType.Redirect)]
+    public LookupType Response
+    {
+        get => __pbn__Response ?? LookupType.Redirect;
+        set => __pbn__Response = value;
+    }
+    public bool ShouldSerializeResponse() => __pbn__Response != null;
+    public void ResetResponse() => __pbn__Response = null;
+    private LookupType? __pbn__Response;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"authoritative")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool Authoritative
+    {
+        get => __pbn__Authoritative ?? false;
+        set => __pbn__Authoritative = value;
+    }
+    public bool ShouldSerializeAuthoritative() => __pbn__Authoritative != null;
+    public void ResetAuthoritative() => __pbn__Authoritative = null;
+    private bool? __pbn__Authoritative;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+    [global::ProtoBuf.ProtoMember(8, Name = @"proxy_through_service_url")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool ProxyThroughServiceUrl
+    {
+        get => __pbn__ProxyThroughServiceUrl ?? false;
+        set => __pbn__ProxyThroughServiceUrl = value;
+    }
+    public bool ShouldSerializeProxyThroughServiceUrl() => __pbn__ProxyThroughServiceUrl != null;
+    public void ResetProxyThroughServiceUrl() => __pbn__ProxyThroughServiceUrl = null;
+    private bool? __pbn__ProxyThroughServiceUrl;
+
+    [global::ProtoBuf.ProtoContract()]
+    public enum LookupType
+    {
+        Redirect = 0,
+        Connect = 1,
+        Failed = 2,
+    }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandProducer : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
+    public string Topic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"producer_id", IsRequired = true)]
+    public ulong ProducerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"producer_name")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ProducerName
+    {
+        get => __pbn__ProducerName ?? "";
+        set => __pbn__ProducerName = value;
+    }
+    public bool ShouldSerializeProducerName() => __pbn__ProducerName != null;
+    public void ResetProducerName() => __pbn__ProducerName = null;
+    private string __pbn__ProducerName;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"encrypted")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool Encrypted
+    {
+        get => __pbn__Encrypted ?? false;
+        set => __pbn__Encrypted = value;
+    }
+    public bool ShouldSerializeEncrypted() => __pbn__Encrypted != null;
+    public void ResetEncrypted() => __pbn__Encrypted = null;
+    private bool? __pbn__Encrypted;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"metadata")]
+    public global::System.Collections.Generic.List<KeyValue> Metadatas { get; } = new global::System.Collections.Generic.List<KeyValue>();
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"schema")]
+    public Schema Schema { get; set; }
+
+    [global::ProtoBuf.ProtoMember(8, Name = @"epoch")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong Epoch
+    {
+        get => __pbn__Epoch ?? 0;
+        set => __pbn__Epoch = value;
+    }
+    public bool ShouldSerializeEpoch() => __pbn__Epoch != null;
+    public void ResetEpoch() => __pbn__Epoch = null;
+    private ulong? __pbn__Epoch;
+
+    [global::ProtoBuf.ProtoMember(9, Name = @"user_provided_producer_name")]
+    [global::System.ComponentModel.DefaultValue(true)]
+    public bool UserProvidedProducerName
+    {
+        get => __pbn__UserProvidedProducerName ?? true;
+        set => __pbn__UserProvidedProducerName = value;
+    }
+    public bool ShouldSerializeUserProvidedProducerName() => __pbn__UserProvidedProducerName != null;
+    public void ResetUserProvidedProducerName() => __pbn__UserProvidedProducerName = null;
+    private bool? __pbn__UserProvidedProducerName;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandSend : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"producer_id", IsRequired = true)]
+    public ulong ProducerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"sequence_id", IsRequired = true)]
+    public ulong SequenceId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"num_messages")]
+    [global::System.ComponentModel.DefaultValue(1)]
+    public int NumMessages
+    {
+        get => __pbn__NumMessages ?? 1;
+        set => __pbn__NumMessages = value;
+    }
+    public bool ShouldSerializeNumMessages() => __pbn__NumMessages != null;
+    public void ResetNumMessages() => __pbn__NumMessages = null;
+    private int? __pbn__NumMessages;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"highest_sequence_id")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong HighestSequenceId
+    {
+        get => __pbn__HighestSequenceId ?? 0;
+        set => __pbn__HighestSequenceId = value;
+    }
+    public bool ShouldSerializeHighestSequenceId() => __pbn__HighestSequenceId != null;
+    public void ResetHighestSequenceId() => __pbn__HighestSequenceId = null;
+    private ulong? __pbn__HighestSequenceId;
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"is_chunk")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool IsChunk
+    {
+        get => __pbn__IsChunk ?? false;
+        set => __pbn__IsChunk = value;
+    }
+    public bool ShouldSerializeIsChunk() => __pbn__IsChunk != null;
+    public void ResetIsChunk() => __pbn__IsChunk = null;
+    private bool? __pbn__IsChunk;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandSendReceipt : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"producer_id", IsRequired = true)]
+    public ulong ProducerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"sequence_id", IsRequired = true)]
+    public ulong SequenceId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"message_id")]
+    public MessageIdData MessageId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"highest_sequence_id")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong HighestSequenceId
+    {
+        get => __pbn__HighestSequenceId ?? 0;
+        set => __pbn__HighestSequenceId = value;
+    }
+    public bool ShouldSerializeHighestSequenceId() => __pbn__HighestSequenceId != null;
+    public void ResetHighestSequenceId() => __pbn__HighestSequenceId = null;
+    private ulong? __pbn__HighestSequenceId;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandSendError : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"producer_id", IsRequired = true)]
+    public ulong ProducerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"sequence_id", IsRequired = true)]
+    public ulong SequenceId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"error", IsRequired = true)]
+    public ServerError Error { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"message", IsRequired = true)]
+    public string Message { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandMessage : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"message_id", IsRequired = true)]
+    public MessageIdData MessageId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"redelivery_count")]
+    [global::System.ComponentModel.DefaultValue(0)]
+    public uint RedeliveryCount
+    {
+        get => __pbn__RedeliveryCount ?? 0;
+        set => __pbn__RedeliveryCount = value;
+    }
+    public bool ShouldSerializeRedeliveryCount() => __pbn__RedeliveryCount != null;
+    public void ResetRedeliveryCount() => __pbn__RedeliveryCount = null;
+    private uint? __pbn__RedeliveryCount;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"ack_set")]
+    public long[] AckSets { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandAck : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, IsRequired = true)]
+    public AckType Type { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"message_id")]
+    public global::System.Collections.Generic.List<MessageIdData> MessageIds { get; } = new global::System.Collections.Generic.List<MessageIdData>();
+
+    [global::ProtoBuf.ProtoMember(4)]
+    [global::System.ComponentModel.DefaultValue(ValidationErrorType.UncompressedSizeCorruption)]
+    public ValidationErrorType ValidationError
+    {
+        get => __pbn__validation_error ?? ValidationErrorType.UncompressedSizeCorruption;
+        set => __pbn__validation_error = value;
+    }
+    public bool ShouldSerializevalidation_error() => __pbn__validation_error != null;
+    public void Resetvalidation_error() => __pbn__validation_error = null;
+    private ValidationErrorType? __pbn__validation_error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"properties")]
+    public global::System.Collections.Generic.List<KeyLongValue> Properties { get; } = new global::System.Collections.Generic.List<KeyLongValue>();
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(8, Name = @"request_id")]
+    public ulong RequestId
+    {
+        get => __pbn__RequestId.GetValueOrDefault();
+        set => __pbn__RequestId = value;
+    }
+    public bool ShouldSerializeRequestId() => __pbn__RequestId != null;
+    public void ResetRequestId() => __pbn__RequestId = null;
+    private ulong? __pbn__RequestId;
+
+    [global::ProtoBuf.ProtoContract()]
+    public enum AckType
+    {
+        Individual = 0,
+        Cumulative = 1,
     }
 
     [global::ProtoBuf.ProtoContract()]
-    public enum AuthMethod
+    public enum ValidationErrorType
     {
-        AuthMethodNone = 0,
-        AuthMethodYcaV1 = 1,
-        AuthMethodAthens = 2,
+        UncompressedSizeCorruption = 0,
+        DecompressionError = 1,
+        ChecksumMismatch = 2,
+        BatchDeSerializeError = 3,
+        DecryptionError = 4,
     }
 
-    [global::ProtoBuf.ProtoContract()]
-    public enum ProtocolVersion
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandAckResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
     {
-        [global::ProtoBuf.ProtoEnum(Name = @"v0")]
-        V0 = 0,
-        [global::ProtoBuf.ProtoEnum(Name = @"v1")]
-        V1 = 1,
-        [global::ProtoBuf.ProtoEnum(Name = @"v2")]
-        V2 = 2,
-        [global::ProtoBuf.ProtoEnum(Name = @"v3")]
-        V3 = 3,
-        [global::ProtoBuf.ProtoEnum(Name = @"v4")]
-        V4 = 4,
-        [global::ProtoBuf.ProtoEnum(Name = @"v5")]
-        V5 = 5,
-        [global::ProtoBuf.ProtoEnum(Name = @"v6")]
-        V6 = 6,
-        [global::ProtoBuf.ProtoEnum(Name = @"v7")]
-        V7 = 7,
-        [global::ProtoBuf.ProtoEnum(Name = @"v8")]
-        V8 = 8,
-        [global::ProtoBuf.ProtoEnum(Name = @"v9")]
-        V9 = 9,
-        [global::ProtoBuf.ProtoEnum(Name = @"v10")]
-        V10 = 10,
-        [global::ProtoBuf.ProtoEnum(Name = @"v11")]
-        V11 = 11,
-        [global::ProtoBuf.ProtoEnum(Name = @"v12")]
-        V12 = 12,
-        [global::ProtoBuf.ProtoEnum(Name = @"v13")]
-        V13 = 13,
-        [global::ProtoBuf.ProtoEnum(Name = @"v14")]
-        V14 = 14,
-        [global::ProtoBuf.ProtoEnum(Name = @"v15")]
-        V15 = 15,
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
     }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"request_id")]
+    public ulong RequestId
+    {
+        get => __pbn__RequestId.GetValueOrDefault();
+        set => __pbn__RequestId = value;
+    }
+    public bool ShouldSerializeRequestId() => __pbn__RequestId != null;
+    public void ResetRequestId() => __pbn__RequestId = null;
+    private ulong? __pbn__RequestId;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandActiveConsumerChange : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"is_active")]
+    [global::System.ComponentModel.DefaultValue(false)]
+    public bool IsActive
+    {
+        get => __pbn__IsActive ?? false;
+        set => __pbn__IsActive = value;
+    }
+    public bool ShouldSerializeIsActive() => __pbn__IsActive != null;
+    public void ResetIsActive() => __pbn__IsActive = null;
+    private bool? __pbn__IsActive;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandFlow : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, IsRequired = true)]
+    public uint MessagePermits { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandUnsubscribe : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandSeek : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"message_id")]
+    public MessageIdData MessageId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"message_publish_time")]
+    public ulong MessagePublishTime
+    {
+        get => __pbn__MessagePublishTime.GetValueOrDefault();
+        set => __pbn__MessagePublishTime = value;
+    }
+    public bool ShouldSerializeMessagePublishTime() => __pbn__MessagePublishTime != null;
+    public void ResetMessagePublishTime() => __pbn__MessagePublishTime = null;
+    private ulong? __pbn__MessagePublishTime;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandReachedEndOfTopic : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandCloseProducer : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"producer_id", IsRequired = true)]
+    public ulong ProducerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandCloseConsumer : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandRedeliverUnacknowledgedMessages : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"message_ids")]
+    public global::System.Collections.Generic.List<MessageIdData> MessageIds { get; } = new global::System.Collections.Generic.List<MessageIdData>();
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandSuccess : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"schema")]
+    public Schema Schema { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandProducerSuccess : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"producer_name", IsRequired = true)]
+    public string ProducerName { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"last_sequence_id")]
+    [global::System.ComponentModel.DefaultValue(-1)]
+    public long LastSequenceId
+    {
+        get => __pbn__LastSequenceId ?? -1;
+        set => __pbn__LastSequenceId = value;
+    }
+    public bool ShouldSerializeLastSequenceId() => __pbn__LastSequenceId != null;
+    public void ResetLastSequenceId() => __pbn__LastSequenceId = null;
+    private long? __pbn__LastSequenceId;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"schema_version")]
+    public byte[] SchemaVersion
+    {
+        get => __pbn__SchemaVersion;
+        set => __pbn__SchemaVersion = value;
+    }
+    public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
+    public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
+    private byte[] __pbn__SchemaVersion;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandError : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"error", IsRequired = true)]
+    public ServerError Error { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"message", IsRequired = true)]
+    public string Message { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandPing : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandPong : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandConsumerStats : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandConsumerStatsResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"error_code")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError ErrorCode
+    {
+        get => __pbn__ErrorCode ?? ServerError.UnknownError;
+        set => __pbn__ErrorCode = value;
+    }
+    public bool ShouldSerializeErrorCode() => __pbn__ErrorCode != null;
+    public void ResetErrorCode() => __pbn__ErrorCode = null;
+    private ServerError? __pbn__ErrorCode;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"error_message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ErrorMessage
+    {
+        get => __pbn__ErrorMessage ?? "";
+        set => __pbn__ErrorMessage = value;
+    }
+    public bool ShouldSerializeErrorMessage() => __pbn__ErrorMessage != null;
+    public void ResetErrorMessage() => __pbn__ErrorMessage = null;
+    private string __pbn__ErrorMessage;
+
+    [global::ProtoBuf.ProtoMember(4)]
+    public double MsgRateOut
+    {
+        get => __pbn__msgRateOut.GetValueOrDefault();
+        set => __pbn__msgRateOut = value;
+    }
+    public bool ShouldSerializemsgRateOut() => __pbn__msgRateOut != null;
+    public void ResetmsgRateOut() => __pbn__msgRateOut = null;
+    private double? __pbn__msgRateOut;
+
+    [global::ProtoBuf.ProtoMember(5)]
+    public double MsgThroughputOut
+    {
+        get => __pbn__msgThroughputOut.GetValueOrDefault();
+        set => __pbn__msgThroughputOut = value;
+    }
+    public bool ShouldSerializemsgThroughputOut() => __pbn__msgThroughputOut != null;
+    public void ResetmsgThroughputOut() => __pbn__msgThroughputOut = null;
+    private double? __pbn__msgThroughputOut;
+
+    [global::ProtoBuf.ProtoMember(6)]
+    public double MsgRateRedeliver
+    {
+        get => __pbn__msgRateRedeliver.GetValueOrDefault();
+        set => __pbn__msgRateRedeliver = value;
+    }
+    public bool ShouldSerializemsgRateRedeliver() => __pbn__msgRateRedeliver != null;
+    public void ResetmsgRateRedeliver() => __pbn__msgRateRedeliver = null;
+    private double? __pbn__msgRateRedeliver;
+
+    [global::ProtoBuf.ProtoMember(7)]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ConsumerName
+    {
+        get => __pbn__consumerName ?? "";
+        set => __pbn__consumerName = value;
+    }
+    public bool ShouldSerializeconsumerName() => __pbn__consumerName != null;
+    public void ResetconsumerName() => __pbn__consumerName = null;
+    private string __pbn__consumerName;
+
+    [global::ProtoBuf.ProtoMember(8)]
+    public ulong AvailablePermits
+    {
+        get => __pbn__availablePermits.GetValueOrDefault();
+        set => __pbn__availablePermits = value;
+    }
+    public bool ShouldSerializeavailablePermits() => __pbn__availablePermits != null;
+    public void ResetavailablePermits() => __pbn__availablePermits = null;
+    private ulong? __pbn__availablePermits;
+
+    [global::ProtoBuf.ProtoMember(9)]
+    public ulong UnackedMessages
+    {
+        get => __pbn__unackedMessages.GetValueOrDefault();
+        set => __pbn__unackedMessages = value;
+    }
+    public bool ShouldSerializeunackedMessages() => __pbn__unackedMessages != null;
+    public void ResetunackedMessages() => __pbn__unackedMessages = null;
+    private ulong? __pbn__unackedMessages;
+
+    [global::ProtoBuf.ProtoMember(10)]
+    public bool BlockedConsumerOnUnackedMsgs
+    {
+        get => __pbn__blockedConsumerOnUnackedMsgs.GetValueOrDefault();
+        set => __pbn__blockedConsumerOnUnackedMsgs = value;
+    }
+    public bool ShouldSerializeblockedConsumerOnUnackedMsgs() => __pbn__blockedConsumerOnUnackedMsgs != null;
+    public void ResetblockedConsumerOnUnackedMsgs() => __pbn__blockedConsumerOnUnackedMsgs = null;
+    private bool? __pbn__blockedConsumerOnUnackedMsgs;
+
+    [global::ProtoBuf.ProtoMember(11, Name = @"address")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Address
+    {
+        get => __pbn__Address ?? "";
+        set => __pbn__Address = value;
+    }
+    public bool ShouldSerializeAddress() => __pbn__Address != null;
+    public void ResetAddress() => __pbn__Address = null;
+    private string __pbn__Address;
+
+    [global::ProtoBuf.ProtoMember(12)]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ConnectedSince
+    {
+        get => __pbn__connectedSince ?? "";
+        set => __pbn__connectedSince = value;
+    }
+    public bool ShouldSerializeconnectedSince() => __pbn__connectedSince != null;
+    public void ResetconnectedSince() => __pbn__connectedSince = null;
+    private string __pbn__connectedSince;
+
+    [global::ProtoBuf.ProtoMember(13, Name = @"type")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Type
+    {
+        get => __pbn__Type ?? "";
+        set => __pbn__Type = value;
+    }
+    public bool ShouldSerializeType() => __pbn__Type != null;
+    public void ResetType() => __pbn__Type = null;
+    private string __pbn__Type;
+
+    [global::ProtoBuf.ProtoMember(14)]
+    public double MsgRateExpired
+    {
+        get => __pbn__msgRateExpired.GetValueOrDefault();
+        set => __pbn__msgRateExpired = value;
+    }
+    public bool ShouldSerializemsgRateExpired() => __pbn__msgRateExpired != null;
+    public void ResetmsgRateExpired() => __pbn__msgRateExpired = null;
+    private double? __pbn__msgRateExpired;
+
+    [global::ProtoBuf.ProtoMember(15)]
+    public ulong MsgBacklog
+    {
+        get => __pbn__msgBacklog.GetValueOrDefault();
+        set => __pbn__msgBacklog = value;
+    }
+    public bool ShouldSerializemsgBacklog() => __pbn__msgBacklog != null;
+    public void ResetmsgBacklog() => __pbn__msgBacklog = null;
+    private ulong? __pbn__msgBacklog;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandGetLastMessageId : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"consumer_id", IsRequired = true)]
+    public ulong ConsumerId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandGetLastMessageIdResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"last_message_id", IsRequired = true)]
+    public MessageIdData LastMessageId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandGetTopicsOfNamespace : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"namespace", IsRequired = true)]
+    public string Namespace { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3)]
+    [global::System.ComponentModel.DefaultValue(ModeType.Persistent)]
+    public ModeType Mode
+    {
+        get => __pbn__mode ?? ModeType.Persistent;
+        set => __pbn__mode = value;
+    }
+    public bool ShouldSerializemode() => __pbn__mode != null;
+    public void Resetmode() => __pbn__mode = null;
+    private ModeType? __pbn__mode;
 
     [global::ProtoBuf.ProtoContract()]
-    public enum KeySharedMode
+    public enum ModeType
     {
-        [global::ProtoBuf.ProtoEnum(Name = @"AUTO_SPLIT")]
-        AutoSplit = 0,
-        [global::ProtoBuf.ProtoEnum(Name = @"STICKY")]
-        Sticky = 1,
+        [global::ProtoBuf.ProtoEnum(Name = @"PERSISTENT")]
+        Persistent = 0,
+        [global::ProtoBuf.ProtoEnum(Name = @"NON_PERSISTENT")]
+        NonPersistent = 1,
+        [global::ProtoBuf.ProtoEnum(Name = @"ALL")]
+        All = 2,
     }
 
-    [global::ProtoBuf.ProtoContract()]
-    public enum TxnAction
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandGetTopicsOfNamespaceResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"topics")]
+    public global::System.Collections.Generic.List<string> Topics { get; } = new global::System.Collections.Generic.List<string>();
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandGetSchema : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"topic", IsRequired = true)]
+    public string Topic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"schema_version")]
+    public byte[] SchemaVersion
     {
-        [global::ProtoBuf.ProtoEnum(Name = @"COMMIT")]
-        Commit = 0,
-        [global::ProtoBuf.ProtoEnum(Name = @"ABORT")]
-        Abort = 1,
+        get => __pbn__SchemaVersion;
+        set => __pbn__SchemaVersion = value;
     }
+    public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
+    public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
+    private byte[] __pbn__SchemaVersion;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandGetSchemaResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"error_code")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError ErrorCode
+    {
+        get => __pbn__ErrorCode ?? ServerError.UnknownError;
+        set => __pbn__ErrorCode = value;
+    }
+    public bool ShouldSerializeErrorCode() => __pbn__ErrorCode != null;
+    public void ResetErrorCode() => __pbn__ErrorCode = null;
+    private ServerError? __pbn__ErrorCode;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"error_message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ErrorMessage
+    {
+        get => __pbn__ErrorMessage ?? "";
+        set => __pbn__ErrorMessage = value;
+    }
+    public bool ShouldSerializeErrorMessage() => __pbn__ErrorMessage != null;
+    public void ResetErrorMessage() => __pbn__ErrorMessage = null;
+    private string __pbn__ErrorMessage;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"schema")]
+    public Schema Schema { get; set; }
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"schema_version")]
+    public byte[] SchemaVersion
+    {
+        get => __pbn__SchemaVersion;
+        set => __pbn__SchemaVersion = value;
+    }
+    public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
+    public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
+    private byte[] __pbn__SchemaVersion;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandGetOrCreateSchema : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"topic", IsRequired = true)]
+    public string Topic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"schema", IsRequired = true)]
+    public Schema Schema { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandGetOrCreateSchemaResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"error_code")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError ErrorCode
+    {
+        get => __pbn__ErrorCode ?? ServerError.UnknownError;
+        set => __pbn__ErrorCode = value;
+    }
+    public bool ShouldSerializeErrorCode() => __pbn__ErrorCode != null;
+    public void ResetErrorCode() => __pbn__ErrorCode = null;
+    private ServerError? __pbn__ErrorCode;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"error_message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string ErrorMessage
+    {
+        get => __pbn__ErrorMessage ?? "";
+        set => __pbn__ErrorMessage = value;
+    }
+    public bool ShouldSerializeErrorMessage() => __pbn__ErrorMessage != null;
+    public void ResetErrorMessage() => __pbn__ErrorMessage = null;
+    private string __pbn__ErrorMessage;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"schema_version")]
+    public byte[] SchemaVersion
+    {
+        get => __pbn__SchemaVersion;
+        set => __pbn__SchemaVersion = value;
+    }
+    public bool ShouldSerializeSchemaVersion() => __pbn__SchemaVersion != null;
+    public void ResetSchemaVersion() => __pbn__SchemaVersion = null;
+    private byte[] __pbn__SchemaVersion;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandNewTxn : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txn_ttl_seconds")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnTtlSeconds
+    {
+        get => __pbn__TxnTtlSeconds ?? 0;
+        set => __pbn__TxnTtlSeconds = value;
+    }
+    public bool ShouldSerializeTxnTtlSeconds() => __pbn__TxnTtlSeconds != null;
+    public void ResetTxnTtlSeconds() => __pbn__TxnTtlSeconds = null;
+    private ulong? __pbn__TxnTtlSeconds;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"tc_id")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TcId
+    {
+        get => __pbn__TcId ?? 0;
+        set => __pbn__TcId = value;
+    }
+    public bool ShouldSerializeTcId() => __pbn__TcId != null;
+    public void ResetTcId() => __pbn__TcId = null;
+    private ulong? __pbn__TcId;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandNewTxnResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandAddPartitionToTxn : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"partitions")]
+    public global::System.Collections.Generic.List<string> Partitions { get; } = new global::System.Collections.Generic.List<string>();
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandAddPartitionToTxnResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class Subscription : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"topic", IsRequired = true)]
+    public string Topic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, IsRequired = true)]
+    public string SubscriptionName { get; set; }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandAddSubscriptionToTxn : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"subscription")]
+    public global::System.Collections.Generic.List<Subscription> Subscriptions { get; } = new global::System.Collections.Generic.List<Subscription>();
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandAddSubscriptionToTxnResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandEndTxn : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"txn_action")]
+    [global::System.ComponentModel.DefaultValue(TxnAction.Commit)]
+    public TxnAction TxnAction
+    {
+        get => __pbn__TxnAction ?? TxnAction.Commit;
+        set => __pbn__TxnAction = value;
+    }
+    public bool ShouldSerializeTxnAction() => __pbn__TxnAction != null;
+    public void ResetTxnAction() => __pbn__TxnAction = null;
+    private TxnAction? __pbn__TxnAction;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message_id")]
+    public global::System.Collections.Generic.List<MessageIdData> MessageIds { get; } = new global::System.Collections.Generic.List<MessageIdData>();
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandEndTxnResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandEndTxnOnPartition : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"topic")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Topic
+    {
+        get => __pbn__Topic ?? "";
+        set => __pbn__Topic = value;
+    }
+    public bool ShouldSerializeTopic() => __pbn__Topic != null;
+    public void ResetTopic() => __pbn__Topic = null;
+    private string __pbn__Topic;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"txn_action")]
+    [global::System.ComponentModel.DefaultValue(TxnAction.Commit)]
+    public TxnAction TxnAction
+    {
+        get => __pbn__TxnAction ?? TxnAction.Commit;
+        set => __pbn__TxnAction = value;
+    }
+    public bool ShouldSerializeTxnAction() => __pbn__TxnAction != null;
+    public void ResetTxnAction() => __pbn__TxnAction = null;
+    private TxnAction? __pbn__TxnAction;
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"message_id")]
+    public global::System.Collections.Generic.List<MessageIdData> MessageIds { get; } = new global::System.Collections.Generic.List<MessageIdData>();
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandEndTxnOnPartitionResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandEndTxnOnSubscription : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"subscription")]
+    public Subscription Subscription { get; set; }
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"txn_action")]
+    [global::System.ComponentModel.DefaultValue(TxnAction.Commit)]
+    public TxnAction TxnAction
+    {
+        get => __pbn__TxnAction ?? TxnAction.Commit;
+        set => __pbn__TxnAction = value;
+    }
+    public bool ShouldSerializeTxnAction() => __pbn__TxnAction != null;
+    public void ResetTxnAction() => __pbn__TxnAction = null;
+    private TxnAction? __pbn__TxnAction;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class CommandEndTxnOnSubscriptionResponse : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, Name = @"request_id", IsRequired = true)]
+    public ulong RequestId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"txnid_least_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidLeastBits
+    {
+        get => __pbn__TxnidLeastBits ?? 0;
+        set => __pbn__TxnidLeastBits = value;
+    }
+    public bool ShouldSerializeTxnidLeastBits() => __pbn__TxnidLeastBits != null;
+    public void ResetTxnidLeastBits() => __pbn__TxnidLeastBits = null;
+    private ulong? __pbn__TxnidLeastBits;
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"txnid_most_bits")]
+    [global::System.ComponentModel.DefaultValue(typeof(ulong), "0")]
+    public ulong TxnidMostBits
+    {
+        get => __pbn__TxnidMostBits ?? 0;
+        set => __pbn__TxnidMostBits = value;
+    }
+    public bool ShouldSerializeTxnidMostBits() => __pbn__TxnidMostBits != null;
+    public void ResetTxnidMostBits() => __pbn__TxnidMostBits = null;
+    private ulong? __pbn__TxnidMostBits;
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"error")]
+    [global::System.ComponentModel.DefaultValue(ServerError.UnknownError)]
+    public ServerError Error
+    {
+        get => __pbn__Error ?? ServerError.UnknownError;
+        set => __pbn__Error = value;
+    }
+    public bool ShouldSerializeError() => __pbn__Error != null;
+    public void ResetError() => __pbn__Error = null;
+    private ServerError? __pbn__Error;
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"message")]
+    [global::System.ComponentModel.DefaultValue("")]
+    public string Message
+    {
+        get => __pbn__Message ?? "";
+        set => __pbn__Message = value;
+    }
+    public bool ShouldSerializeMessage() => __pbn__Message != null;
+    public void ResetMessage() => __pbn__Message = null;
+    private string __pbn__Message;
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public partial class BaseCommand : global::ProtoBuf.IExtensible
+{
+    private global::ProtoBuf.IExtension __pbn__extensionData;
+    global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
+        => global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing);
+
+    [global::ProtoBuf.ProtoMember(1, IsRequired = true)]
+    public Type CommandType { get; set; } = Type.Connect;
+
+    [global::ProtoBuf.ProtoMember(2, Name = @"connect")]
+    public CommandConnect Connect { get; set; }
+
+    [global::ProtoBuf.ProtoMember(3, Name = @"connected")]
+    public CommandConnected Connected { get; set; }
+
+    [global::ProtoBuf.ProtoMember(4, Name = @"subscribe")]
+    public CommandSubscribe Subscribe { get; set; }
+
+    [global::ProtoBuf.ProtoMember(5, Name = @"producer")]
+    public CommandProducer Producer { get; set; }
+
+    [global::ProtoBuf.ProtoMember(6, Name = @"send")]
+    public CommandSend Send { get; set; }
+
+    [global::ProtoBuf.ProtoMember(7, Name = @"send_receipt")]
+    public CommandSendReceipt SendReceipt { get; set; }
+
+    [global::ProtoBuf.ProtoMember(8, Name = @"send_error")]
+    public CommandSendError SendError { get; set; }
+
+    [global::ProtoBuf.ProtoMember(9, Name = @"message")]
+    public CommandMessage Message { get; set; }
+
+    [global::ProtoBuf.ProtoMember(10, Name = @"ack")]
+    public CommandAck Ack { get; set; }
+
+    [global::ProtoBuf.ProtoMember(11, Name = @"flow")]
+    public CommandFlow Flow { get; set; }
+
+    [global::ProtoBuf.ProtoMember(12, Name = @"unsubscribe")]
+    public CommandUnsubscribe Unsubscribe { get; set; }
+
+    [global::ProtoBuf.ProtoMember(13, Name = @"success")]
+    public CommandSuccess Success { get; set; }
+
+    [global::ProtoBuf.ProtoMember(14, Name = @"error")]
+    public CommandError Error { get; set; }
+
+    [global::ProtoBuf.ProtoMember(15, Name = @"close_producer")]
+    public CommandCloseProducer CloseProducer { get; set; }
+
+    [global::ProtoBuf.ProtoMember(16, Name = @"close_consumer")]
+    public CommandCloseConsumer CloseConsumer { get; set; }
+
+    [global::ProtoBuf.ProtoMember(17, Name = @"producer_success")]
+    public CommandProducerSuccess ProducerSuccess { get; set; }
+
+    [global::ProtoBuf.ProtoMember(18, Name = @"ping")]
+    public CommandPing Ping { get; set; }
+
+    [global::ProtoBuf.ProtoMember(19, Name = @"pong")]
+    public CommandPong Pong { get; set; }
+
+    [global::ProtoBuf.ProtoMember(20)]
+    public CommandRedeliverUnacknowledgedMessages RedeliverUnacknowledgedMessages { get; set; }
+
+    [global::ProtoBuf.ProtoMember(21)]
+    public CommandPartitionedTopicMetadata PartitionMetadata { get; set; }
+
+    [global::ProtoBuf.ProtoMember(22)]
+    public CommandPartitionedTopicMetadataResponse PartitionMetadataResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(23)]
+    public CommandLookupTopic LookupTopic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(24)]
+    public CommandLookupTopicResponse LookupTopicResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(25)]
+    public CommandConsumerStats ConsumerStats { get; set; }
+
+    [global::ProtoBuf.ProtoMember(26)]
+    public CommandConsumerStatsResponse ConsumerStatsResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(27)]
+    public CommandReachedEndOfTopic ReachedEndOfTopic { get; set; }
+
+    [global::ProtoBuf.ProtoMember(28, Name = @"seek")]
+    public CommandSeek Seek { get; set; }
+
+    [global::ProtoBuf.ProtoMember(29)]
+    public CommandGetLastMessageId GetLastMessageId { get; set; }
+
+    [global::ProtoBuf.ProtoMember(30)]
+    public CommandGetLastMessageIdResponse GetLastMessageIdResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(31, Name = @"active_consumer_change")]
+    public CommandActiveConsumerChange ActiveConsumerChange { get; set; }
+
+    [global::ProtoBuf.ProtoMember(32)]
+    public CommandGetTopicsOfNamespace GetTopicsOfNamespace { get; set; }
+
+    [global::ProtoBuf.ProtoMember(33)]
+    public CommandGetTopicsOfNamespaceResponse GetTopicsOfNamespaceResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(34)]
+    public CommandGetSchema GetSchema { get; set; }
+
+    [global::ProtoBuf.ProtoMember(35)]
+    public CommandGetSchemaResponse GetSchemaResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(36)]
+    public CommandAuthChallenge AuthChallenge { get; set; }
+
+    [global::ProtoBuf.ProtoMember(37)]
+    public CommandAuthResponse AuthResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(38)]
+    public CommandAckResponse AckResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(39)]
+    public CommandGetOrCreateSchema GetOrCreateSchema { get; set; }
+
+    [global::ProtoBuf.ProtoMember(40)]
+    public CommandGetOrCreateSchemaResponse GetOrCreateSchemaResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(50)]
+    public CommandNewTxn NewTxn { get; set; }
+
+    [global::ProtoBuf.ProtoMember(51)]
+    public CommandNewTxnResponse NewTxnResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(52)]
+    public CommandAddPartitionToTxn AddPartitionToTxn { get; set; }
+
+    [global::ProtoBuf.ProtoMember(53)]
+    public CommandAddPartitionToTxnResponse AddPartitionToTxnResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(54)]
+    public CommandAddSubscriptionToTxn AddSubscriptionToTxn { get; set; }
+
+    [global::ProtoBuf.ProtoMember(55)]
+    public CommandAddSubscriptionToTxnResponse AddSubscriptionToTxnResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(56)]
+    public CommandEndTxn EndTxn { get; set; }
+
+    [global::ProtoBuf.ProtoMember(57)]
+    public CommandEndTxnResponse EndTxnResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(58)]
+    public CommandEndTxnOnPartition EndTxnOnPartition { get; set; }
+
+    [global::ProtoBuf.ProtoMember(59)]
+    public CommandEndTxnOnPartitionResponse EndTxnOnPartitionResponse { get; set; }
+
+    [global::ProtoBuf.ProtoMember(60)]
+    public CommandEndTxnOnSubscription EndTxnOnSubscription { get; set; }
+
+    [global::ProtoBuf.ProtoMember(61)]
+    public CommandEndTxnOnSubscriptionResponse EndTxnOnSubscriptionResponse { get; set; }
+
+    [global::ProtoBuf.ProtoContract()]
+    public enum Type
+    {
+        [global::ProtoBuf.ProtoEnum(Name = @"CONNECT")]
+        Connect = 2,
+        [global::ProtoBuf.ProtoEnum(Name = @"CONNECTED")]
+        Connected = 3,
+        [global::ProtoBuf.ProtoEnum(Name = @"SUBSCRIBE")]
+        Subscribe = 4,
+        [global::ProtoBuf.ProtoEnum(Name = @"PRODUCER")]
+        Producer = 5,
+        [global::ProtoBuf.ProtoEnum(Name = @"SEND")]
+        Send = 6,
+        [global::ProtoBuf.ProtoEnum(Name = @"SEND_RECEIPT")]
+        SendReceipt = 7,
+        [global::ProtoBuf.ProtoEnum(Name = @"SEND_ERROR")]
+        SendError = 8,
+        [global::ProtoBuf.ProtoEnum(Name = @"MESSAGE")]
+        Message = 9,
+        [global::ProtoBuf.ProtoEnum(Name = @"ACK")]
+        Ack = 10,
+        [global::ProtoBuf.ProtoEnum(Name = @"FLOW")]
+        Flow = 11,
+        [global::ProtoBuf.ProtoEnum(Name = @"UNSUBSCRIBE")]
+        Unsubscribe = 12,
+        [global::ProtoBuf.ProtoEnum(Name = @"SUCCESS")]
+        Success = 13,
+        [global::ProtoBuf.ProtoEnum(Name = @"ERROR")]
+        Error = 14,
+        [global::ProtoBuf.ProtoEnum(Name = @"CLOSE_PRODUCER")]
+        CloseProducer = 15,
+        [global::ProtoBuf.ProtoEnum(Name = @"CLOSE_CONSUMER")]
+        CloseConsumer = 16,
+        [global::ProtoBuf.ProtoEnum(Name = @"PRODUCER_SUCCESS")]
+        ProducerSuccess = 17,
+        [global::ProtoBuf.ProtoEnum(Name = @"PING")]
+        Ping = 18,
+        [global::ProtoBuf.ProtoEnum(Name = @"PONG")]
+        Pong = 19,
+        [global::ProtoBuf.ProtoEnum(Name = @"REDELIVER_UNACKNOWLEDGED_MESSAGES")]
+        RedeliverUnacknowledgedMessages = 20,
+        [global::ProtoBuf.ProtoEnum(Name = @"PARTITIONED_METADATA")]
+        PartitionedMetadata = 21,
+        [global::ProtoBuf.ProtoEnum(Name = @"PARTITIONED_METADATA_RESPONSE")]
+        PartitionedMetadataResponse = 22,
+        [global::ProtoBuf.ProtoEnum(Name = @"LOOKUP")]
+        Lookup = 23,
+        [global::ProtoBuf.ProtoEnum(Name = @"LOOKUP_RESPONSE")]
+        LookupResponse = 24,
+        [global::ProtoBuf.ProtoEnum(Name = @"CONSUMER_STATS")]
+        ConsumerStats = 25,
+        [global::ProtoBuf.ProtoEnum(Name = @"CONSUMER_STATS_RESPONSE")]
+        ConsumerStatsResponse = 26,
+        [global::ProtoBuf.ProtoEnum(Name = @"REACHED_END_OF_TOPIC")]
+        ReachedEndOfTopic = 27,
+        [global::ProtoBuf.ProtoEnum(Name = @"SEEK")]
+        Seek = 28,
+        [global::ProtoBuf.ProtoEnum(Name = @"GET_LAST_MESSAGE_ID")]
+        GetLastMessageId = 29,
+        [global::ProtoBuf.ProtoEnum(Name = @"GET_LAST_MESSAGE_ID_RESPONSE")]
+        GetLastMessageIdResponse = 30,
+        [global::ProtoBuf.ProtoEnum(Name = @"ACTIVE_CONSUMER_CHANGE")]
+        ActiveConsumerChange = 31,
+        [global::ProtoBuf.ProtoEnum(Name = @"GET_TOPICS_OF_NAMESPACE")]
+        GetTopicsOfNamespace = 32,
+        [global::ProtoBuf.ProtoEnum(Name = @"GET_TOPICS_OF_NAMESPACE_RESPONSE")]
+        GetTopicsOfNamespaceResponse = 33,
+        [global::ProtoBuf.ProtoEnum(Name = @"GET_SCHEMA")]
+        GetSchema = 34,
+        [global::ProtoBuf.ProtoEnum(Name = @"GET_SCHEMA_RESPONSE")]
+        GetSchemaResponse = 35,
+        [global::ProtoBuf.ProtoEnum(Name = @"AUTH_CHALLENGE")]
+        AuthChallenge = 36,
+        [global::ProtoBuf.ProtoEnum(Name = @"AUTH_RESPONSE")]
+        AuthResponse = 37,
+        [global::ProtoBuf.ProtoEnum(Name = @"ACK_RESPONSE")]
+        AckResponse = 38,
+        [global::ProtoBuf.ProtoEnum(Name = @"GET_OR_CREATE_SCHEMA")]
+        GetOrCreateSchema = 39,
+        [global::ProtoBuf.ProtoEnum(Name = @"GET_OR_CREATE_SCHEMA_RESPONSE")]
+        GetOrCreateSchemaResponse = 40,
+        [global::ProtoBuf.ProtoEnum(Name = @"NEW_TXN")]
+        NewTxn = 50,
+        [global::ProtoBuf.ProtoEnum(Name = @"NEW_TXN_RESPONSE")]
+        NewTxnResponse = 51,
+        [global::ProtoBuf.ProtoEnum(Name = @"ADD_PARTITION_TO_TXN")]
+        AddPartitionToTxn = 52,
+        [global::ProtoBuf.ProtoEnum(Name = @"ADD_PARTITION_TO_TXN_RESPONSE")]
+        AddPartitionToTxnResponse = 53,
+        [global::ProtoBuf.ProtoEnum(Name = @"ADD_SUBSCRIPTION_TO_TXN")]
+        AddSubscriptionToTxn = 54,
+        [global::ProtoBuf.ProtoEnum(Name = @"ADD_SUBSCRIPTION_TO_TXN_RESPONSE")]
+        AddSubscriptionToTxnResponse = 55,
+        [global::ProtoBuf.ProtoEnum(Name = @"END_TXN")]
+        EndTxn = 56,
+        [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_RESPONSE")]
+        EndTxnResponse = 57,
+        [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_ON_PARTITION")]
+        EndTxnOnPartition = 58,
+        [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_ON_PARTITION_RESPONSE")]
+        EndTxnOnPartitionResponse = 59,
+        [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_ON_SUBSCRIPTION")]
+        EndTxnOnSubscription = 60,
+        [global::ProtoBuf.ProtoEnum(Name = @"END_TXN_ON_SUBSCRIPTION_RESPONSE")]
+        EndTxnOnSubscriptionResponse = 61,
+    }
+
+}
+
+[global::ProtoBuf.ProtoContract()]
+public enum CompressionType
+{
+    [global::ProtoBuf.ProtoEnum(Name = @"NONE")]
+    None = 0,
+    [global::ProtoBuf.ProtoEnum(Name = @"LZ4")]
+    Lz4 = 1,
+    [global::ProtoBuf.ProtoEnum(Name = @"ZLIB")]
+    Zlib = 2,
+    [global::ProtoBuf.ProtoEnum(Name = @"ZSTD")]
+    Zstd = 3,
+    [global::ProtoBuf.ProtoEnum(Name = @"SNAPPY")]
+    Snappy = 4,
+}
+
+[global::ProtoBuf.ProtoContract()]
+public enum ServerError
+{
+    UnknownError = 0,
+    MetadataError = 1,
+    PersistenceError = 2,
+    AuthenticationError = 3,
+    AuthorizationError = 4,
+    ConsumerBusy = 5,
+    ServiceNotReady = 6,
+    ProducerBlockedQuotaExceededError = 7,
+    ProducerBlockedQuotaExceededException = 8,
+    ChecksumError = 9,
+    UnsupportedVersionError = 10,
+    TopicNotFound = 11,
+    SubscriptionNotFound = 12,
+    ConsumerNotFound = 13,
+    TooManyRequests = 14,
+    TopicTerminatedError = 15,
+    ProducerBusy = 16,
+    InvalidTopicName = 17,
+    IncompatibleSchema = 18,
+    ConsumerAssignError = 19,
+    TransactionCoordinatorNotFound = 20,
+    InvalidTxnStatus = 21,
+    NotAllowedError = 22,
+    TransactionConflict = 23,
+}
+
+[global::ProtoBuf.ProtoContract()]
+public enum AuthMethod
+{
+    AuthMethodNone = 0,
+    AuthMethodYcaV1 = 1,
+    AuthMethodAthens = 2,
+}
+
+[global::ProtoBuf.ProtoContract()]
+public enum ProtocolVersion
+{
+    [global::ProtoBuf.ProtoEnum(Name = @"v0")]
+    V0 = 0,
+    [global::ProtoBuf.ProtoEnum(Name = @"v1")]
+    V1 = 1,
+    [global::ProtoBuf.ProtoEnum(Name = @"v2")]
+    V2 = 2,
+    [global::ProtoBuf.ProtoEnum(Name = @"v3")]
+    V3 = 3,
+    [global::ProtoBuf.ProtoEnum(Name = @"v4")]
+    V4 = 4,
+    [global::ProtoBuf.ProtoEnum(Name = @"v5")]
+    V5 = 5,
+    [global::ProtoBuf.ProtoEnum(Name = @"v6")]
+    V6 = 6,
+    [global::ProtoBuf.ProtoEnum(Name = @"v7")]
+    V7 = 7,
+    [global::ProtoBuf.ProtoEnum(Name = @"v8")]
+    V8 = 8,
+    [global::ProtoBuf.ProtoEnum(Name = @"v9")]
+    V9 = 9,
+    [global::ProtoBuf.ProtoEnum(Name = @"v10")]
+    V10 = 10,
+    [global::ProtoBuf.ProtoEnum(Name = @"v11")]
+    V11 = 11,
+    [global::ProtoBuf.ProtoEnum(Name = @"v12")]
+    V12 = 12,
+    [global::ProtoBuf.ProtoEnum(Name = @"v13")]
+    V13 = 13,
+    [global::ProtoBuf.ProtoEnum(Name = @"v14")]
+    V14 = 14,
+    [global::ProtoBuf.ProtoEnum(Name = @"v15")]
+    V15 = 15,
+}
+
+[global::ProtoBuf.ProtoContract()]
+public enum KeySharedMode
+{
+    [global::ProtoBuf.ProtoEnum(Name = @"AUTO_SPLIT")]
+    AutoSplit = 0,
+    [global::ProtoBuf.ProtoEnum(Name = @"STICKY")]
+    Sticky = 1,
+}
+
+[global::ProtoBuf.ProtoContract()]
+public enum TxnAction
+{
+    [global::ProtoBuf.ProtoEnum(Name = @"COMMIT")]
+    Commit = 0,
+    [global::ProtoBuf.ProtoEnum(Name = @"ABORT")]
+    Abort = 1,
 }
 
 #pragma warning restore CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
diff --git a/src/DotPulsar/Internal/PulsarClientBuilder.cs b/src/DotPulsar/Internal/PulsarClientBuilder.cs
index bc5066f..fa06e04 100644
--- a/src/DotPulsar/Internal/PulsarClientBuilder.cs
+++ b/src/DotPulsar/Internal/PulsarClientBuilder.cs
@@ -12,154 +12,153 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using PulsarApi;
+using System;
+using System.Collections.Generic;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+
+public sealed class PulsarClientBuilder : IPulsarClientBuilder
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using PulsarApi;
-    using System;
-    using System.Collections.Generic;
-    using System.Security.Cryptography.X509Certificates;
-    using System.Text;
+    private readonly CommandConnect _commandConnect;
+    private readonly List<IHandleException> _exceptionHandlers;
+    private EncryptionPolicy? _encryptionPolicy;
+    private TimeSpan _keepAliveInterval;
+    private string? _listenerName;
+    private TimeSpan _retryInterval;
+    private Uri _serviceUrl;
+    private X509Certificate2? _trustedCertificateAuthority;
+    private readonly X509Certificate2Collection _clientCertificates;
+    private bool _verifyCertificateAuthority;
+    private bool _verifyCertificateName;
+    private TimeSpan _closeInactiveConnectionsInterval;
 
-    public sealed class PulsarClientBuilder : IPulsarClientBuilder
+    public PulsarClientBuilder()
     {
-        private readonly CommandConnect _commandConnect;
-        private readonly List<IHandleException> _exceptionHandlers;
-        private EncryptionPolicy? _encryptionPolicy;
-        private TimeSpan _keepAliveInterval;
-        private string? _listenerName;
-        private TimeSpan _retryInterval;
-        private Uri _serviceUrl;
-        private X509Certificate2? _trustedCertificateAuthority;
-        private readonly X509Certificate2Collection _clientCertificates;
-        private bool _verifyCertificateAuthority;
-        private bool _verifyCertificateName;
-        private TimeSpan _closeInactiveConnectionsInterval;
-
-        public PulsarClientBuilder()
+        _commandConnect = new CommandConnect
         {
-            _commandConnect = new CommandConnect
-            {
-                ProtocolVersion = Constants.ProtocolVersion,
-                ClientVersion = $"{Constants.ClientName} {Constants.ClientVersion}"
-            };
+            ProtocolVersion = Constants.ProtocolVersion,
+            ClientVersion = $"{Constants.ClientName} {Constants.ClientVersion}"
+        };
 
-            _exceptionHandlers = new List<IHandleException>();
-            _keepAliveInterval = TimeSpan.FromSeconds(30);
-            _retryInterval = TimeSpan.FromSeconds(3);
-            _serviceUrl = new Uri($"{Constants.PulsarScheme}://localhost:{Constants.DefaultPulsarPort}");
-            _clientCertificates = new X509Certificate2Collection();
-            _verifyCertificateAuthority = true;
-            _verifyCertificateName = false;
-            _closeInactiveConnectionsInterval = TimeSpan.FromSeconds(60);
-        }
+        _exceptionHandlers = new List<IHandleException>();
+        _keepAliveInterval = TimeSpan.FromSeconds(30);
+        _retryInterval = TimeSpan.FromSeconds(3);
+        _serviceUrl = new Uri($"{Constants.PulsarScheme}://localhost:{Constants.DefaultPulsarPort}");
+        _clientCertificates = new X509Certificate2Collection();
+        _verifyCertificateAuthority = true;
+        _verifyCertificateName = false;
+        _closeInactiveConnectionsInterval = TimeSpan.FromSeconds(60);
+    }
 
-        public IPulsarClientBuilder AuthenticateUsingClientCertificate(X509Certificate2 clientCertificate)
+    public IPulsarClientBuilder AuthenticateUsingClientCertificate(X509Certificate2 clientCertificate)
+    {
+        _commandConnect.AuthMethodName = "tls";
+        _clientCertificates.Add(clientCertificate);
+        return this;
+    }
+
+    public IPulsarClientBuilder AuthenticateUsingToken(string token)
+    {
+        _commandConnect.AuthMethodName = "token";
+        _commandConnect.AuthData = Encoding.UTF8.GetBytes(token);
+        return this;
+    }
+
+    public IPulsarClientBuilder ConnectionSecurity(EncryptionPolicy encryptionPolicy)
+    {
+        _encryptionPolicy = encryptionPolicy;
+        return this;
+    }
+
+    public IPulsarClientBuilder ExceptionHandler(IHandleException exceptionHandler)
+    {
+        _exceptionHandlers.Add(exceptionHandler);
+        return this;
+    }
+
+    public IPulsarClientBuilder KeepAliveInterval(TimeSpan interval)
+    {
+        _keepAliveInterval = interval;
+        return this;
+    }
+
+    public IPulsarClientBuilder ListenerName(string listenerName)
+    {
+        _listenerName = listenerName;
+        return this;
+    }
+
+    public IPulsarClientBuilder RetryInterval(TimeSpan interval)
+    {
+        _retryInterval = interval;
+        return this;
+    }
+
+    public IPulsarClientBuilder ServiceUrl(Uri uri)
+    {
+        _serviceUrl = uri;
+        return this;
+    }
+
+    public IPulsarClientBuilder TrustedCertificateAuthority(X509Certificate2 trustedCertificateAuthority)
+    {
+        _trustedCertificateAuthority = trustedCertificateAuthority;
+        return this;
+    }
+
+    public IPulsarClientBuilder VerifyCertificateAuthority(bool verifyCertificateAuthority)
+    {
+        _verifyCertificateAuthority = verifyCertificateAuthority;
+        return this;
+    }
+
+    public IPulsarClientBuilder VerifyCertificateName(bool verifyCertificateName)
+    {
+        _verifyCertificateName = verifyCertificateName;
+        return this;
+    }
+
+    public IPulsarClientBuilder CloseInactiveConnectionsInterval(TimeSpan interval)
+    {
+        _closeInactiveConnectionsInterval = interval;
+        return this;
+    }
+
+    public IPulsarClient Build()
+    {
+        var scheme = _serviceUrl.Scheme;
+
+        if (scheme == Constants.PulsarScheme)
         {
-            _commandConnect.AuthMethodName = "tls";
-            _clientCertificates.Add(clientCertificate);
-            return this;
-        }
+            _encryptionPolicy ??= EncryptionPolicy.EnforceUnencrypted;
 
-        public IPulsarClientBuilder AuthenticateUsingToken(string token)
+            if (_encryptionPolicy.Value == EncryptionPolicy.EnforceEncrypted)
+                throw new ConnectionSecurityException(
+                    $"The scheme of the ServiceUrl ({_serviceUrl}) is '{Constants.PulsarScheme}' and cannot be used with an encryption policy of 'EnforceEncrypted'");
+        }
+        else if (scheme == Constants.PulsarSslScheme)
         {
-            _commandConnect.AuthMethodName = "token";
-            _commandConnect.AuthData = Encoding.UTF8.GetBytes(token);
-            return this;
+            _encryptionPolicy ??= EncryptionPolicy.EnforceEncrypted;
+
+            if (_encryptionPolicy.Value == EncryptionPolicy.EnforceUnencrypted)
+                throw new ConnectionSecurityException(
+                    $"The scheme of the ServiceUrl ({_serviceUrl}) is '{Constants.PulsarSslScheme}' and cannot be used with an encryption policy of 'EnforceUnencrypted'");
         }
-
-        public IPulsarClientBuilder ConnectionSecurity(EncryptionPolicy encryptionPolicy)
-        {
-            _encryptionPolicy = encryptionPolicy;
-            return this;
-        }
-
-        public IPulsarClientBuilder ExceptionHandler(IHandleException exceptionHandler)
-        {
-            _exceptionHandlers.Add(exceptionHandler);
-            return this;
-        }
-
-        public IPulsarClientBuilder KeepAliveInterval(TimeSpan interval)
-        {
-            _keepAliveInterval = interval;
-            return this;
-        }
-
-        public IPulsarClientBuilder ListenerName(string listenerName)
-        {
-            _listenerName = listenerName;
-            return this;
-        }
-
-        public IPulsarClientBuilder RetryInterval(TimeSpan interval)
-        {
-            _retryInterval = interval;
-            return this;
-        }
-
-        public IPulsarClientBuilder ServiceUrl(Uri uri)
-        {
-            _serviceUrl = uri;
-            return this;
-        }
-
-        public IPulsarClientBuilder TrustedCertificateAuthority(X509Certificate2 trustedCertificateAuthority)
-        {
-            _trustedCertificateAuthority = trustedCertificateAuthority;
-            return this;
-        }
-
-        public IPulsarClientBuilder VerifyCertificateAuthority(bool verifyCertificateAuthority)
-        {
-            _verifyCertificateAuthority = verifyCertificateAuthority;
-            return this;
-        }
-
-        public IPulsarClientBuilder VerifyCertificateName(bool verifyCertificateName)
-        {
-            _verifyCertificateName = verifyCertificateName;
-            return this;
-        }
-
-        public IPulsarClientBuilder CloseInactiveConnectionsInterval(TimeSpan interval)
-        {
-            _closeInactiveConnectionsInterval = interval;
-            return this;
-        }
-
-        public IPulsarClient Build()
-        {
-            var scheme = _serviceUrl.Scheme;
-
-            if (scheme == Constants.PulsarScheme)
-            {
-                _encryptionPolicy ??= EncryptionPolicy.EnforceUnencrypted;
-
-                if (_encryptionPolicy.Value == EncryptionPolicy.EnforceEncrypted)
-                    throw new ConnectionSecurityException(
-                        $"The scheme of the ServiceUrl ({_serviceUrl}) is '{Constants.PulsarScheme}' and cannot be used with an encryption policy of 'EnforceEncrypted'");
-            }
-            else if (scheme == Constants.PulsarSslScheme)
-            {
-                _encryptionPolicy ??= EncryptionPolicy.EnforceEncrypted;
-
-                if (_encryptionPolicy.Value == EncryptionPolicy.EnforceUnencrypted)
-                    throw new ConnectionSecurityException(
-                        $"The scheme of the ServiceUrl ({_serviceUrl}) is '{Constants.PulsarSslScheme}' and cannot be used with an encryption policy of 'EnforceUnencrypted'");
-            }
-            else
-                throw new InvalidSchemeException($"Invalid scheme '{scheme}'. Expected '{Constants.PulsarScheme}' or '{Constants.PulsarSslScheme}'");
+        else
+            throw new InvalidSchemeException($"Invalid scheme '{scheme}'. Expected '{Constants.PulsarScheme}' or '{Constants.PulsarSslScheme}'");
 
 
-            var connector = new Connector(_clientCertificates, _trustedCertificateAuthority, _verifyCertificateAuthority, _verifyCertificateName);
-            var connectionPool = new ConnectionPool(_commandConnect, _serviceUrl, connector, _encryptionPolicy.Value, _closeInactiveConnectionsInterval, _listenerName, _keepAliveInterval);
-            var processManager = new ProcessManager(connectionPool);
-            var exceptionHandlers = new List<IHandleException>(_exceptionHandlers) { new DefaultExceptionHandler(_retryInterval) };
-            var exceptionHandlerPipeline = new ExceptionHandlerPipeline(exceptionHandlers);
+        var connector = new Connector(_clientCertificates, _trustedCertificateAuthority, _verifyCertificateAuthority, _verifyCertificateName);
+        var connectionPool = new ConnectionPool(_commandConnect, _serviceUrl, connector, _encryptionPolicy.Value, _closeInactiveConnectionsInterval, _listenerName, _keepAliveInterval);
+        var processManager = new ProcessManager(connectionPool);
+        var exceptionHandlers = new List<IHandleException>(_exceptionHandlers) { new DefaultExceptionHandler(_retryInterval) };
+        var exceptionHandlerPipeline = new ExceptionHandlerPipeline(exceptionHandlers);
 
-            return new PulsarClient(connectionPool, processManager, exceptionHandlerPipeline, _serviceUrl);
-        }
+        return new PulsarClient(connectionPool, processManager, exceptionHandlerPipeline, _serviceUrl);
     }
 }
diff --git a/src/DotPulsar/Internal/PulsarClientFactory.cs b/src/DotPulsar/Internal/PulsarClientFactory.cs
index e703f73..0bae8c1 100644
--- a/src/DotPulsar/Internal/PulsarClientFactory.cs
+++ b/src/DotPulsar/Internal/PulsarClientFactory.cs
@@ -12,15 +12,14 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
-{
-    using Abstractions;
-    using DotPulsar.Abstractions;
-    using System;
+namespace DotPulsar.Internal;
 
-    public sealed class PulsarClientFactory
-    {
-        public static PulsarClient CreatePulsarClient(IConnectionPool connectionPool, ProcessManager processManager, IHandleException exceptionHandler, Uri serviceUrl)
-            => new(connectionPool, processManager, exceptionHandler, serviceUrl);
-    }
+using Abstractions;
+using DotPulsar.Abstractions;
+using System;
+
+public sealed class PulsarClientFactory
+{
+    public static PulsarClient CreatePulsarClient(IConnectionPool connectionPool, ProcessManager processManager, IHandleException exceptionHandler, Uri serviceUrl)
+        => new(connectionPool, processManager, exceptionHandler, serviceUrl);
 }
diff --git a/src/DotPulsar/Internal/PulsarStream.cs b/src/DotPulsar/Internal/PulsarStream.cs
index 0584b7f..2bec00b 100644
--- a/src/DotPulsar/Internal/PulsarStream.cs
+++ b/src/DotPulsar/Internal/PulsarStream.cs
@@ -12,56 +12,56 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using Exceptions;
+using Extensions;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Pipelines;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class PulsarStream : IPulsarStream
 {
-    using Abstractions;
-    using Exceptions;
-    using Extensions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
-    using System.IO;
-    using System.IO.Pipelines;
-    using System.Runtime.CompilerServices;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private const long _pauseAtMoreThan10Mb = 10485760;
+    private const long _resumeAt5MbOrLess = 5242881;
+    private const int _chunkSize = 75000;
 
-    public sealed class PulsarStream : IPulsarStream
+    private readonly Stream _stream;
+    private readonly ChunkingPipeline _pipeline;
+    private readonly PipeReader _reader;
+    private readonly PipeWriter _writer;
+    private int _isDisposed;
+
+    public PulsarStream(Stream stream)
     {
-        private const long _pauseAtMoreThan10Mb = 10485760;
-        private const long _resumeAt5MbOrLess = 5242881;
-        private const int _chunkSize = 75000;
+        _stream = stream;
+        _pipeline = new ChunkingPipeline(stream, _chunkSize);
+        var options = new PipeOptions(pauseWriterThreshold: _pauseAtMoreThan10Mb, resumeWriterThreshold: _resumeAt5MbOrLess);
+        var pipe = new Pipe(options);
+        _reader = pipe.Reader;
+        _writer = pipe.Writer;
+    }
 
-        private readonly Stream _stream;
-        private readonly ChunkingPipeline _pipeline;
-        private readonly PipeReader _reader;
-        private readonly PipeWriter _writer;
-        private int _isDisposed;
-
-        public PulsarStream(Stream stream)
-        {
-            _stream = stream;
-            _pipeline = new ChunkingPipeline(stream, _chunkSize);
-            var options = new PipeOptions(pauseWriterThreshold: _pauseAtMoreThan10Mb, resumeWriterThreshold: _resumeAt5MbOrLess);
-            var pipe = new Pipe(options);
-            _reader = pipe.Reader;
-            _writer = pipe.Writer;
-        }
-
-        public async Task Send(ReadOnlySequence<byte> sequence)
-        {
-            ThrowIfDisposed();
-            await _pipeline.Send(sequence).ConfigureAwait(false);
-        }
+    public async Task Send(ReadOnlySequence<byte> sequence)
+    {
+        ThrowIfDisposed();
+        await _pipeline.Send(sequence).ConfigureAwait(false);
+    }
 
 #if NETSTANDARD2_0
-        public ValueTask DisposeAsync()
-        {
-            if (Interlocked.Exchange(ref _isDisposed, 1) == 0)
-                _stream.Dispose();
+    public ValueTask DisposeAsync()
+    {
+        if (Interlocked.Exchange(ref _isDisposed, 1) == 0)
+            _stream.Dispose();
 
-            return new ValueTask();
-        }
+        return new ValueTask();
+    }
 #else
         public async ValueTask DisposeAsync()
         {
@@ -70,90 +70,89 @@
         }
 #endif
 
-        private async Task FillPipe(CancellationToken cancellationToken)
-        {
-            await Task.Yield();
+    private async Task FillPipe(CancellationToken cancellationToken)
+    {
+        await Task.Yield();
 
-            try
-            {
+        try
+        {
 #if NETSTANDARD2_0
-                var buffer = new byte[84999];
+            var buffer = new byte[84999];
 #endif
-                while (true)
-                {
-                    var memory = _writer.GetMemory(84999);
+            while (true)
+            {
+                var memory = _writer.GetMemory(84999);
 #if NETSTANDARD2_0
-                    var bytesRead = await _stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false);
-                    new Memory<byte>(buffer, 0, bytesRead).CopyTo(memory);
+                var bytesRead = await _stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false);
+                new Memory<byte>(buffer, 0, bytesRead).CopyTo(memory);
 #else
                     var bytesRead = await _stream.ReadAsync(memory, cancellationToken).ConfigureAwait(false);
 #endif
-                    if (bytesRead == 0)
-                        break;
+                if (bytesRead == 0)
+                    break;
 
-                    _writer.Advance(bytesRead);
+                _writer.Advance(bytesRead);
 
-                    var result = await _writer.FlushAsync(cancellationToken).ConfigureAwait(false);
+                var result = await _writer.FlushAsync(cancellationToken).ConfigureAwait(false);
 
-                    if (result.IsCompleted)
-                        break;
-                }
-            }
-            catch
-            {
-                // ignored
-            }
-            finally
-            {
-                await _writer.CompleteAsync().ConfigureAwait(false);
+                if (result.IsCompleted)
+                    break;
             }
         }
-
-        public async IAsyncEnumerable<ReadOnlySequence<byte>> Frames([EnumeratorCancellation] CancellationToken cancellationToken)
+        catch
         {
-            ThrowIfDisposed();
+            // ignored
+        }
+        finally
+        {
+            await _writer.CompleteAsync().ConfigureAwait(false);
+        }
+    }
 
-            _ = FillPipe(cancellationToken);
+    public async IAsyncEnumerable<ReadOnlySequence<byte>> Frames([EnumeratorCancellation] CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
 
-            try
+        _ = FillPipe(cancellationToken);
+
+        try
+        {
+            while (true)
             {
+                var result = await _reader.ReadAsync(cancellationToken).ConfigureAwait(false);
+                var buffer = result.Buffer;
+
                 while (true)
                 {
-                    var result = await _reader.ReadAsync(cancellationToken).ConfigureAwait(false);
-                    var buffer = result.Buffer;
-
-                    while (true)
-                    {
-                        if (buffer.Length < 4)
-                            break;
-
-                        var frameSize = buffer.ReadUInt32(0, true);
-                        var totalSize = frameSize + 4;
-
-                        if (buffer.Length < totalSize)
-                            break;
-
-                        yield return buffer.Slice(4, frameSize);
-
-                        buffer = buffer.Slice(totalSize);
-                    }
-
-                    if (result.IsCompleted)
+                    if (buffer.Length < 4)
                         break;
 
-                    _reader.AdvanceTo(buffer.Start);
-                }
-            }
-            finally
-            {
-                await _reader.CompleteAsync().ConfigureAwait(false);
-            }
-        }
+                    var frameSize = buffer.ReadUInt32(0, true);
+                    var totalSize = frameSize + 4;
 
-        private void ThrowIfDisposed()
-        {
-            if (_isDisposed != 0)
-                throw new PulsarStreamDisposedException();
+                    if (buffer.Length < totalSize)
+                        break;
+
+                    yield return buffer.Slice(4, frameSize);
+
+                    buffer = buffer.Slice(totalSize);
+                }
+
+                if (result.IsCompleted)
+                    break;
+
+                _reader.AdvanceTo(buffer.Start);
+            }
         }
+        finally
+        {
+            await _reader.CompleteAsync().ConfigureAwait(false);
+        }
+    }
+
+    private void ThrowIfDisposed()
+    {
+        if (_isDisposed != 0)
+            throw new PulsarStreamDisposedException();
     }
 }
diff --git a/src/DotPulsar/Internal/Reader.cs b/src/DotPulsar/Internal/Reader.cs
index bffcb2d..2bd3f73 100644
--- a/src/DotPulsar/Internal/Reader.cs
+++ b/src/DotPulsar/Internal/Reader.cs
@@ -12,130 +12,129 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using DotPulsar.Internal.PulsarApi;
+using Events;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class Reader<TMessage> : IEstablishNewChannel, IReader<TMessage>
 {
-    using Abstractions;
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using DotPulsar.Internal.PulsarApi;
-    using Events;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly Guid _correlationId;
+    private readonly IRegisterEvent _eventRegister;
+    private IConsumerChannel<TMessage> _channel;
+    private readonly IExecute _executor;
+    private readonly IStateChanged<ReaderState> _state;
+    private readonly IConsumerChannelFactory<TMessage> _factory;
+    private int _isDisposed;
 
-    public sealed class Reader<TMessage> : IEstablishNewChannel, IReader<TMessage>
+    public Uri ServiceUrl { get; }
+    public string Topic { get; }
+
+    public Reader(
+        Guid correlationId,
+        Uri serviceUrl,
+        string topic,
+        IRegisterEvent eventRegister,
+        IConsumerChannel<TMessage> initialChannel,
+        IExecute executor,
+        IStateChanged<ReaderState> state,
+        IConsumerChannelFactory<TMessage> factory)
     {
-        private readonly Guid _correlationId;
-        private readonly IRegisterEvent _eventRegister;
-        private IConsumerChannel<TMessage> _channel;
-        private readonly IExecute _executor;
-        private readonly IStateChanged<ReaderState> _state;
-        private readonly IConsumerChannelFactory<TMessage> _factory;
-        private int _isDisposed;
+        _correlationId = correlationId;
+        ServiceUrl = serviceUrl;
+        Topic = topic;
+        _eventRegister = eventRegister;
+        _channel = initialChannel;
+        _executor = executor;
+        _state = state;
+        _factory = factory;
+        _isDisposed = 0;
 
-        public Uri ServiceUrl { get; }
-        public string Topic { get; }
+        _eventRegister.Register(new ReaderCreated(_correlationId));
+    }
 
-        public Reader(
-            Guid correlationId,
-            Uri serviceUrl,
-            string topic,
-            IRegisterEvent eventRegister,
-            IConsumerChannel<TMessage> initialChannel,
-            IExecute executor,
-            IStateChanged<ReaderState> state,
-            IConsumerChannelFactory<TMessage> factory)
-        {
-            _correlationId = correlationId;
-            ServiceUrl = serviceUrl;
-            Topic = topic;
-            _eventRegister = eventRegister;
-            _channel = initialChannel;
-            _executor = executor;
-            _state = state;
-            _factory = factory;
-            _isDisposed = 0;
+    public async ValueTask<ReaderState> OnStateChangeTo(ReaderState state, CancellationToken cancellationToken)
+        => await _state.StateChangedTo(state, cancellationToken).ConfigureAwait(false);
 
-            _eventRegister.Register(new ReaderCreated(_correlationId));
-        }
+    public async ValueTask<ReaderState> OnStateChangeFrom(ReaderState state, CancellationToken cancellationToken)
+        => await _state.StateChangedFrom(state, cancellationToken).ConfigureAwait(false);
 
-        public async ValueTask<ReaderState> OnStateChangeTo(ReaderState state, CancellationToken cancellationToken)
-            => await _state.StateChangedTo(state, cancellationToken).ConfigureAwait(false);
+    public bool IsFinalState()
+        => _state.IsFinalState();
 
-        public async ValueTask<ReaderState> OnStateChangeFrom(ReaderState state, CancellationToken cancellationToken)
-            => await _state.StateChangedFrom(state, cancellationToken).ConfigureAwait(false);
+    public bool IsFinalState(ReaderState state)
+        => _state.IsFinalState(state);
 
-        public bool IsFinalState()
-            => _state.IsFinalState();
+    public async ValueTask<MessageId> GetLastMessageId(CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
 
-        public bool IsFinalState(ReaderState state)
-            => _state.IsFinalState(state);
+        var getLastMessageId = new CommandGetLastMessageId();
+        return await _executor.Execute(() => GetLastMessageId(getLastMessageId, cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
 
-        public async ValueTask<MessageId> GetLastMessageId(CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
+    private async ValueTask<MessageId> GetLastMessageId(CommandGetLastMessageId command, CancellationToken cancellationToken)
+        => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
 
-            var getLastMessageId = new CommandGetLastMessageId();
-            return await _executor.Execute(() => GetLastMessageId(getLastMessageId, cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
+    public async ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
 
-        private async ValueTask<MessageId> GetLastMessageId(CommandGetLastMessageId command, CancellationToken cancellationToken)
-            => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
+        return await _executor.Execute(() => ReceiveMessage(cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
 
-        public async ValueTask<IMessage<TMessage>> Receive(CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
+    private async ValueTask<IMessage<TMessage>> ReceiveMessage(CancellationToken cancellationToken)
+        => await _channel.Receive(cancellationToken).ConfigureAwait(false);
 
-            return await _executor.Execute(() => ReceiveMessage(cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
+    public async ValueTask Seek(MessageId messageId, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
 
-        private async ValueTask<IMessage<TMessage>> ReceiveMessage(CancellationToken cancellationToken)
-            => await _channel.Receive(cancellationToken).ConfigureAwait(false);
+        var seek = new CommandSeek { MessageId = messageId.ToMessageIdData() };
+        await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
 
-        public async ValueTask Seek(MessageId messageId, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
+    public async ValueTask Seek(ulong publishTime, CancellationToken cancellationToken)
+    {
+        ThrowIfDisposed();
 
-            var seek = new CommandSeek { MessageId = messageId.ToMessageIdData() };
-            await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
+        var seek = new CommandSeek { MessagePublishTime = publishTime };
+        await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
+    }
 
-        public async ValueTask Seek(ulong publishTime, CancellationToken cancellationToken)
-        {
-            ThrowIfDisposed();
+    public async ValueTask DisposeAsync()
+    {
+        if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+            return;
 
-            var seek = new CommandSeek { MessagePublishTime = publishTime };
-            await _executor.Execute(() => Seek(seek, cancellationToken), cancellationToken).ConfigureAwait(false);
-        }
+        _eventRegister.Register(new ReaderDisposed(_correlationId));
+        await _channel.ClosedByClient(CancellationToken.None).ConfigureAwait(false);
+        await _channel.DisposeAsync().ConfigureAwait(false);
+    }
 
-        public async ValueTask DisposeAsync()
-        {
-            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
-                return;
+    private async Task Seek(CommandSeek command, CancellationToken cancellationToken)
+        => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
 
-            _eventRegister.Register(new ReaderDisposed(_correlationId));
-            await _channel.ClosedByClient(CancellationToken.None).ConfigureAwait(false);
-            await _channel.DisposeAsync().ConfigureAwait(false);
-        }
+    public async Task EstablishNewChannel(CancellationToken cancellationToken)
+    {
+        var channel = await _executor.Execute(() => _factory.Create(cancellationToken), cancellationToken).ConfigureAwait(false);
 
-        private async Task Seek(CommandSeek command, CancellationToken cancellationToken)
-            => await _channel.Send(command, cancellationToken).ConfigureAwait(false);
+        var oldChannel = _channel;
+        _channel = channel;
 
-        public async Task EstablishNewChannel(CancellationToken cancellationToken)
-        {
-            var channel = await _executor.Execute(() => _factory.Create(cancellationToken), cancellationToken).ConfigureAwait(false);
+        if (oldChannel is not null)
+            await oldChannel.DisposeAsync().ConfigureAwait(false);
+    }
 
-            var oldChannel = _channel;
-            _channel = channel;
-
-            if (oldChannel is not null)
-                await oldChannel.DisposeAsync().ConfigureAwait(false);
-        }
-
-        private void ThrowIfDisposed()
-        {
-            if (_isDisposed != 0)
-                throw new ReaderDisposedException(GetType().FullName!);
-        }
+    private void ThrowIfDisposed()
+    {
+        if (_isDisposed != 0)
+            throw new ReaderDisposedException(GetType().FullName!);
     }
 }
diff --git a/src/DotPulsar/Internal/ReaderBuilder.cs b/src/DotPulsar/Internal/ReaderBuilder.cs
index f9090da..deb69cb 100644
--- a/src/DotPulsar/Internal/ReaderBuilder.cs
+++ b/src/DotPulsar/Internal/ReaderBuilder.cs
@@ -12,83 +12,82 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+
+public sealed class ReaderBuilder<TMessage> : IReaderBuilder<TMessage>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
+    private readonly IPulsarClient _pulsarClient;
+    private readonly ISchema<TMessage> _schema;
+    private string? _readerName;
+    private uint _messagePrefetchCount;
+    private bool _readCompacted;
+    private MessageId? _startMessageId;
+    private string? _topic;
+    private IHandleStateChanged<ReaderStateChanged>? _stateChangedHandler;
 
-    public sealed class ReaderBuilder<TMessage> : IReaderBuilder<TMessage>
+    public ReaderBuilder(IPulsarClient pulsarClient, ISchema<TMessage> schema)
     {
-        private readonly IPulsarClient _pulsarClient;
-        private readonly ISchema<TMessage> _schema;
-        private string? _readerName;
-        private uint _messagePrefetchCount;
-        private bool _readCompacted;
-        private MessageId? _startMessageId;
-        private string? _topic;
-        private IHandleStateChanged<ReaderStateChanged>? _stateChangedHandler;
+        _pulsarClient = pulsarClient;
+        _schema = schema;
+        _messagePrefetchCount = ReaderOptions<TMessage>.DefaultMessagePrefetchCount;
+        _readCompacted = ReaderOptions<TMessage>.DefaultReadCompacted;
+    }
 
-        public ReaderBuilder(IPulsarClient pulsarClient, ISchema<TMessage> schema)
+    public IReaderBuilder<TMessage> MessagePrefetchCount(uint count)
+    {
+        _messagePrefetchCount = count;
+        return this;
+    }
+
+    public IReaderBuilder<TMessage> ReadCompacted(bool readCompacted)
+    {
+        _readCompacted = readCompacted;
+        return this;
+    }
+
+    public IReaderBuilder<TMessage> ReaderName(string name)
+    {
+        _readerName = name;
+        return this;
+    }
+
+    public IReaderBuilder<TMessage> StartMessageId(MessageId messageId)
+    {
+        _startMessageId = messageId;
+        return this;
+    }
+
+    public IReaderBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ReaderStateChanged> handler)
+    {
+        _stateChangedHandler = handler;
+        return this;
+    }
+
+    public IReaderBuilder<TMessage> Topic(string topic)
+    {
+        _topic = topic;
+        return this;
+    }
+
+    public IReader<TMessage> Create()
+    {
+        if (_startMessageId is null)
+            throw new ConfigurationException("StartMessageId may not be null");
+
+        if (string.IsNullOrEmpty(_topic))
+            throw new ConfigurationException("Topic may not be null or empty");
+
+        var options = new ReaderOptions<TMessage>(_startMessageId, _topic!, _schema)
         {
-            _pulsarClient = pulsarClient;
-            _schema = schema;
-            _messagePrefetchCount = ReaderOptions<TMessage>.DefaultMessagePrefetchCount;
-            _readCompacted = ReaderOptions<TMessage>.DefaultReadCompacted;
-        }
+            MessagePrefetchCount = _messagePrefetchCount,
+            ReadCompacted = _readCompacted,
+            ReaderName = _readerName,
+            StateChangedHandler = _stateChangedHandler
+        };
 
-        public IReaderBuilder<TMessage> MessagePrefetchCount(uint count)
-        {
-            _messagePrefetchCount = count;
-            return this;
-        }
-
-        public IReaderBuilder<TMessage> ReadCompacted(bool readCompacted)
-        {
-            _readCompacted = readCompacted;
-            return this;
-        }
-
-        public IReaderBuilder<TMessage> ReaderName(string name)
-        {
-            _readerName = name;
-            return this;
-        }
-
-        public IReaderBuilder<TMessage> StartMessageId(MessageId messageId)
-        {
-            _startMessageId = messageId;
-            return this;
-        }
-
-        public IReaderBuilder<TMessage> StateChangedHandler(IHandleStateChanged<ReaderStateChanged> handler)
-        {
-            _stateChangedHandler = handler;
-            return this;
-        }
-
-        public IReaderBuilder<TMessage> Topic(string topic)
-        {
-            _topic = topic;
-            return this;
-        }
-
-        public IReader<TMessage> Create()
-        {
-            if (_startMessageId is null)
-                throw new ConfigurationException("StartMessageId may not be null");
-
-            if (string.IsNullOrEmpty(_topic))
-                throw new ConfigurationException("Topic may not be null or empty");
-
-            var options = new ReaderOptions<TMessage>(_startMessageId, _topic!, _schema)
-            {
-                MessagePrefetchCount = _messagePrefetchCount,
-                ReadCompacted = _readCompacted,
-                ReaderName = _readerName,
-                StateChangedHandler = _stateChangedHandler
-            };
-
-            return _pulsarClient.CreateReader(options);
-        }
+        return _pulsarClient.CreateReader(options);
     }
 }
diff --git a/src/DotPulsar/Internal/ReaderProcess.cs b/src/DotPulsar/Internal/ReaderProcess.cs
index 5dd8cd1..6f4aacf 100644
--- a/src/DotPulsar/Internal/ReaderProcess.cs
+++ b/src/DotPulsar/Internal/ReaderProcess.cs
@@ -12,58 +12,57 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using System;
+using System.Threading.Tasks;
+
+public sealed class ReaderProcess : Process
 {
-    using Abstractions;
-    using System;
-    using System.Threading.Tasks;
+    private readonly IStateManager<ReaderState> _stateManager;
+    private readonly IEstablishNewChannel _reader;
 
-    public sealed class ReaderProcess : Process
+    public ReaderProcess(
+        Guid correlationId,
+        IStateManager<ReaderState> stateManager,
+        IEstablishNewChannel reader) : base(correlationId)
     {
-        private readonly IStateManager<ReaderState> _stateManager;
-        private readonly IEstablishNewChannel _reader;
+        _stateManager = stateManager;
+        _reader = reader;
+    }
 
-        public ReaderProcess(
-            Guid correlationId,
-            IStateManager<ReaderState> stateManager,
-            IEstablishNewChannel reader) : base(correlationId)
+    public override async ValueTask DisposeAsync()
+    {
+        _stateManager.SetState(ReaderState.Closed);
+        CancellationTokenSource.Cancel();
+        await _reader.DisposeAsync().ConfigureAwait(false);
+    }
+
+    protected override void CalculateState()
+    {
+        if (_stateManager.IsFinalState())
+            return;
+
+        if (ExecutorState == ExecutorState.Faulted)
         {
-            _stateManager = stateManager;
-            _reader = reader;
+            _stateManager.SetState(ReaderState.Faulted);
+            return;
         }
 
-        public override async ValueTask DisposeAsync()
+        switch (ChannelState)
         {
-            _stateManager.SetState(ReaderState.Closed);
-            CancellationTokenSource.Cancel();
-            await _reader.DisposeAsync().ConfigureAwait(false);
-        }
-
-        protected override void CalculateState()
-        {
-            if (_stateManager.IsFinalState())
+            case ChannelState.ClosedByServer:
+            case ChannelState.Disconnected:
+                _stateManager.SetState(ReaderState.Disconnected);
+                _ = _reader.EstablishNewChannel(CancellationTokenSource.Token);
                 return;
-
-            if (ExecutorState == ExecutorState.Faulted)
-            {
-                _stateManager.SetState(ReaderState.Faulted);
+            case ChannelState.Connected:
+                _stateManager.SetState(ReaderState.Connected);
                 return;
-            }
-
-            switch (ChannelState)
-            {
-                case ChannelState.ClosedByServer:
-                case ChannelState.Disconnected:
-                    _stateManager.SetState(ReaderState.Disconnected);
-                    _ = _reader.EstablishNewChannel(CancellationTokenSource.Token);
-                    return;
-                case ChannelState.Connected:
-                    _stateManager.SetState(ReaderState.Connected);
-                    return;
-                case ChannelState.ReachedEndOfTopic:
-                    _stateManager.SetState(ReaderState.ReachedEndOfTopic);
-                    return;
-            }
+            case ChannelState.ReachedEndOfTopic:
+                _stateManager.SetState(ReaderState.ReachedEndOfTopic);
+                return;
         }
     }
 }
diff --git a/src/DotPulsar/Internal/RequestId.cs b/src/DotPulsar/Internal/RequestId.cs
index 128ac5e..e5cba66 100644
--- a/src/DotPulsar/Internal/RequestId.cs
+++ b/src/DotPulsar/Internal/RequestId.cs
@@ -12,19 +12,18 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+public sealed class RequestId
 {
-    public sealed class RequestId
-    {
-        private ulong _current;
+    private ulong _current;
 
-        public RequestId()
-            => _current = 0;
+    public RequestId()
+        => _current = 0;
 
-        public bool IsPastInitialId()
-            => _current != 0;
+    public bool IsPastInitialId()
+        => _current != 0;
 
-        public ulong FetchNext()
-            => _current++;
-    }
+    public ulong FetchNext()
+        => _current++;
 }
diff --git a/src/DotPulsar/Internal/RequestResponseHandler.cs b/src/DotPulsar/Internal/RequestResponseHandler.cs
index 011882d..8a0d257 100644
--- a/src/DotPulsar/Internal/RequestResponseHandler.cs
+++ b/src/DotPulsar/Internal/RequestResponseHandler.cs
@@ -12,149 +12,148 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using DotPulsar.Internal.Abstractions;
+using DotPulsar.Internal.Requests;
+using PulsarApi;
+using System;
+using System.Threading.Tasks;
+
+public sealed class RequestResponseHandler : IDisposable
 {
-    using DotPulsar.Internal.Abstractions;
-    using DotPulsar.Internal.Requests;
-    using PulsarApi;
-    using System;
-    using System.Threading.Tasks;
+    private readonly RequestId _requestId;
+    private readonly Awaiter<IRequest, BaseCommand> _requests;
+    private readonly EnumLookup<BaseCommand.Type, Func<BaseCommand, IRequest>> _getResponseIdentifier;
 
-    public sealed class RequestResponseHandler : IDisposable
+    public RequestResponseHandler()
     {
-        private readonly RequestId _requestId;
-        private readonly Awaiter<IRequest, BaseCommand> _requests;
-        private readonly EnumLookup<BaseCommand.Type, Func<BaseCommand, IRequest>> _getResponseIdentifier;
+        _requestId = new RequestId();
+        _requests = new Awaiter<IRequest, BaseCommand>();
 
-        public RequestResponseHandler()
+        _getResponseIdentifier = new EnumLookup<BaseCommand.Type, Func<BaseCommand, IRequest>>(cmd => throw new Exception($"CommandType '{cmd.CommandType}' not supported as request/response type"));
+        _getResponseIdentifier.Set(BaseCommand.Type.Connected, cmd => new ConnectRequest());
+        _getResponseIdentifier.Set(BaseCommand.Type.SendError, cmd => new SendRequest(cmd.SendError.ProducerId, cmd.SendError.SequenceId));
+        _getResponseIdentifier.Set(BaseCommand.Type.SendReceipt, cmd => new SendRequest(cmd.SendReceipt.ProducerId, cmd.SendReceipt.SequenceId));
+        _getResponseIdentifier.Set(BaseCommand.Type.ProducerSuccess, cmd => StandardRequest.WithRequestId(cmd.ProducerSuccess.RequestId));
+        _getResponseIdentifier.Set(BaseCommand.Type.CloseConsumer, cmd => StandardRequest.WithConsumerId(cmd.CloseConsumer.RequestId, cmd.CloseConsumer.ConsumerId));
+        _getResponseIdentifier.Set(BaseCommand.Type.CloseProducer, cmd => StandardRequest.WithProducerId(cmd.CloseProducer.RequestId, cmd.CloseProducer.ProducerId));
+        _getResponseIdentifier.Set(BaseCommand.Type.LookupResponse, cmd => StandardRequest.WithRequestId(cmd.LookupTopicResponse.RequestId));
+        _getResponseIdentifier.Set(BaseCommand.Type.PartitionedMetadataResponse, cmd => StandardRequest.WithRequestId(cmd.PartitionMetadataResponse.RequestId));
+        _getResponseIdentifier.Set(BaseCommand.Type.GetLastMessageIdResponse, cmd => StandardRequest.WithRequestId(cmd.GetLastMessageIdResponse.RequestId));
+        _getResponseIdentifier.Set(BaseCommand.Type.GetOrCreateSchemaResponse, cmd => StandardRequest.WithRequestId(cmd.GetOrCreateSchemaResponse.RequestId));
+        _getResponseIdentifier.Set(BaseCommand.Type.Success, cmd => StandardRequest.WithRequestId(cmd.Success.RequestId));
+        _getResponseIdentifier.Set(BaseCommand.Type.Error, cmd => !_requestId.IsPastInitialId() ? new ConnectRequest() : StandardRequest.WithRequestId(cmd.Error.RequestId));
+    }
+
+    public void Dispose()
+        => _requests.Dispose();
+
+    public Task<BaseCommand> Outgoing(CommandProducer command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        var request = StandardRequest.WithProducerId(command.RequestId, command.ProducerId);
+        return _requests.CreateTask(request);
+    }
+
+    public Task<BaseCommand> Outgoing(CommandCloseProducer command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        var request = StandardRequest.WithProducerId(command.RequestId, command.ProducerId);
+        return _requests.CreateTask(request);
+    }
+
+    public Task<BaseCommand> Outgoing(CommandSubscribe command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        var request = StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId);
+        return _requests.CreateTask(request);
+    }
+
+    public Task<BaseCommand> Outgoing(CommandUnsubscribe command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        var request = StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId);
+        return _requests.CreateTask(request);
+    }
+
+    public Task<BaseCommand> Outgoing(CommandCloseConsumer command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        var request = StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId);
+        return _requests.CreateTask(request);
+    }
+
+    public Task<BaseCommand> Outgoing(CommandSend command)
+    {
+        var request = new SendRequest(command.ProducerId, command.SequenceId);
+        return _requests.CreateTask(request);
+    }
+
+    public Task<BaseCommand> Outgoing(CommandGetOrCreateSchema command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        var request = StandardRequest.WithRequestId(command.RequestId);
+        return _requests.CreateTask(request);
+    }
+
+    public Task<BaseCommand> Outgoing(CommandConnect _1)
+        => _requests.CreateTask(new ConnectRequest());
+
+    public Task<BaseCommand> Outgoing(CommandLookupTopic command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        return _requests.CreateTask(StandardRequest.WithRequestId(command.RequestId));
+    }
+
+    public Task<BaseCommand> Outgoing(CommandPartitionedTopicMetadata command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        return _requests.CreateTask(StandardRequest.WithRequestId(command.RequestId));
+    }
+
+    public Task<BaseCommand> Outgoing(CommandSeek command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        return _requests.CreateTask(StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId, BaseCommand.Type.Seek));
+    }
+
+    public Task<BaseCommand> Outgoing(CommandGetLastMessageId command)
+    {
+        command.RequestId = _requestId.FetchNext();
+        return _requests.CreateTask(StandardRequest.WithRequestId(command.RequestId));
+    }
+
+    public void Incoming(BaseCommand command)
+    {
+        var identifier = _getResponseIdentifier.Get(command.CommandType)(command);
+
+        if (identifier is not null)
+            _requests.SetResult(identifier, command);
+    }
+
+    public void Incoming(CommandCloseConsumer command)
+    {
+        var requests = _requests.Keys;
+        foreach (var request in requests)
         {
-            _requestId = new RequestId();
-            _requests = new Awaiter<IRequest, BaseCommand>();
-
-            _getResponseIdentifier = new EnumLookup<BaseCommand.Type, Func<BaseCommand, IRequest>>(cmd => throw new Exception($"CommandType '{cmd.CommandType}' not supported as request/response type"));
-            _getResponseIdentifier.Set(BaseCommand.Type.Connected, cmd => new ConnectRequest());
-            _getResponseIdentifier.Set(BaseCommand.Type.SendError, cmd => new SendRequest(cmd.SendError.ProducerId, cmd.SendError.SequenceId));
-            _getResponseIdentifier.Set(BaseCommand.Type.SendReceipt, cmd => new SendRequest(cmd.SendReceipt.ProducerId, cmd.SendReceipt.SequenceId));
-            _getResponseIdentifier.Set(BaseCommand.Type.ProducerSuccess, cmd => StandardRequest.WithRequestId(cmd.ProducerSuccess.RequestId));
-            _getResponseIdentifier.Set(BaseCommand.Type.CloseConsumer, cmd => StandardRequest.WithConsumerId(cmd.CloseConsumer.RequestId, cmd.CloseConsumer.ConsumerId));
-            _getResponseIdentifier.Set(BaseCommand.Type.CloseProducer, cmd => StandardRequest.WithProducerId(cmd.CloseProducer.RequestId, cmd.CloseProducer.ProducerId));
-            _getResponseIdentifier.Set(BaseCommand.Type.LookupResponse, cmd => StandardRequest.WithRequestId(cmd.LookupTopicResponse.RequestId));
-            _getResponseIdentifier.Set(BaseCommand.Type.PartitionedMetadataResponse, cmd => StandardRequest.WithRequestId(cmd.PartitionMetadataResponse.RequestId));
-            _getResponseIdentifier.Set(BaseCommand.Type.GetLastMessageIdResponse, cmd => StandardRequest.WithRequestId(cmd.GetLastMessageIdResponse.RequestId));
-            _getResponseIdentifier.Set(BaseCommand.Type.GetOrCreateSchemaResponse, cmd => StandardRequest.WithRequestId(cmd.GetOrCreateSchemaResponse.RequestId));
-            _getResponseIdentifier.Set(BaseCommand.Type.Success, cmd => StandardRequest.WithRequestId(cmd.Success.RequestId));
-            _getResponseIdentifier.Set(BaseCommand.Type.Error, cmd => !_requestId.IsPastInitialId() ? new ConnectRequest() : StandardRequest.WithRequestId(cmd.Error.RequestId));
-        }
-
-        public void Dispose()
-            => _requests.Dispose();
-
-        public Task<BaseCommand> Outgoing(CommandProducer command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            var request = StandardRequest.WithProducerId(command.RequestId, command.ProducerId);
-            return _requests.CreateTask(request);
-        }
-
-        public Task<BaseCommand> Outgoing(CommandCloseProducer command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            var request = StandardRequest.WithProducerId(command.RequestId, command.ProducerId);
-            return _requests.CreateTask(request);
-        }
-
-        public Task<BaseCommand> Outgoing(CommandSubscribe command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            var request = StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId);
-            return _requests.CreateTask(request);
-        }
-
-        public Task<BaseCommand> Outgoing(CommandUnsubscribe command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            var request = StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId);
-            return _requests.CreateTask(request);
-        }
-
-        public Task<BaseCommand> Outgoing(CommandCloseConsumer command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            var request = StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId);
-            return _requests.CreateTask(request);
-        }
-
-        public Task<BaseCommand> Outgoing(CommandSend command)
-        {
-            var request = new SendRequest(command.ProducerId, command.SequenceId);
-            return _requests.CreateTask(request);
-        }
-
-        public Task<BaseCommand> Outgoing(CommandGetOrCreateSchema command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            var request = StandardRequest.WithRequestId(command.RequestId);
-            return _requests.CreateTask(request);
-        }
-
-        public Task<BaseCommand> Outgoing(CommandConnect _1)
-            => _requests.CreateTask(new ConnectRequest());
-
-        public Task<BaseCommand> Outgoing(CommandLookupTopic command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            return _requests.CreateTask(StandardRequest.WithRequestId(command.RequestId));
-        }
-
-        public Task<BaseCommand> Outgoing(CommandPartitionedTopicMetadata command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            return _requests.CreateTask(StandardRequest.WithRequestId(command.RequestId));
-        }
-
-        public Task<BaseCommand> Outgoing(CommandSeek command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            return _requests.CreateTask(StandardRequest.WithConsumerId(command.RequestId, command.ConsumerId, BaseCommand.Type.Seek));
-        }
-
-        public Task<BaseCommand> Outgoing(CommandGetLastMessageId command)
-        {
-            command.RequestId = _requestId.FetchNext();
-            return _requests.CreateTask(StandardRequest.WithRequestId(command.RequestId));
-        }
-
-        public void Incoming(BaseCommand command)
-        {
-            var identifier = _getResponseIdentifier.Get(command.CommandType)(command);
-
-            if (identifier is not null)
-                _requests.SetResult(identifier, command);
-        }
-
-        public void Incoming(CommandCloseConsumer command)
-        {
-            var requests = _requests.Keys;
-            foreach (var request in requests)
+            if (request.SenderIsConsumer(command.ConsumerId))
             {
-                if (request.SenderIsConsumer(command.ConsumerId))
-                {
-                    if (request.IsCommandType(BaseCommand.Type.Seek))
-                        _requests.SetResult(request, new BaseCommand { CommandType = BaseCommand.Type.Success });
-                    else
-                        _requests.Cancel(request);
-                }
-            }
-        }
-
-        public void Incoming(CommandCloseProducer command)
-        {
-            var requests = _requests.Keys;
-            foreach (var request in requests)
-            {
-                if (request.SenderIsProducer(command.ProducerId))
+                if (request.IsCommandType(BaseCommand.Type.Seek))
+                    _requests.SetResult(request, new BaseCommand { CommandType = BaseCommand.Type.Success });
+                else
                     _requests.Cancel(request);
             }
         }
     }
+
+    public void Incoming(CommandCloseProducer command)
+    {
+        var requests = _requests.Keys;
+        foreach (var request in requests)
+        {
+            if (request.SenderIsProducer(command.ProducerId))
+                _requests.Cancel(request);
+        }
+    }
 }
diff --git a/src/DotPulsar/Internal/Requests/ConnectRequest.cs b/src/DotPulsar/Internal/Requests/ConnectRequest.cs
index 18f977c..f4e23a3 100644
--- a/src/DotPulsar/Internal/Requests/ConnectRequest.cs
+++ b/src/DotPulsar/Internal/Requests/ConnectRequest.cs
@@ -12,31 +12,30 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Requests
+namespace DotPulsar.Internal.Requests;
+
+using DotPulsar.Internal.Abstractions;
+using DotPulsar.Internal.PulsarApi;
+using System.Diagnostics.CodeAnalysis;
+
+public struct ConnectRequest : IRequest
 {
-    using DotPulsar.Internal.Abstractions;
-    using DotPulsar.Internal.PulsarApi;
-    using System.Diagnostics.CodeAnalysis;
+    public bool SenderIsConsumer(ulong consumerId)
+        => false;
 
-    public struct ConnectRequest : IRequest
-    {
-        public bool SenderIsConsumer(ulong consumerId)
-            => false;
+    public bool SenderIsProducer(ulong producerId)
+        => false;
 
-        public bool SenderIsProducer(ulong producerId)
-            => false;
-
-        public bool IsCommandType(BaseCommand.Type commandType)
-            => commandType == BaseCommand.Type.Connect;
+    public bool IsCommandType(BaseCommand.Type commandType)
+        => commandType == BaseCommand.Type.Connect;
 
 #if NETSTANDARD2_0
-        public bool Equals(IRequest other)
+    public bool Equals(IRequest other)
 #else
         public bool Equals([AllowNull] IRequest other)
 #endif
             => other is ConnectRequest;
 
-        public override int GetHashCode()
-            => int.MinValue;
-    }
+    public override int GetHashCode()
+        => int.MinValue;
 }
diff --git a/src/DotPulsar/Internal/Requests/SendRequest.cs b/src/DotPulsar/Internal/Requests/SendRequest.cs
index 6023a88..f0ec219 100644
--- a/src/DotPulsar/Internal/Requests/SendRequest.cs
+++ b/src/DotPulsar/Internal/Requests/SendRequest.cs
@@ -12,46 +12,45 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Requests
+namespace DotPulsar.Internal.Requests;
+
+using DotPulsar.Internal.Abstractions;
+using DotPulsar.Internal.PulsarApi;
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+public struct SendRequest : IRequest
 {
-    using DotPulsar.Internal.Abstractions;
-    using DotPulsar.Internal.PulsarApi;
-    using System;
-    using System.Diagnostics.CodeAnalysis;
+    private readonly ulong _producerId;
+    private readonly ulong _sequenceId;
 
-    public struct SendRequest : IRequest
+    public SendRequest(ulong producerId, ulong sequenceId)
     {
-        private readonly ulong _producerId;
-        private readonly ulong _sequenceId;
+        _producerId = producerId;
+        _sequenceId = sequenceId;
+    }
 
-        public SendRequest(ulong producerId, ulong sequenceId)
-        {
-            _producerId = producerId;
-            _sequenceId = sequenceId;
-        }
+    public bool SenderIsConsumer(ulong consumerId)
+        => false;
 
-        public bool SenderIsConsumer(ulong consumerId)
-            => false;
+    public bool SenderIsProducer(ulong producerId)
+        => _producerId == producerId;
 
-        public bool SenderIsProducer(ulong producerId)
-            => _producerId == producerId;
-
-        public bool IsCommandType(BaseCommand.Type commandType)
-            => commandType == BaseCommand.Type.Send;
+    public bool IsCommandType(BaseCommand.Type commandType)
+        => commandType == BaseCommand.Type.Send;
 
 #if NETSTANDARD2_0
-        public bool Equals(IRequest other)
+    public bool Equals(IRequest other)
 #else
         public bool Equals([AllowNull] IRequest other)
 #endif
-        {
-            if (other is SendRequest request)
-                return _producerId.Equals(request._producerId) && _sequenceId.Equals(request._sequenceId);
+    {
+        if (other is SendRequest request)
+            return _producerId.Equals(request._producerId) && _sequenceId.Equals(request._sequenceId);
 
-            return false;
-        }
-
-        public override int GetHashCode()
-            => HashCode.Combine(_producerId, _sequenceId);
+        return false;
     }
+
+    public override int GetHashCode()
+        => HashCode.Combine(_producerId, _sequenceId);
 }
diff --git a/src/DotPulsar/Internal/Requests/StandardRequest.cs b/src/DotPulsar/Internal/Requests/StandardRequest.cs
index 829baff..755107a 100644
--- a/src/DotPulsar/Internal/Requests/StandardRequest.cs
+++ b/src/DotPulsar/Internal/Requests/StandardRequest.cs
@@ -12,59 +12,58 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal.Requests
+namespace DotPulsar.Internal.Requests;
+
+using DotPulsar.Internal.Abstractions;
+using DotPulsar.Internal.PulsarApi;
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+public struct StandardRequest : IRequest
 {
-    using DotPulsar.Internal.Abstractions;
-    using DotPulsar.Internal.PulsarApi;
-    using System;
-    using System.Diagnostics.CodeAnalysis;
+    private readonly ulong _requestId;
+    private readonly ulong? _consumerId;
+    private readonly ulong? _producerId;
+    private readonly BaseCommand.Type? _commandType;
 
-    public struct StandardRequest : IRequest
+    private StandardRequest(ulong requestId, ulong? consumerId, ulong? producerId, BaseCommand.Type? commandType)
     {
-        private readonly ulong _requestId;
-        private readonly ulong? _consumerId;
-        private readonly ulong? _producerId;
-        private readonly BaseCommand.Type? _commandType;
+        _requestId = requestId;
+        _consumerId = consumerId;
+        _producerId = producerId;
+        _commandType = commandType;
+    }
 
-        private StandardRequest(ulong requestId, ulong? consumerId, ulong? producerId, BaseCommand.Type? commandType)
-        {
-            _requestId = requestId;
-            _consumerId = consumerId;
-            _producerId = producerId;
-            _commandType = commandType;
-        }
+    public static StandardRequest WithRequestId(ulong requestId)
+        => new(requestId, null, null, null);
 
-        public static StandardRequest WithRequestId(ulong requestId)
-            => new(requestId, null, null, null);
+    public static StandardRequest WithConsumerId(ulong requestId, ulong consumerId, BaseCommand.Type? commandType = null)
+        => new(requestId, consumerId, null, commandType);
 
-        public static StandardRequest WithConsumerId(ulong requestId, ulong consumerId, BaseCommand.Type? commandType = null)
-            => new(requestId, consumerId, null, commandType);
+    public static StandardRequest WithProducerId(ulong requestId, ulong producerId, BaseCommand.Type? commandType = null)
+        => new(requestId, null, producerId, commandType);
 
-        public static StandardRequest WithProducerId(ulong requestId, ulong producerId, BaseCommand.Type? commandType = null)
-            => new(requestId, null, producerId, commandType);
+    public bool SenderIsConsumer(ulong consumerId)
+        => _consumerId.HasValue && _consumerId.Value == consumerId;
 
-        public bool SenderIsConsumer(ulong consumerId)
-            => _consumerId.HasValue && _consumerId.Value == consumerId;
+    public bool SenderIsProducer(ulong producerId)
+        => _producerId.HasValue && _producerId.Value == producerId;
 
-        public bool SenderIsProducer(ulong producerId)
-            => _producerId.HasValue && _producerId.Value == producerId;
-
-        public bool IsCommandType(BaseCommand.Type commandType)
-            => _commandType.HasValue && _commandType.Value == commandType;
+    public bool IsCommandType(BaseCommand.Type commandType)
+        => _commandType.HasValue && _commandType.Value == commandType;
 
 #if NETSTANDARD2_0
-        public bool Equals(IRequest other)
+    public bool Equals(IRequest other)
 #else
         public bool Equals([AllowNull] IRequest other)
 #endif
-        {
-            if (other is StandardRequest request)
-                return _requestId.Equals(request._requestId);
+    {
+        if (other is StandardRequest request)
+            return _requestId.Equals(request._requestId);
 
-            return false;
-        }
-
-        public override int GetHashCode()
-            => HashCode.Combine(_requestId);
+        return false;
     }
+
+    public override int GetHashCode()
+        => HashCode.Combine(_requestId);
 }
diff --git a/src/DotPulsar/Internal/SendPackage.cs b/src/DotPulsar/Internal/SendPackage.cs
index f1b87db..3693f34 100644
--- a/src/DotPulsar/Internal/SendPackage.cs
+++ b/src/DotPulsar/Internal/SendPackage.cs
@@ -12,15 +12,14 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
-{
-    using PulsarApi;
-    using System.Buffers;
+namespace DotPulsar.Internal;
 
-    public sealed class SendPackage
-    {
-        public CommandSend? Command { get; set; }
-        public MessageMetadata? Metadata { get; set; }
-        public ReadOnlySequence<byte> Payload { get; set; }
-    }
+using PulsarApi;
+using System.Buffers;
+
+public sealed class SendPackage
+{
+    public CommandSend? Command { get; set; }
+    public MessageMetadata? Metadata { get; set; }
+    public ReadOnlySequence<byte> Payload { get; set; }
 }
diff --git a/src/DotPulsar/Internal/SequenceBuilder.cs b/src/DotPulsar/Internal/SequenceBuilder.cs
index d7337b2..900bb12 100644
--- a/src/DotPulsar/Internal/SequenceBuilder.cs
+++ b/src/DotPulsar/Internal/SequenceBuilder.cs
@@ -12,91 +12,90 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Linq;
+
+public sealed class SequenceBuilder<T> where T : notnull
 {
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
-    using System.Linq;
+    private readonly LinkedList<ReadOnlyMemory<T>> _elements;
 
-    public sealed class SequenceBuilder<T> where T : notnull
+    public SequenceBuilder()
+        => _elements = new LinkedList<ReadOnlyMemory<T>>();
+
+    public SequenceBuilder<T> Prepend(ReadOnlyMemory<T> memory)
     {
-        private readonly LinkedList<ReadOnlyMemory<T>> _elements;
+        _elements.AddFirst(memory);
+        return this;
+    }
 
-        public SequenceBuilder()
-            => _elements = new LinkedList<ReadOnlyMemory<T>>();
+    public SequenceBuilder<T> Prepend(ReadOnlySequence<T> sequence)
+    {
+        LinkedListNode<ReadOnlyMemory<T>>? index = null;
 
-        public SequenceBuilder<T> Prepend(ReadOnlyMemory<T> memory)
+        foreach (var memory in sequence)
         {
-            _elements.AddFirst(memory);
-            return this;
+            index = index is null
+                ? _elements.AddFirst(memory)
+                : _elements.AddAfter(index, memory);
         }
 
-        public SequenceBuilder<T> Prepend(ReadOnlySequence<T> sequence)
-        {
-            LinkedListNode<ReadOnlyMemory<T>>? index = null;
+        return this;
+    }
 
-            foreach (var memory in sequence)
-            {
-                index = index is null
-                    ? _elements.AddFirst(memory)
-                    : _elements.AddAfter(index, memory);
-            }
+    public SequenceBuilder<T> Append(ReadOnlyMemory<T> memory)
+    {
+        _elements.AddLast(memory);
+        return this;
+    }
 
-            return this;
-        }
-
-        public SequenceBuilder<T> Append(ReadOnlyMemory<T> memory)
-        {
+    public SequenceBuilder<T> Append(ReadOnlySequence<T> sequence)
+    {
+        foreach (var memory in sequence)
             _elements.AddLast(memory);
-            return this;
-        }
 
-        public SequenceBuilder<T> Append(ReadOnlySequence<T> sequence)
+        return this;
+    }
+
+    public long Length => _elements.Sum(e => e.Length);
+
+    public ReadOnlySequence<T> Build()
+    {
+        var node = _elements.First;
+        if (node is null)
+            return ReadOnlySequence<T>.Empty;
+
+        var current = new Segment(node.Value);
+        var start = current;
+
+        while (true)
         {
-            foreach (var memory in sequence)
-                _elements.AddLast(memory);
-
-            return this;
-        }
-
-        public long Length => _elements.Sum(e => e.Length);
-
-        public ReadOnlySequence<T> Build()
-        {
-            var node = _elements.First;
+            node = node.Next;
             if (node is null)
-                return ReadOnlySequence<T>.Empty;
+                break;
 
-            var current = new Segment(node.Value);
-            var start = current;
-
-            while (true)
-            {
-                node = node.Next;
-                if (node is null)
-                    break;
-
-                current = current.CreateNext(node.Value);
-            }
-
-            return new ReadOnlySequence<T>(start, 0, current, current.Memory.Length);
+            current = current.CreateNext(node.Value);
         }
 
-        private sealed class Segment : ReadOnlySequenceSegment<T>
-        {
-            public Segment(ReadOnlyMemory<T> memory, long runningIndex = 0)
-            {
-                Memory = memory;
-                RunningIndex = runningIndex;
-            }
+        return new ReadOnlySequence<T>(start, 0, current, current.Memory.Length);
+    }
 
-            public Segment CreateNext(ReadOnlyMemory<T> memory)
-            {
-                var segment = new Segment(memory, RunningIndex + Memory.Length);
-                Next = segment;
-                return segment;
-            }
+    private sealed class Segment : ReadOnlySequenceSegment<T>
+    {
+        public Segment(ReadOnlyMemory<T> memory, long runningIndex = 0)
+        {
+            Memory = memory;
+            RunningIndex = runningIndex;
+        }
+
+        public Segment CreateNext(ReadOnlyMemory<T> memory)
+        {
+            var segment = new Segment(memory, RunningIndex + Memory.Length);
+            Next = segment;
+            return segment;
         }
     }
 }
diff --git a/src/DotPulsar/Internal/SequenceId.cs b/src/DotPulsar/Internal/SequenceId.cs
index aba1c25..6ba71b0 100644
--- a/src/DotPulsar/Internal/SequenceId.cs
+++ b/src/DotPulsar/Internal/SequenceId.cs
@@ -12,22 +12,21 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System.Threading;
+
+public sealed class SequenceId
 {
-    using System.Threading;
+    private long _current;
 
-    public sealed class SequenceId
+    public SequenceId(ulong initialSequenceId)
     {
-        private long _current;
-
-        public SequenceId(ulong initialSequenceId)
-        {
-            // Subtracting one because Interlocked.Increment will return the post-incremented value
-            // which is expected to be the initialSequenceId for the first call
-            _current = unchecked((long) initialSequenceId - 1);
-        }
-
-        public ulong FetchNext()
-            => unchecked((ulong) Interlocked.Increment(ref _current));
+        // Subtracting one because Interlocked.Increment will return the post-incremented value
+        // which is expected to be the initialSequenceId for the first call
+        _current = unchecked((long) initialSequenceId - 1);
     }
+
+    public ulong FetchNext()
+        => unchecked((ulong) Interlocked.Increment(ref _current));
 }
diff --git a/src/DotPulsar/Internal/Serializer.cs b/src/DotPulsar/Internal/Serializer.cs
index 87edb06..9428043 100644
--- a/src/DotPulsar/Internal/Serializer.cs
+++ b/src/DotPulsar/Internal/Serializer.cs
@@ -12,63 +12,62 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using PulsarApi;
+using System;
+using System.Buffers;
+using System.IO;
+
+public static class Serializer
 {
-    using PulsarApi;
-    using System;
-    using System.Buffers;
-    using System.IO;
+    public static T Deserialize<T>(ReadOnlySequence<byte> sequence) => ProtoBuf.Serializer.Deserialize<T>(sequence);
 
-    public static class Serializer
+    public static ReadOnlySequence<byte> Serialize(BaseCommand command)
     {
-        public static T Deserialize<T>(ReadOnlySequence<byte> sequence) => ProtoBuf.Serializer.Deserialize<T>(sequence);
+        var commandBytes = Serialize<BaseCommand>(command);
+        var commandSizeBytes = ToBigEndianBytes((uint) commandBytes.Length);
+        var totalSizeBytes = ToBigEndianBytes((uint) commandBytes.Length + 4);
 
-        public static ReadOnlySequence<byte> Serialize(BaseCommand command)
-        {
-            var commandBytes = Serialize<BaseCommand>(command);
-            var commandSizeBytes = ToBigEndianBytes((uint) commandBytes.Length);
-            var totalSizeBytes = ToBigEndianBytes((uint) commandBytes.Length + 4);
+        return new SequenceBuilder<byte>()
+            .Append(totalSizeBytes)
+            .Append(commandSizeBytes)
+            .Append(commandBytes)
+            .Build();
+    }
 
-            return new SequenceBuilder<byte>()
-                .Append(totalSizeBytes)
-                .Append(commandSizeBytes)
-                .Append(commandBytes)
-                .Build();
-        }
+    public static ReadOnlySequence<byte> Serialize(BaseCommand command, MessageMetadata metadata, ReadOnlySequence<byte> payload)
+    {
+        var commandBytes = Serialize<BaseCommand>(command);
+        var commandSizeBytes = ToBigEndianBytes((uint) commandBytes.Length);
 
-        public static ReadOnlySequence<byte> Serialize(BaseCommand command, MessageMetadata metadata, ReadOnlySequence<byte> payload)
-        {
-            var commandBytes = Serialize<BaseCommand>(command);
-            var commandSizeBytes = ToBigEndianBytes((uint) commandBytes.Length);
+        var metadataBytes = Serialize(metadata);
+        var metadataSizeBytes = ToBigEndianBytes((uint) metadataBytes.Length);
 
-            var metadataBytes = Serialize(metadata);
-            var metadataSizeBytes = ToBigEndianBytes((uint) metadataBytes.Length);
+        var sb = new SequenceBuilder<byte>().Append(metadataSizeBytes).Append(metadataBytes).Append(payload);
+        var checksum = Crc32C.Calculate(sb.Build());
 
-            var sb = new SequenceBuilder<byte>().Append(metadataSizeBytes).Append(metadataBytes).Append(payload);
-            var checksum = Crc32C.Calculate(sb.Build());
+        return sb.Prepend(ToBigEndianBytes(checksum))
+            .Prepend(Constants.MagicNumber)
+            .Prepend(commandBytes)
+            .Prepend(commandSizeBytes)
+            .Prepend(ToBigEndianBytes((uint) sb.Length))
+            .Build();
+    }
 
-            return sb.Prepend(ToBigEndianBytes(checksum))
-                .Prepend(Constants.MagicNumber)
-                .Prepend(commandBytes)
-                .Prepend(commandSizeBytes)
-                .Prepend(ToBigEndianBytes((uint) sb.Length))
-                .Build();
-        }
+    public static byte[] ToBigEndianBytes(uint integer)
+    {
+        var union = new UIntUnion(integer);
 
-        public static byte[] ToBigEndianBytes(uint integer)
-        {
-            var union = new UIntUnion(integer);
+        return BitConverter.IsLittleEndian
+            ? new[] { union.B3, union.B2, union.B1, union.B0 }
+            : new[] { union.B0, union.B1, union.B2, union.B3 };
+    }
 
-            return BitConverter.IsLittleEndian
-                ? new[] { union.B3, union.B2, union.B1, union.B0 }
-                : new[] { union.B0, union.B1, union.B2, union.B3 };
-        }
-
-        private static byte[] Serialize<T>(T item)
-        {
-            using var ms = new MemoryStream();
-            ProtoBuf.Serializer.Serialize(ms, item);
-            return ms.ToArray();
-        }
+    private static byte[] Serialize<T>(T item)
+    {
+        using var ms = new MemoryStream();
+        ProtoBuf.Serializer.Serialize(ms, item);
+        return ms.ToArray();
     }
 }
diff --git a/src/DotPulsar/Internal/StateChanged.cs b/src/DotPulsar/Internal/StateChanged.cs
index 735dbbe..0b9eed0 100644
--- a/src/DotPulsar/Internal/StateChanged.cs
+++ b/src/DotPulsar/Internal/StateChanged.cs
@@ -12,11 +12,10 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+public enum StateChanged : byte
 {
-    public enum StateChanged : byte
-    {
-        To,
-        From
-    }
+    To,
+    From
 }
diff --git a/src/DotPulsar/Internal/StateManager.cs b/src/DotPulsar/Internal/StateManager.cs
index d3f3789..3942a3a 100644
--- a/src/DotPulsar/Internal/StateManager.cs
+++ b/src/DotPulsar/Internal/StateManager.cs
@@ -12,79 +12,78 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class StateManager<TState> : IStateManager<TState> where TState : notnull
 {
-    using Abstractions;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly object _lock;
+    private readonly StateTaskCollection<TState> _stateTasks;
+    private readonly TState[] _finalStates;
 
-    public sealed class StateManager<TState> : IStateManager<TState> where TState : notnull
+    public StateManager(TState initialState, params TState[] finalStates)
     {
-        private readonly object _lock;
-        private readonly StateTaskCollection<TState> _stateTasks;
-        private readonly TState[] _finalStates;
-
-        public StateManager(TState initialState, params TState[] finalStates)
-        {
-            _lock = new object();
-            _stateTasks = new StateTaskCollection<TState>();
-            _finalStates = finalStates;
-            CurrentState = initialState;
-        }
-
-        public TState CurrentState { get; private set; }
-
-        public TState SetState(TState state)
-        {
-            lock (_lock)
-            {
-                if (IsFinalState(CurrentState) || CurrentState.Equals(state))
-                    return CurrentState;
-
-                var formerState = CurrentState;
-                CurrentState = state;
-
-                if (IsFinalState(CurrentState))
-                    _stateTasks.CompleteAllTasks(CurrentState);
-                else
-                    _stateTasks.CompleteTasksAwaiting(CurrentState);
-
-                return formerState;
-            }
-        }
-
-        public ValueTask<TState> StateChangedTo(TState state, CancellationToken cancellationToken)
-        {
-            lock (_lock)
-            {
-                if (IsFinalState(CurrentState) || CurrentState.Equals(state))
-                    return new ValueTask<TState>(CurrentState);
-                return new ValueTask<TState>(_stateTasks.CreateTaskFor(state, StateChanged.To, cancellationToken));
-            }
-        }
-
-        public ValueTask<TState> StateChangedFrom(TState state, CancellationToken cancellationToken)
-        {
-            lock (_lock)
-            {
-                if (IsFinalState(CurrentState) || !CurrentState.Equals(state))
-                    return new ValueTask<TState>(CurrentState);
-                return new ValueTask<TState>(_stateTasks.CreateTaskFor(state, StateChanged.From, cancellationToken));
-            }
-        }
-
-        public bool IsFinalState(TState state)
-        {
-            for (var i = 0; i < _finalStates.Length; ++i)
-            {
-                if (_finalStates[i].Equals(state))
-                    return true;
-            }
-
-            return false;
-        }
-
-        public bool IsFinalState()
-            => IsFinalState(CurrentState);
+        _lock = new object();
+        _stateTasks = new StateTaskCollection<TState>();
+        _finalStates = finalStates;
+        CurrentState = initialState;
     }
+
+    public TState CurrentState { get; private set; }
+
+    public TState SetState(TState state)
+    {
+        lock (_lock)
+        {
+            if (IsFinalState(CurrentState) || CurrentState.Equals(state))
+                return CurrentState;
+
+            var formerState = CurrentState;
+            CurrentState = state;
+
+            if (IsFinalState(CurrentState))
+                _stateTasks.CompleteAllTasks(CurrentState);
+            else
+                _stateTasks.CompleteTasksAwaiting(CurrentState);
+
+            return formerState;
+        }
+    }
+
+    public ValueTask<TState> StateChangedTo(TState state, CancellationToken cancellationToken)
+    {
+        lock (_lock)
+        {
+            if (IsFinalState(CurrentState) || CurrentState.Equals(state))
+                return new ValueTask<TState>(CurrentState);
+            return new ValueTask<TState>(_stateTasks.CreateTaskFor(state, StateChanged.To, cancellationToken));
+        }
+    }
+
+    public ValueTask<TState> StateChangedFrom(TState state, CancellationToken cancellationToken)
+    {
+        lock (_lock)
+        {
+            if (IsFinalState(CurrentState) || !CurrentState.Equals(state))
+                return new ValueTask<TState>(CurrentState);
+            return new ValueTask<TState>(_stateTasks.CreateTaskFor(state, StateChanged.From, cancellationToken));
+        }
+    }
+
+    public bool IsFinalState(TState state)
+    {
+        for (var i = 0; i < _finalStates.Length; ++i)
+        {
+            if (_finalStates[i].Equals(state))
+                return true;
+        }
+
+        return false;
+    }
+
+    public bool IsFinalState()
+        => IsFinalState(CurrentState);
 }
diff --git a/src/DotPulsar/Internal/StateTask.cs b/src/DotPulsar/Internal/StateTask.cs
index 5943f09..a66b5e1 100644
--- a/src/DotPulsar/Internal/StateTask.cs
+++ b/src/DotPulsar/Internal/StateTask.cs
@@ -12,28 +12,27 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System;
+
+public sealed class StateTask<TState> : IDisposable where TState : notnull
 {
-    using System;
+    private readonly TState _state;
+    private readonly StateChanged _change;
 
-    public sealed class StateTask<TState> : IDisposable where TState : notnull
+    public StateTask(TState state, StateChanged change)
     {
-        private readonly TState _state;
-        private readonly StateChanged _change;
-
-        public StateTask(TState state, StateChanged change)
-        {
-            _state = state;
-            _change = change;
-            CancelableCompletionSource = new CancelableCompletionSource<TState>();
-        }
-
-        public CancelableCompletionSource<TState> CancelableCompletionSource { get; }
-
-        public bool IsAwaiting(TState state)
-            => _change == StateChanged.To ? _state.Equals(state) : !_state.Equals(state);
-
-        public void Dispose()
-            => CancelableCompletionSource.Dispose();
+        _state = state;
+        _change = change;
+        CancelableCompletionSource = new CancelableCompletionSource<TState>();
     }
+
+    public CancelableCompletionSource<TState> CancelableCompletionSource { get; }
+
+    public bool IsAwaiting(TState state)
+        => _change == StateChanged.To ? _state.Equals(state) : !_state.Equals(state);
+
+    public void Dispose()
+        => CancelableCompletionSource.Dispose();
 }
diff --git a/src/DotPulsar/Internal/StateTaskCollection.cs b/src/DotPulsar/Internal/StateTaskCollection.cs
index 5bfac23..ad17ae4 100644
--- a/src/DotPulsar/Internal/StateTaskCollection.cs
+++ b/src/DotPulsar/Internal/StateTaskCollection.cs
@@ -12,86 +12,85 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class StateTaskCollection<TState> where TState : notnull
 {
-    using System.Collections.Generic;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly object _lock;
+    private readonly LinkedList<StateTask<TState>> _awaiters;
 
-    public sealed class StateTaskCollection<TState> where TState : notnull
+    public StateTaskCollection()
     {
-        private readonly object _lock;
-        private readonly LinkedList<StateTask<TState>> _awaiters;
+        _lock = new object();
+        _awaiters = new LinkedList<StateTask<TState>>();
+    }
 
-        public StateTaskCollection()
+    public Task<TState> CreateTaskFor(TState state, StateChanged changed, CancellationToken cancellationToken)
+    {
+        LinkedListNode<StateTask<TState>> node;
+
+        lock (_lock)
         {
-            _lock = new object();
-            _awaiters = new LinkedList<StateTask<TState>>();
+            node = _awaiters.AddFirst(new StateTask<TState>(state, changed));
         }
 
-        public Task<TState> CreateTaskFor(TState state, StateChanged changed, CancellationToken cancellationToken)
+        node.Value.CancelableCompletionSource.SetupCancellation(() => TaskWasCanceled(node), cancellationToken);
+
+        return node.Value.CancelableCompletionSource.Task;
+    }
+
+    public void CompleteTasksAwaiting(TState state)
+    {
+        lock (_lock)
         {
-            LinkedListNode<StateTask<TState>> node;
+            var awaiter = _awaiters.First;
 
-            lock (_lock)
+            while (awaiter is not null)
             {
-                node = _awaiters.AddFirst(new StateTask<TState>(state, changed));
-            }
+                var next = awaiter.Next;
 
-            node.Value.CancelableCompletionSource.SetupCancellation(() => TaskWasCanceled(node), cancellationToken);
-
-            return node.Value.CancelableCompletionSource.Task;
-        }
-
-        public void CompleteTasksAwaiting(TState state)
-        {
-            lock (_lock)
-            {
-                var awaiter = _awaiters.First;
-
-                while (awaiter is not null)
+                if (awaiter.Value.IsAwaiting(state))
                 {
-                    var next = awaiter.Next;
-
-                    if (awaiter.Value.IsAwaiting(state))
-                    {
-                        _awaiters.Remove(awaiter);
-                        awaiter.Value.CancelableCompletionSource.SetResult(state);
-                        awaiter.Value.CancelableCompletionSource.Dispose();
-                    }
-
-                    awaiter = next;
+                    _awaiters.Remove(awaiter);
+                    awaiter.Value.CancelableCompletionSource.SetResult(state);
+                    awaiter.Value.CancelableCompletionSource.Dispose();
                 }
+
+                awaiter = next;
             }
         }
+    }
 
-        public void CompleteAllTasks(TState state)
+    public void CompleteAllTasks(TState state)
+    {
+        lock (_lock)
         {
-            lock (_lock)
+            foreach (var awaiter in _awaiters)
             {
-                foreach (var awaiter in _awaiters)
-                {
-                    awaiter.CancelableCompletionSource.SetResult(state);
-                    awaiter.CancelableCompletionSource.Dispose();
-                }
-
-                _awaiters.Clear();
+                awaiter.CancelableCompletionSource.SetResult(state);
+                awaiter.CancelableCompletionSource.Dispose();
             }
-        }
 
-        private void TaskWasCanceled(LinkedListNode<StateTask<TState>> node)
+            _awaiters.Clear();
+        }
+    }
+
+    private void TaskWasCanceled(LinkedListNode<StateTask<TState>> node)
+    {
+        lock (_lock)
         {
-            lock (_lock)
+            try
             {
-                try
-                {
-                    _awaiters.Remove(node);
-                    node.Value.Dispose();
-                }
-                catch
-                {
-                    // Ignore
-                }
+                _awaiters.Remove(node);
+                node.Value.Dispose();
+            }
+            catch
+            {
+                // Ignore
             }
         }
     }
diff --git a/src/DotPulsar/Internal/SubProducer.cs b/src/DotPulsar/Internal/SubProducer.cs
index 95fa217..a09b3e2 100644
--- a/src/DotPulsar/Internal/SubProducer.cs
+++ b/src/DotPulsar/Internal/SubProducer.cs
@@ -12,99 +12,98 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using Abstractions;
+using DotPulsar.Abstractions;
+using DotPulsar.Internal.Extensions;
+using Events;
+using System;
+using System.Buffers;
+using System.Threading;
+using System.Threading.Tasks;
+
+public sealed class SubProducer<TMessage> : IEstablishNewChannel, IProducer<TMessage>
 {
-    using Abstractions;
-    using DotPulsar.Abstractions;
-    using DotPulsar.Internal.Extensions;
-    using Events;
-    using System;
-    using System.Buffers;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly Guid _correlationId;
+    private readonly IRegisterEvent _eventRegister;
+    private IProducerChannel _channel;
+    private readonly IExecute _executor;
+    private readonly IStateChanged<ProducerState> _state;
+    private readonly IProducerChannelFactory _factory;
+    private readonly ISchema<TMessage> _schema;
+    private int _isDisposed;
 
-    public sealed class SubProducer<TMessage> : IEstablishNewChannel, IProducer<TMessage>
+    public Uri ServiceUrl { get; }
+    public string Topic { get; }
+
+    public SubProducer(
+        Guid correlationId,
+        Uri serviceUrl,
+        string topic,
+        IRegisterEvent registerEvent,
+        IProducerChannel initialChannel,
+        IExecute executor,
+        IStateChanged<ProducerState> state,
+        IProducerChannelFactory factory,
+        ISchema<TMessage> schema)
     {
-        private readonly Guid _correlationId;
-        private readonly IRegisterEvent _eventRegister;
-        private IProducerChannel _channel;
-        private readonly IExecute _executor;
-        private readonly IStateChanged<ProducerState> _state;
-        private readonly IProducerChannelFactory _factory;
-        private readonly ISchema<TMessage> _schema;
-        private int _isDisposed;
+        _correlationId = correlationId;
+        ServiceUrl = serviceUrl;
+        Topic = topic;
+        _eventRegister = registerEvent;
+        _channel = initialChannel;
+        _executor = executor;
+        _state = state;
+        _factory = factory;
+        _schema = schema;
+        _isDisposed = 0;
 
-        public Uri ServiceUrl { get; }
-        public string Topic { get; }
+        _eventRegister.Register(new ProducerCreated(_correlationId));
+    }
 
-        public SubProducer(
-            Guid correlationId,
-            Uri serviceUrl,
-            string topic,
-            IRegisterEvent registerEvent,
-            IProducerChannel initialChannel,
-            IExecute executor,
-            IStateChanged<ProducerState> state,
-            IProducerChannelFactory factory,
-            ISchema<TMessage> schema)
-        {
-            _correlationId = correlationId;
-            ServiceUrl = serviceUrl;
-            Topic = topic;
-            _eventRegister = registerEvent;
-            _channel = initialChannel;
-            _executor = executor;
-            _state = state;
-            _factory = factory;
-            _schema = schema;
-            _isDisposed = 0;
+    public async ValueTask<ProducerState> OnStateChangeTo(ProducerState state, CancellationToken cancellationToken)
+        => await _state.StateChangedTo(state, cancellationToken).ConfigureAwait(false);
 
-            _eventRegister.Register(new ProducerCreated(_correlationId));
-        }
+    public async ValueTask<ProducerState> OnStateChangeFrom(ProducerState state, CancellationToken cancellationToken)
+        => await _state.StateChangedFrom(state, cancellationToken).ConfigureAwait(false);
 
-        public async ValueTask<ProducerState> OnStateChangeTo(ProducerState state, CancellationToken cancellationToken)
-            => await _state.StateChangedTo(state, cancellationToken).ConfigureAwait(false);
+    public bool IsFinalState()
+        => _state.IsFinalState();
 
-        public async ValueTask<ProducerState> OnStateChangeFrom(ProducerState state, CancellationToken cancellationToken)
-            => await _state.StateChangedFrom(state, cancellationToken).ConfigureAwait(false);
+    public bool IsFinalState(ProducerState state)
+        => _state.IsFinalState(state);
 
-        public bool IsFinalState()
-            => _state.IsFinalState();
+    public async ValueTask DisposeAsync()
+    {
+        if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+            return;
 
-        public bool IsFinalState(ProducerState state)
-            => _state.IsFinalState(state);
+        _eventRegister.Register(new ProducerDisposed(_correlationId));
+        await _channel.ClosedByClient(CancellationToken.None).ConfigureAwait(false);
+        await _channel.DisposeAsync().ConfigureAwait(false);
+    }
 
-        public async ValueTask DisposeAsync()
-        {
-            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
-                return;
+    public async ValueTask<MessageId> Send(MessageMetadata metadata, TMessage message, CancellationToken cancellationToken)
+        => await _executor.Execute(() => InternalSend(metadata.Metadata, _schema.Encode(message), cancellationToken), cancellationToken).ConfigureAwait(false);
 
-            _eventRegister.Register(new ProducerDisposed(_correlationId));
-            await _channel.ClosedByClient(CancellationToken.None).ConfigureAwait(false);
-            await _channel.DisposeAsync().ConfigureAwait(false);
-        }
+    public async ValueTask<MessageId> Send(PulsarApi.MessageMetadata metadata, ReadOnlySequence<byte> data, CancellationToken cancellationToken)
+        => await _executor.Execute(() => InternalSend(metadata, data, cancellationToken), cancellationToken).ConfigureAwait(false);
 
-        public async ValueTask<MessageId> Send(MessageMetadata metadata, TMessage message, CancellationToken cancellationToken)
-            => await _executor.Execute(() => InternalSend(metadata.Metadata, _schema.Encode(message), cancellationToken), cancellationToken).ConfigureAwait(false);
+    private async ValueTask<MessageId> InternalSend(PulsarApi.MessageMetadata metadata, ReadOnlySequence<byte> data, CancellationToken cancellationToken)
+    {
+        var response = await _channel.Send(metadata, data, cancellationToken).ConfigureAwait(false);
+        return response.MessageId.ToMessageId();
+    }
 
-        public async ValueTask<MessageId> Send(PulsarApi.MessageMetadata metadata, ReadOnlySequence<byte> data, CancellationToken cancellationToken)
-            => await _executor.Execute(() => InternalSend(metadata, data, cancellationToken), cancellationToken).ConfigureAwait(false);
+    public async Task EstablishNewChannel(CancellationToken cancellationToken)
+    {
+        var channel = await _executor.Execute(() => _factory.Create(cancellationToken), cancellationToken).ConfigureAwait(false);
 
-        private async ValueTask<MessageId> InternalSend(PulsarApi.MessageMetadata metadata, ReadOnlySequence<byte> data, CancellationToken cancellationToken)
-        {
-            var response = await _channel.Send(metadata, data, cancellationToken).ConfigureAwait(false);
-            return response.MessageId.ToMessageId();
-        }
+        var oldChannel = _channel;
+        _channel = channel;
 
-        public async Task EstablishNewChannel(CancellationToken cancellationToken)
-        {
-            var channel = await _executor.Execute(() => _factory.Create(cancellationToken), cancellationToken).ConfigureAwait(false);
-
-            var oldChannel = _channel;
-            _channel = channel;
-
-            if (oldChannel is not null)
-                await oldChannel.DisposeAsync().ConfigureAwait(false);
-        }
+        if (oldChannel is not null)
+            await oldChannel.DisposeAsync().ConfigureAwait(false);
     }
 }
diff --git a/src/DotPulsar/Internal/SubscribeResponse.cs b/src/DotPulsar/Internal/SubscribeResponse.cs
index 472fddd..4b2f0c8 100644
--- a/src/DotPulsar/Internal/SubscribeResponse.cs
+++ b/src/DotPulsar/Internal/SubscribeResponse.cs
@@ -12,13 +12,12 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
-{
-    public sealed class SubscribeResponse
-    {
-        public SubscribeResponse(ulong consumerId)
-            => ConsumerId = consumerId;
+namespace DotPulsar.Internal;
 
-        public ulong ConsumerId { get; }
-    }
+public sealed class SubscribeResponse
+{
+    public SubscribeResponse(ulong consumerId)
+        => ConsumerId = consumerId;
+
+    public ulong ConsumerId { get; }
 }
diff --git a/src/DotPulsar/Internal/UIntUnion.cs b/src/DotPulsar/Internal/UIntUnion.cs
index 96b3a10..03046b5 100644
--- a/src/DotPulsar/Internal/UIntUnion.cs
+++ b/src/DotPulsar/Internal/UIntUnion.cs
@@ -12,44 +12,43 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Internal
+namespace DotPulsar.Internal;
+
+using System.Runtime.InteropServices;
+
+[StructLayout(LayoutKind.Explicit)]
+public struct UIntUnion
 {
-    using System.Runtime.InteropServices;
-
-    [StructLayout(LayoutKind.Explicit)]
-    public struct UIntUnion
+    public UIntUnion(byte b0, byte b1, byte b2, byte b3)
     {
-        public UIntUnion(byte b0, byte b1, byte b2, byte b3)
-        {
-            UInt = 0;
-            B0 = b0;
-            B1 = b1;
-            B2 = b2;
-            B3 = b3;
-        }
-
-        public UIntUnion(uint value)
-        {
-            B0 = 0;
-            B1 = 0;
-            B2 = 0;
-            B3 = 0;
-            UInt = value;
-        }
-
-        [FieldOffset(0)]
-        public byte B0;
-
-        [FieldOffset(1)]
-        public byte B1;
-
-        [FieldOffset(2)]
-        public byte B2;
-
-        [FieldOffset(3)]
-        public byte B3;
-
-        [FieldOffset(0)]
-        public uint UInt;
+        UInt = 0;
+        B0 = b0;
+        B1 = b1;
+        B2 = b2;
+        B3 = b3;
     }
+
+    public UIntUnion(uint value)
+    {
+        B0 = 0;
+        B1 = 0;
+        B2 = 0;
+        B3 = 0;
+        UInt = value;
+    }
+
+    [FieldOffset(0)]
+    public byte B0;
+
+    [FieldOffset(1)]
+    public byte B1;
+
+    [FieldOffset(2)]
+    public byte B2;
+
+    [FieldOffset(3)]
+    public byte B3;
+
+    [FieldOffset(0)]
+    public uint UInt;
 }
diff --git a/src/DotPulsar/MessageId.cs b/src/DotPulsar/MessageId.cs
index bc32039..0bf801d 100644
--- a/src/DotPulsar/MessageId.cs
+++ b/src/DotPulsar/MessageId.cs
@@ -12,119 +12,118 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using DotPulsar.Internal.Extensions;
+using Internal.PulsarApi;
+using System;
+
+/// <summary>
+/// Unique identifier of a single message.
+/// </summary>
+public sealed class MessageId : IEquatable<MessageId>, IComparable<MessageId>
 {
-    using DotPulsar.Internal.Extensions;
-    using Internal.PulsarApi;
-    using System;
+    static MessageId()
+    {
+        Earliest = new MessageId(ulong.MaxValue, ulong.MaxValue, -1, -1);
+        Latest = new MessageId(long.MaxValue, long.MaxValue, -1, -1);
+    }
 
     /// <summary>
-    /// Unique identifier of a single message.
+    /// The oldest message available in the topic.
     /// </summary>
-    public sealed class MessageId : IEquatable<MessageId>, IComparable<MessageId>
+    public static MessageId Earliest { get; }
+
+    /// <summary>
+    /// The next message published in the topic.
+    /// </summary>
+    public static MessageId Latest { get; }
+
+    /// <summary>
+    /// Initializes a new instance using the specified ledgerId, entryId, partition and batchIndex.
+    /// </summary>
+    public MessageId(ulong ledgerId, ulong entryId, int partition, int batchIndex)
     {
-        static MessageId()
-        {
-            Earliest = new MessageId(ulong.MaxValue, ulong.MaxValue, -1, -1);
-            Latest = new MessageId(long.MaxValue, long.MaxValue, -1, -1);
-        }
+        LedgerId = ledgerId;
+        EntryId = entryId;
+        Partition = partition;
+        BatchIndex = batchIndex;
+    }
 
-        /// <summary>
-        /// The oldest message available in the topic.
-        /// </summary>
-        public static MessageId Earliest { get; }
+    /// <summary>
+    /// The id of the ledger.
+    /// </summary>
+    public ulong LedgerId { get; }
 
-        /// <summary>
-        /// The next message published in the topic.
-        /// </summary>
-        public static MessageId Latest { get; }
+    /// <summary>
+    /// The id of the entry.
+    /// </summary>
+    public ulong EntryId { get; }
 
-        /// <summary>
-        /// Initializes a new instance using the specified ledgerId, entryId, partition and batchIndex.
-        /// </summary>
-        public MessageId(ulong ledgerId, ulong entryId, int partition, int batchIndex)
-        {
-            LedgerId = ledgerId;
-            EntryId = entryId;
-            Partition = partition;
-            BatchIndex = batchIndex;
-        }
+    /// <summary>
+    /// The partition.
+    /// </summary>
+    public int Partition { get; }
 
-        /// <summary>
-        /// The id of the ledger.
-        /// </summary>
-        public ulong LedgerId { get; }
+    /// <summary>
+    /// The batch index.
+    /// </summary>
+    public int BatchIndex { get; }
 
-        /// <summary>
-        /// The id of the entry.
-        /// </summary>
-        public ulong EntryId { get; }
+    public int CompareTo(MessageId? other)
+    {
+        if (other is null)
+            return 1;
 
-        /// <summary>
-        /// The partition.
-        /// </summary>
-        public int Partition { get; }
+        var result = LedgerId.CompareTo(other.LedgerId);
+        if (result != 0)
+            return result;
 
-        /// <summary>
-        /// The batch index.
-        /// </summary>
-        public int BatchIndex { get; }
+        result = EntryId.CompareTo(other.EntryId);
+        if (result != 0)
+            return result;
 
-        public int CompareTo(MessageId? other)
-        {
-            if (other is null)
-                return 1;
+        result = Partition.CompareTo(other.Partition);
+        if (result != 0)
+            return result;
 
-            var result = LedgerId.CompareTo(other.LedgerId);
-            if (result != 0)
-                return result;
+        return BatchIndex.CompareTo(other.BatchIndex);
+    }
 
-            result = EntryId.CompareTo(other.EntryId);
-            if (result != 0)
-                return result;
+    public static bool operator >(MessageId x, MessageId y)
+        => x is not null && x.CompareTo(y) >= 1;
 
-            result = Partition.CompareTo(other.Partition);
-            if (result != 0)
-                return result;
+    public static bool operator <(MessageId x, MessageId y)
+        => x is not null ? x.CompareTo(y) <= -1 : y is not null;
 
-            return BatchIndex.CompareTo(other.BatchIndex);
-        }
+    public static bool operator >=(MessageId x, MessageId y)
+        => x is not null ? x.CompareTo(y) >= 0 : y is null;
 
-        public static bool operator >(MessageId x, MessageId y)
-            => x is not null && x.CompareTo(y) >= 1;
+    public static bool operator <=(MessageId x, MessageId y)
+        => x is null || x.CompareTo(y) <= 0;
 
-        public static bool operator <(MessageId x, MessageId y)
-            => x is not null ? x.CompareTo(y) <= -1 : y is not null;
+    public override bool Equals(object? o)
+        => o is MessageId id && Equals(id);
 
-        public static bool operator >=(MessageId x, MessageId y)
-            => x is not null ? x.CompareTo(y) >= 0 : y is null;
+    public bool Equals(MessageId? other)
+        => other is not null && LedgerId == other.LedgerId && EntryId == other.EntryId && Partition == other.Partition && BatchIndex == other.BatchIndex;
 
-        public static bool operator <=(MessageId x, MessageId y)
-            => x is null || x.CompareTo(y) <= 0;
+    public static bool operator ==(MessageId x, MessageId y)
+        => ReferenceEquals(x, y) || (x is not null && x.Equals(y));
 
-        public override bool Equals(object? o)
-            => o is MessageId id && Equals(id);
+    public static bool operator !=(MessageId x, MessageId y)
+        => !(x == y);
 
-        public bool Equals(MessageId? other)
-            => other is not null && LedgerId == other.LedgerId && EntryId == other.EntryId && Partition == other.Partition && BatchIndex == other.BatchIndex;
+    public override int GetHashCode()
+        => HashCode.Combine(LedgerId, EntryId, Partition, BatchIndex);
 
-        public static bool operator ==(MessageId x, MessageId y)
-            => ReferenceEquals(x, y) || (x is not null && x.Equals(y));
+    public override string ToString()
+        => $"{LedgerId}:{EntryId}:{Partition}:{BatchIndex}";
 
-        public static bool operator !=(MessageId x, MessageId y)
-            => !(x == y);
-
-        public override int GetHashCode()
-            => HashCode.Combine(LedgerId, EntryId, Partition, BatchIndex);
-
-        public override string ToString()
-            => $"{LedgerId}:{EntryId}:{Partition}:{BatchIndex}";
-
-        internal MessageIdData ToMessageIdData()
-        {
-            var messageIdData = new MessageIdData();
-            messageIdData.MapFrom(this);
-            return messageIdData;
-        }
+    internal MessageIdData ToMessageIdData()
+    {
+        var messageIdData = new MessageIdData();
+        messageIdData.MapFrom(this);
+        return messageIdData;
     }
 }
diff --git a/src/DotPulsar/MessageMetadata.cs b/src/DotPulsar/MessageMetadata.cs
index e8fa47a..2cf4804 100644
--- a/src/DotPulsar/MessageMetadata.cs
+++ b/src/DotPulsar/MessageMetadata.cs
@@ -12,157 +12,156 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using Internal.Extensions;
+using Internal.PulsarApi;
+using System;
+
+/// <summary>
+/// The message metadata builder.
+/// </summary>
+public sealed class MessageMetadata
 {
-    using Internal.Extensions;
-    using Internal.PulsarApi;
-    using System;
+    /// <summary>
+    /// Initializes a new instance of the message metadata builder.
+    /// </summary>
+    public MessageMetadata()
+        => Metadata = new Internal.PulsarApi.MessageMetadata();
+
+    internal Internal.PulsarApi.MessageMetadata Metadata { get; }
 
     /// <summary>
-    /// The message metadata builder.
+    /// The delivery time of the message as unix time in milliseconds.
     /// </summary>
-    public sealed class MessageMetadata
+    public long DeliverAtTime
     {
-        /// <summary>
-        /// Initializes a new instance of the message metadata builder.
-        /// </summary>
-        public MessageMetadata()
-            => Metadata = new Internal.PulsarApi.MessageMetadata();
+        get => Metadata.DeliverAtTime;
+        set => Metadata.DeliverAtTime = value;
+    }
 
-        internal Internal.PulsarApi.MessageMetadata Metadata { get; }
+    /// <summary>
+    /// The delivery time of the message as an UTC DateTime.
+    /// </summary>
+    public DateTime DeliverAtTimeAsDateTime
+    {
+        get => Metadata.GetDeliverAtTimeAsDateTime();
+        set => Metadata.SetDeliverAtTime(value);
+    }
 
-        /// <summary>
-        /// The delivery time of the message as unix time in milliseconds.
-        /// </summary>
-        public long DeliverAtTime
+    /// <summary>
+    /// The delivery time of the message as a DateTimeOffset.
+    /// </summary>
+    public DateTimeOffset DeliverAtTimeAsDateTimeOffset
+    {
+        get => Metadata.GetDeliverAtTimeAsDateTimeOffset();
+        set => Metadata.SetDeliverAtTime(value);
+    }
+
+    /// <summary>
+    /// The event time of the message as unix time in milliseconds.
+    /// </summary>
+    public ulong EventTime
+    {
+        get => Metadata.EventTime;
+        set => Metadata.EventTime = value;
+    }
+
+    /// <summary>
+    /// The event time of the message as an UTC DateTime.
+    /// </summary>
+    public DateTime EventTimeAsDateTime
+    {
+        get => Metadata.GetEventTimeAsDateTime();
+        set => Metadata.SetEventTime(value);
+    }
+
+    /// <summary>
+    /// The event time of the message as a DateTimeOffset.
+    /// </summary>
+    public DateTimeOffset EventTimeAsDateTimeOffset
+    {
+        get => Metadata.GetEventTimeAsDateTimeOffset();
+        set => Metadata.SetEventTime(value);
+    }
+
+    /// <summary>
+    /// The key of the message as a string.
+    /// </summary>
+    public string? Key
+    {
+        get => Metadata.PartitionKey;
+        set => Metadata.SetKey(value);
+    }
+
+    /// <summary>
+    /// The key of the message as bytes.
+    /// </summary>
+    public byte[]? KeyBytes
+    {
+        get => Metadata.GetKeyAsBytes();
+        set => Metadata.SetKey(value);
+    }
+
+    /// <summary>
+    /// The ordering key of the message.
+    /// </summary>
+    public byte[]? OrderingKey
+    {
+        get => Metadata.OrderingKey;
+        set => Metadata.OrderingKey = value;
+    }
+
+    /// <summary>
+    /// The properties of the message.
+    /// </summary>
+    public string? this[string key]
+    {
+        get
         {
-            get => Metadata.DeliverAtTime;
-            set => Metadata.DeliverAtTime = value;
-        }
-
-        /// <summary>
-        /// The delivery time of the message as an UTC DateTime.
-        /// </summary>
-        public DateTime DeliverAtTimeAsDateTime
-        {
-            get => Metadata.GetDeliverAtTimeAsDateTime();
-            set => Metadata.SetDeliverAtTime(value);
-        }
-
-        /// <summary>
-        /// The delivery time of the message as a DateTimeOffset.
-        /// </summary>
-        public DateTimeOffset DeliverAtTimeAsDateTimeOffset
-        {
-            get => Metadata.GetDeliverAtTimeAsDateTimeOffset();
-            set => Metadata.SetDeliverAtTime(value);
-        }
-
-        /// <summary>
-        /// The event time of the message as unix time in milliseconds.
-        /// </summary>
-        public ulong EventTime
-        {
-            get => Metadata.EventTime;
-            set => Metadata.EventTime = value;
-        }
-
-        /// <summary>
-        /// The event time of the message as an UTC DateTime.
-        /// </summary>
-        public DateTime EventTimeAsDateTime
-        {
-            get => Metadata.GetEventTimeAsDateTime();
-            set => Metadata.SetEventTime(value);
-        }
-
-        /// <summary>
-        /// The event time of the message as a DateTimeOffset.
-        /// </summary>
-        public DateTimeOffset EventTimeAsDateTimeOffset
-        {
-            get => Metadata.GetEventTimeAsDateTimeOffset();
-            set => Metadata.SetEventTime(value);
-        }
-
-        /// <summary>
-        /// The key of the message as a string.
-        /// </summary>
-        public string? Key
-        {
-            get => Metadata.PartitionKey;
-            set => Metadata.SetKey(value);
-        }
-
-        /// <summary>
-        /// The key of the message as bytes.
-        /// </summary>
-        public byte[]? KeyBytes
-        {
-            get => Metadata.GetKeyAsBytes();
-            set => Metadata.SetKey(value);
-        }
-
-        /// <summary>
-        /// The ordering key of the message.
-        /// </summary>
-        public byte[]? OrderingKey
-        {
-            get => Metadata.OrderingKey;
-            set => Metadata.OrderingKey = value;
-        }
-
-        /// <summary>
-        /// The properties of the message.
-        /// </summary>
-        public string? this[string key]
-        {
-            get
+            for (var i = 0; i < Metadata.Properties.Count; ++i)
             {
-                for (var i = 0; i < Metadata.Properties.Count; ++i)
-                {
-                    var prop = Metadata.Properties[i];
+                var prop = Metadata.Properties[i];
 
-                    if (prop.Key == key)
-                        return prop.Value;
-                }
-
-                return null;
+                if (prop.Key == key)
+                    return prop.Value;
             }
-            set
+
+            return null;
+        }
+        set
+        {
+            for (var i = 0; i < Metadata.Properties.Count; ++i)
             {
-                for (var i = 0; i < Metadata.Properties.Count; ++i)
-                {
-                    var prop = Metadata.Properties[i];
+                var prop = Metadata.Properties[i];
 
-                    if (prop.Key != key)
-                        continue;
+                if (prop.Key != key)
+                    continue;
 
-                    prop.Value = value;
+                prop.Value = value;
 
-                    return;
-                }
-
-                Metadata.Properties.Add(new KeyValue { Key = key, Value = value });
+                return;
             }
-        }
 
-        /// <summary>
-        /// The schema version of the message.
-        /// </summary>
-        public byte[]? SchemaVersion
-        {
-            get => Metadata.SchemaVersion;
-            set => Metadata.SchemaVersion = value;
+            Metadata.Properties.Add(new KeyValue { Key = key, Value = value });
         }
+    }
 
-        /// <summary>
-        /// The sequence id of the message.
-        /// </summary>
-        public ulong SequenceId
-        {
-            get => Metadata.SequenceId;
-            set => Metadata.SequenceId = value;
-        }
+    /// <summary>
+    /// The schema version of the message.
+    /// </summary>
+    public byte[]? SchemaVersion
+    {
+        get => Metadata.SchemaVersion;
+        set => Metadata.SchemaVersion = value;
+    }
+
+    /// <summary>
+    /// The sequence id of the message.
+    /// </summary>
+    public ulong SequenceId
+    {
+        get => Metadata.SequenceId;
+        set => Metadata.SequenceId = value;
     }
 }
diff --git a/src/DotPulsar/ProducerOptions.cs b/src/DotPulsar/ProducerOptions.cs
index 1444198..665fc4d 100644
--- a/src/DotPulsar/ProducerOptions.cs
+++ b/src/DotPulsar/ProducerOptions.cs
@@ -12,70 +12,69 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using DotPulsar.Abstractions;
+
+/// <summary>
+/// The producer building options.
+/// </summary>
+public sealed class ProducerOptions<TMessage>
 {
-    using DotPulsar.Abstractions;
+    /// <summary>
+    /// The default compression type.
+    /// </summary>
+    public static readonly CompressionType DefaultCompressionType = CompressionType.None;
 
     /// <summary>
-    /// The producer building options.
+    /// The default initial sequence id.
     /// </summary>
-    public sealed class ProducerOptions<TMessage>
+    public static readonly ulong DefaultInitialSequenceId = 0;
+
+    /// <summary>
+    /// Initializes a new instance using the specified topic.
+    /// </summary>
+    public ProducerOptions(string topic, ISchema<TMessage> schema)
     {
-        /// <summary>
-        /// The default compression type.
-        /// </summary>
-        public static readonly CompressionType DefaultCompressionType = CompressionType.None;
-
-        /// <summary>
-        /// The default initial sequence id.
-        /// </summary>
-        public static readonly ulong DefaultInitialSequenceId = 0;
-
-        /// <summary>
-        /// Initializes a new instance using the specified topic.
-        /// </summary>
-        public ProducerOptions(string topic, ISchema<TMessage> schema)
-        {
-            CompressionType = DefaultCompressionType;
-            InitialSequenceId = DefaultInitialSequenceId;
-            Topic = topic;
-            Schema = schema;
-            MessageRouter = new RoundRobinPartitionRouter();
-        }
-
-        /// <summary>
-        /// Set the compression type. The default is 'None'.
-        /// </summary>
-        public CompressionType CompressionType { get; set; }
-
-        /// <summary>
-        /// Set the initial sequence id. The default is 0.
-        /// </summary>
-        public ulong InitialSequenceId { get; set; }
-
-        /// <summary>
-        /// Set the producer name. This is optional.
-        /// </summary>
-        public string? ProducerName { get; set; }
-
-        /// <summary>
-        /// Set the schema. This is required.
-        /// </summary>
-        public ISchema<TMessage> Schema { get; set; }
-
-        /// <summary>
-        /// Register a state changed handler. This is optional.
-        /// </summary>
-        public IHandleStateChanged<ProducerStateChanged>? StateChangedHandler { get; set; }
-
-        /// <summary>
-        /// Set the topic for this producer. This is required.
-        /// </summary>
-        public string Topic { get; set; }
-
-        /// <summary>
-        /// Set the message router. The default router is the Round Robin partition router.
-        /// </summary>
-        public IMessageRouter MessageRouter { get; set; }
+        CompressionType = DefaultCompressionType;
+        InitialSequenceId = DefaultInitialSequenceId;
+        Topic = topic;
+        Schema = schema;
+        MessageRouter = new RoundRobinPartitionRouter();
     }
+
+    /// <summary>
+    /// Set the compression type. The default is 'None'.
+    /// </summary>
+    public CompressionType CompressionType { get; set; }
+
+    /// <summary>
+    /// Set the initial sequence id. The default is 0.
+    /// </summary>
+    public ulong InitialSequenceId { get; set; }
+
+    /// <summary>
+    /// Set the producer name. This is optional.
+    /// </summary>
+    public string? ProducerName { get; set; }
+
+    /// <summary>
+    /// Set the schema. This is required.
+    /// </summary>
+    public ISchema<TMessage> Schema { get; set; }
+
+    /// <summary>
+    /// Register a state changed handler. This is optional.
+    /// </summary>
+    public IHandleStateChanged<ProducerStateChanged>? StateChangedHandler { get; set; }
+
+    /// <summary>
+    /// Set the topic for this producer. This is required.
+    /// </summary>
+    public string Topic { get; set; }
+
+    /// <summary>
+    /// Set the message router. The default router is the Round Robin partition router.
+    /// </summary>
+    public IMessageRouter MessageRouter { get; set; }
 }
diff --git a/src/DotPulsar/ProducerState.cs b/src/DotPulsar/ProducerState.cs
index da216c0..44cb6c1 100644
--- a/src/DotPulsar/ProducerState.cs
+++ b/src/DotPulsar/ProducerState.cs
@@ -12,36 +12,35 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// The possible states a producer can be in.
+/// </summary>
+public enum ProducerState : byte
 {
     /// <summary>
-    /// The possible states a producer can be in.
+    /// The producer is closed. This is a final state.
     /// </summary>
-    public enum ProducerState : byte
-    {
-        /// <summary>
-        /// The producer is closed. This is a final state.
-        /// </summary>
-        Closed,
+    Closed,
 
-        /// <summary>
-        /// The producer is connected.
-        /// </summary>
-        Connected,
+    /// <summary>
+    /// The producer is connected.
+    /// </summary>
+    Connected,
 
-        /// <summary>
-        /// The producer is disconnected.
-        /// </summary>
-        Disconnected,
+    /// <summary>
+    /// The producer is disconnected.
+    /// </summary>
+    Disconnected,
 
-        /// <summary>
-        /// The producer is faulted. This is a final state.
-        /// </summary>
-        Faulted,
+    /// <summary>
+    /// The producer is faulted. This is a final state.
+    /// </summary>
+    Faulted,
 
-        /// <summary>
-        /// Some of the sub-producers are disconnected.
-        /// </summary>
-        PartiallyConnected
-    }
+    /// <summary>
+    /// Some of the sub-producers are disconnected.
+    /// </summary>
+    PartiallyConnected
 }
diff --git a/src/DotPulsar/ProducerStateChanged.cs b/src/DotPulsar/ProducerStateChanged.cs
index 7b69cce..0b082a2 100644
--- a/src/DotPulsar/ProducerStateChanged.cs
+++ b/src/DotPulsar/ProducerStateChanged.cs
@@ -12,29 +12,28 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using Abstractions;
+
+/// <summary>
+/// Representation of a producer state change.
+/// </summary>
+public sealed class ProducerStateChanged
 {
-    using Abstractions;
+    internal ProducerStateChanged(IProducer producer, ProducerState producerState)
+    {
+        Producer = producer;
+        ProducerState = producerState;
+    }
 
     /// <summary>
-    /// Representation of a producer state change.
+    /// The producer that changed state.
     /// </summary>
-    public sealed class ProducerStateChanged
-    {
-        internal ProducerStateChanged(IProducer producer, ProducerState producerState)
-        {
-            Producer = producer;
-            ProducerState = producerState;
-        }
+    public IProducer Producer { get; }
 
-        /// <summary>
-        /// The producer that changed state.
-        /// </summary>
-        public IProducer Producer { get; }
-
-        /// <summary>
-        /// The state that it changed to.
-        /// </summary>
-        public ProducerState ProducerState { get; }
-    }
+    /// <summary>
+    /// The state that it changed to.
+    /// </summary>
+    public ProducerState ProducerState { get; }
 }
diff --git a/src/DotPulsar/PulsarClient.cs b/src/DotPulsar/PulsarClient.cs
index 91549ab..2f9acb5 100644
--- a/src/DotPulsar/PulsarClient.cs
+++ b/src/DotPulsar/PulsarClient.cs
@@ -12,165 +12,164 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using Abstractions;
+using DotPulsar.Internal.Compression;
+using DotPulsar.Internal.PulsarApi;
+using Exceptions;
+using Internal;
+using Internal.Abstractions;
+using System;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+/// <summary>
+/// Pulsar client for creating producers, consumers and readers.
+/// </summary>
+public sealed class PulsarClient : IPulsarClient
 {
-    using Abstractions;
-    using DotPulsar.Internal.Compression;
-    using DotPulsar.Internal.PulsarApi;
-    using Exceptions;
-    using Internal;
-    using Internal.Abstractions;
-    using System;
-    using System.Linq;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly IConnectionPool _connectionPool;
+    private readonly ProcessManager _processManager;
+    private readonly IHandleException _exceptionHandler;
+    private int _isDisposed;
+
+    public Uri ServiceUrl { get; }
+
+    internal PulsarClient(
+        IConnectionPool connectionPool,
+        ProcessManager processManager,
+        IHandleException exceptionHandler,
+        Uri serviceUrl)
+    {
+        _connectionPool = connectionPool;
+        _processManager = processManager;
+        _exceptionHandler = exceptionHandler;
+        ServiceUrl = serviceUrl;
+        _isDisposed = 0;
+        DotPulsarEventSource.Log.ClientCreated();
+    }
 
     /// <summary>
-    /// Pulsar client for creating producers, consumers and readers.
+    /// Get a builder that can be used to configure and build a PulsarClient instance.
     /// </summary>
-    public sealed class PulsarClient : IPulsarClient
+    public static IPulsarClientBuilder Builder()
+        => new PulsarClientBuilder();
+
+    /// <summary>
+    /// Create a producer.
+    /// </summary>
+    public IProducer<TMessage> CreateProducer<TMessage>(ProducerOptions<TMessage> options)
     {
-        private readonly IConnectionPool _connectionPool;
-        private readonly ProcessManager _processManager;
-        private readonly IHandleException _exceptionHandler;
-        private int _isDisposed;
+        ThrowIfDisposed();
 
-        public Uri ServiceUrl { get; }
-
-        internal PulsarClient(
-            IConnectionPool connectionPool,
-            ProcessManager processManager,
-            IHandleException exceptionHandler,
-            Uri serviceUrl)
+        ICompressorFactory? compressorFactory = null;
+        if (options.CompressionType != CompressionType.None)
         {
-            _connectionPool = connectionPool;
-            _processManager = processManager;
-            _exceptionHandler = exceptionHandler;
-            ServiceUrl = serviceUrl;
-            _isDisposed = 0;
-            DotPulsarEventSource.Log.ClientCreated();
+            var compressionType = (Internal.PulsarApi.CompressionType) options.CompressionType;
+            compressorFactory = CompressionFactories.CompressorFactories().SingleOrDefault(f => f.CompressionType == compressionType);
+
+            if (compressorFactory is null)
+                throw new CompressionException($"Support for {compressionType} compression was not found");
         }
 
-        /// <summary>
-        /// Get a builder that can be used to configure and build a PulsarClient instance.
-        /// </summary>
-        public static IPulsarClientBuilder Builder()
-            => new PulsarClientBuilder();
+        var producer = new Producer<TMessage>(ServiceUrl, options, _processManager, _exceptionHandler, _connectionPool, compressorFactory);
 
-        /// <summary>
-        /// Create a producer.
-        /// </summary>
-        public IProducer<TMessage> CreateProducer<TMessage>(ProducerOptions<TMessage> options)
+        if (options.StateChangedHandler is not null)
+            _ = StateMonitor.MonitorProducer(producer, options.StateChangedHandler);
+
+        return producer;
+    }
+
+    /// <summary>
+    /// Create a consumer.
+    /// </summary>
+    public IConsumer<TMessage> CreateConsumer<TMessage>(ConsumerOptions<TMessage> options)
+    {
+        ThrowIfDisposed();
+
+        var correlationId = Guid.NewGuid();
+        var consumerName = options.ConsumerName ?? $"Consumer-{correlationId:N}";
+        var subscribe = new CommandSubscribe
         {
-            ThrowIfDisposed();
+            ConsumerName = consumerName,
+            InitialPosition = (CommandSubscribe.InitialPositionType) options.InitialPosition,
+            PriorityLevel = options.PriorityLevel,
+            ReadCompacted = options.ReadCompacted,
+            Subscription = options.SubscriptionName,
+            Topic = options.Topic,
+            Type = (CommandSubscribe.SubType) options.SubscriptionType
+        };
+        var messagePrefetchCount = options.MessagePrefetchCount;
+        var messageFactory = new MessageFactory<TMessage>(options.Schema);
+        var batchHandler = new BatchHandler<TMessage>(true, messageFactory);
+        var decompressorFactories = CompressionFactories.DecompressorFactories();
+        var factory = new ConsumerChannelFactory<TMessage>(correlationId, _processManager, _connectionPool, subscribe, messagePrefetchCount, batchHandler, messageFactory, decompressorFactories);
+        var stateManager = new StateManager<ConsumerState>(ConsumerState.Disconnected, ConsumerState.Closed, ConsumerState.ReachedEndOfTopic, ConsumerState.Faulted);
+        var initialChannel = new NotReadyChannel<TMessage>();
+        var executor = new Executor(correlationId, _processManager, _exceptionHandler);
+        var consumer = new Consumer<TMessage>(correlationId, ServiceUrl, options.SubscriptionName, options.Topic, _processManager, initialChannel, executor, stateManager, factory);
+        if (options.StateChangedHandler is not null)
+            _ = StateMonitor.MonitorConsumer(consumer, options.StateChangedHandler);
+        var process = new ConsumerProcess(correlationId, stateManager, consumer, options.SubscriptionType == SubscriptionType.Failover);
+        _processManager.Add(process);
+        process.Start();
+        return consumer;
+    }
 
-            ICompressorFactory? compressorFactory = null;
-            if (options.CompressionType != CompressionType.None)
-            {
-                var compressionType = (Internal.PulsarApi.CompressionType) options.CompressionType;
-                compressorFactory = CompressionFactories.CompressorFactories().SingleOrDefault(f => f.CompressionType == compressionType);
+    /// <summary>
+    /// Create a reader.
+    /// </summary>
+    public IReader<TMessage> CreateReader<TMessage>(ReaderOptions<TMessage> options)
+    {
+        ThrowIfDisposed();
 
-                if (compressorFactory is null)
-                    throw new CompressionException($"Support for {compressionType} compression was not found");
-            }
-
-            var producer = new Producer<TMessage>(ServiceUrl, options, _processManager, _exceptionHandler, _connectionPool, compressorFactory);
-
-            if (options.StateChangedHandler is not null)
-                _ = StateMonitor.MonitorProducer(producer, options.StateChangedHandler);
-
-            return producer;
-        }
-
-        /// <summary>
-        /// Create a consumer.
-        /// </summary>
-        public IConsumer<TMessage> CreateConsumer<TMessage>(ConsumerOptions<TMessage> options)
+        var correlationId = Guid.NewGuid();
+        var subscription = $"Reader-{correlationId:N}";
+        var subscribe = new CommandSubscribe
         {
-            ThrowIfDisposed();
+            ConsumerName = options.ReaderName ?? subscription,
+            Durable = false,
+            ReadCompacted = options.ReadCompacted,
+            StartMessageId = options.StartMessageId.ToMessageIdData(),
+            Subscription = subscription,
+            Topic = options.Topic
+        };
+        var messagePrefetchCount = options.MessagePrefetchCount;
+        var messageFactory = new MessageFactory<TMessage>(options.Schema);
+        var batchHandler = new BatchHandler<TMessage>(false, messageFactory);
+        var decompressorFactories = CompressionFactories.DecompressorFactories();
+        var factory = new ConsumerChannelFactory<TMessage>(correlationId, _processManager, _connectionPool, subscribe, messagePrefetchCount, batchHandler, messageFactory, decompressorFactories);
+        var stateManager = new StateManager<ReaderState>(ReaderState.Disconnected, ReaderState.Closed, ReaderState.ReachedEndOfTopic, ReaderState.Faulted);
+        var initialChannel = new NotReadyChannel<TMessage>();
+        var executor = new Executor(correlationId, _processManager, _exceptionHandler);
+        var reader = new Reader<TMessage>(correlationId, ServiceUrl, options.Topic, _processManager, initialChannel, executor, stateManager, factory);
+        if (options.StateChangedHandler is not null)
+            _ = StateMonitor.MonitorReader(reader, options.StateChangedHandler);
+        var process = new ReaderProcess(correlationId, stateManager, reader);
+        _processManager.Add(process);
+        process.Start();
+        return reader;
+    }
 
-            var correlationId = Guid.NewGuid();
-            var consumerName = options.ConsumerName ?? $"Consumer-{correlationId:N}";
-            var subscribe = new CommandSubscribe
-            {
-                ConsumerName = consumerName,
-                InitialPosition = (CommandSubscribe.InitialPositionType) options.InitialPosition,
-                PriorityLevel = options.PriorityLevel,
-                ReadCompacted = options.ReadCompacted,
-                Subscription = options.SubscriptionName,
-                Topic = options.Topic,
-                Type = (CommandSubscribe.SubType) options.SubscriptionType
-            };
-            var messagePrefetchCount = options.MessagePrefetchCount;
-            var messageFactory = new MessageFactory<TMessage>(options.Schema);
-            var batchHandler = new BatchHandler<TMessage>(true, messageFactory);
-            var decompressorFactories = CompressionFactories.DecompressorFactories();
-            var factory = new ConsumerChannelFactory<TMessage>(correlationId, _processManager, _connectionPool, subscribe, messagePrefetchCount, batchHandler, messageFactory, decompressorFactories);
-            var stateManager = new StateManager<ConsumerState>(ConsumerState.Disconnected, ConsumerState.Closed, ConsumerState.ReachedEndOfTopic, ConsumerState.Faulted);
-            var initialChannel = new NotReadyChannel<TMessage>();
-            var executor = new Executor(correlationId, _processManager, _exceptionHandler);
-            var consumer = new Consumer<TMessage>(correlationId, ServiceUrl, options.SubscriptionName, options.Topic, _processManager, initialChannel, executor, stateManager, factory);
-            if (options.StateChangedHandler is not null)
-                _ = StateMonitor.MonitorConsumer(consumer, options.StateChangedHandler);
-            var process = new ConsumerProcess(correlationId, stateManager, consumer, options.SubscriptionType == SubscriptionType.Failover);
-            _processManager.Add(process);
-            process.Start();
-            return consumer;
-        }
+    /// <summary>
+    /// Dispose the client and all its producers, consumers and readers.
+    /// </summary>
+    public async ValueTask DisposeAsync()
+    {
+        if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
+            return;
 
-        /// <summary>
-        /// Create a reader.
-        /// </summary>
-        public IReader<TMessage> CreateReader<TMessage>(ReaderOptions<TMessage> options)
-        {
-            ThrowIfDisposed();
+        if (_processManager is IAsyncDisposable disposable)
+            await disposable.DisposeAsync().ConfigureAwait(false);
 
-            var correlationId = Guid.NewGuid();
-            var subscription = $"Reader-{correlationId:N}";
-            var subscribe = new CommandSubscribe
-            {
-                ConsumerName = options.ReaderName ?? subscription,
-                Durable = false,
-                ReadCompacted = options.ReadCompacted,
-                StartMessageId = options.StartMessageId.ToMessageIdData(),
-                Subscription = subscription,
-                Topic = options.Topic
-            };
-            var messagePrefetchCount = options.MessagePrefetchCount;
-            var messageFactory = new MessageFactory<TMessage>(options.Schema);
-            var batchHandler = new BatchHandler<TMessage>(false, messageFactory);
-            var decompressorFactories = CompressionFactories.DecompressorFactories();
-            var factory = new ConsumerChannelFactory<TMessage>(correlationId, _processManager, _connectionPool, subscribe, messagePrefetchCount, batchHandler, messageFactory, decompressorFactories);
-            var stateManager = new StateManager<ReaderState>(ReaderState.Disconnected, ReaderState.Closed, ReaderState.ReachedEndOfTopic, ReaderState.Faulted);
-            var initialChannel = new NotReadyChannel<TMessage>();
-            var executor = new Executor(correlationId, _processManager, _exceptionHandler);
-            var reader = new Reader<TMessage>(correlationId, ServiceUrl, options.Topic, _processManager, initialChannel, executor, stateManager, factory);
-            if (options.StateChangedHandler is not null)
-                _ = StateMonitor.MonitorReader(reader, options.StateChangedHandler);
-            var process = new ReaderProcess(correlationId, stateManager, reader);
-            _processManager.Add(process);
-            process.Start();
-            return reader;
-        }
+        DotPulsarEventSource.Log.ClientDisposed();
+    }
 
-        /// <summary>
-        /// Dispose the client and all its producers, consumers and readers.
-        /// </summary>
-        public async ValueTask DisposeAsync()
-        {
-            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
-                return;
-
-            if (_processManager is IAsyncDisposable disposable)
-                await disposable.DisposeAsync().ConfigureAwait(false);
-
-            DotPulsarEventSource.Log.ClientDisposed();
-        }
-
-        private void ThrowIfDisposed()
-        {
-            if (_isDisposed != 0)
-                throw new PulsarClientDisposedException();
-        }
+    private void ThrowIfDisposed()
+    {
+        if (_isDisposed != 0)
+            throw new PulsarClientDisposedException();
     }
 }
diff --git a/src/DotPulsar/ReaderOptions.cs b/src/DotPulsar/ReaderOptions.cs
index 4a1e596..a7f76a0 100644
--- a/src/DotPulsar/ReaderOptions.cs
+++ b/src/DotPulsar/ReaderOptions.cs
@@ -12,70 +12,69 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using DotPulsar.Abstractions;
+
+/// <summary>
+/// The reader building options.
+/// </summary>
+public sealed class ReaderOptions<TMessage>
 {
-    using DotPulsar.Abstractions;
+    /// <summary>
+    /// The default message prefetch count.
+    /// </summary>
+    public static readonly uint DefaultMessagePrefetchCount = 1000;
 
     /// <summary>
-    /// The reader building options.
+    /// The default of whether to read compacted.
     /// </summary>
-    public sealed class ReaderOptions<TMessage>
+    public static readonly bool DefaultReadCompacted = false;
+
+    /// <summary>
+    /// Initializes a new instance using the specified startMessageId and topic.
+    /// </summary>
+    public ReaderOptions(MessageId startMessageId, string topic, ISchema<TMessage> schema)
     {
-        /// <summary>
-        /// The default message prefetch count.
-        /// </summary>
-        public static readonly uint DefaultMessagePrefetchCount = 1000;
-
-        /// <summary>
-        /// The default of whether to read compacted.
-        /// </summary>
-        public static readonly bool DefaultReadCompacted = false;
-
-        /// <summary>
-        /// Initializes a new instance using the specified startMessageId and topic.
-        /// </summary>
-        public ReaderOptions(MessageId startMessageId, string topic, ISchema<TMessage> schema)
-        {
-            MessagePrefetchCount = DefaultMessagePrefetchCount;
-            ReadCompacted = DefaultReadCompacted;
-            StartMessageId = startMessageId;
-            Topic = topic;
-            Schema = schema;
-        }
-
-        /// <summary>
-        /// Number of messages that will be prefetched. The default is 1000.
-        /// </summary>
-        public uint MessagePrefetchCount { get; set; }
-
-        /// <summary>
-        /// Whether to read from the compacted topic. The default is 'false'.
-        /// </summary>
-        public bool ReadCompacted { get; set; }
-
-        /// <summary>
-        /// Set the reader name. This is optional.
-        /// </summary>
-        public string? ReaderName { get; set; }
-
-        /// <summary>
-        /// Set the schema. This is required.
-        /// </summary>
-        public ISchema<TMessage> Schema { get; set; }
-
-        /// <summary>
-        /// The initial reader position is set to the specified message id. This is required.
-        /// </summary>
-        public MessageId StartMessageId { get; set; }
-
-        /// <summary>
-        /// Register a state changed handler. This is optional.
-        /// </summary>
-        public IHandleStateChanged<ReaderStateChanged>? StateChangedHandler { get; set; }
-
-        /// <summary>
-        /// Set the topic for this reader. This is required.
-        /// </summary>
-        public string Topic { get; set; }
+        MessagePrefetchCount = DefaultMessagePrefetchCount;
+        ReadCompacted = DefaultReadCompacted;
+        StartMessageId = startMessageId;
+        Topic = topic;
+        Schema = schema;
     }
+
+    /// <summary>
+    /// Number of messages that will be prefetched. The default is 1000.
+    /// </summary>
+    public uint MessagePrefetchCount { get; set; }
+
+    /// <summary>
+    /// Whether to read from the compacted topic. The default is 'false'.
+    /// </summary>
+    public bool ReadCompacted { get; set; }
+
+    /// <summary>
+    /// Set the reader name. This is optional.
+    /// </summary>
+    public string? ReaderName { get; set; }
+
+    /// <summary>
+    /// Set the schema. This is required.
+    /// </summary>
+    public ISchema<TMessage> Schema { get; set; }
+
+    /// <summary>
+    /// The initial reader position is set to the specified message id. This is required.
+    /// </summary>
+    public MessageId StartMessageId { get; set; }
+
+    /// <summary>
+    /// Register a state changed handler. This is optional.
+    /// </summary>
+    public IHandleStateChanged<ReaderStateChanged>? StateChangedHandler { get; set; }
+
+    /// <summary>
+    /// Set the topic for this reader. This is required.
+    /// </summary>
+    public string Topic { get; set; }
 }
diff --git a/src/DotPulsar/ReaderState.cs b/src/DotPulsar/ReaderState.cs
index c62b547..d30afbd 100644
--- a/src/DotPulsar/ReaderState.cs
+++ b/src/DotPulsar/ReaderState.cs
@@ -12,36 +12,35 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// The possible states a reader can be in.
+/// </summary>
+public enum ReaderState : byte
 {
     /// <summary>
-    /// The possible states a reader can be in.
+    /// The reader is closed. This is a final state.
     /// </summary>
-    public enum ReaderState : byte
-    {
-        /// <summary>
-        /// The reader is closed. This is a final state.
-        /// </summary>
-        Closed,
+    Closed,
 
-        /// <summary>
-        /// The reader is connected.
-        /// </summary>
-        Connected,
+    /// <summary>
+    /// The reader is connected.
+    /// </summary>
+    Connected,
 
-        /// <summary>
-        /// The reader is disconnected.
-        /// </summary>
-        Disconnected,
+    /// <summary>
+    /// The reader is disconnected.
+    /// </summary>
+    Disconnected,
 
-        /// <summary>
-        /// The reader is faulted. This is a final state.
-        /// </summary>
-        Faulted,
+    /// <summary>
+    /// The reader is faulted. This is a final state.
+    /// </summary>
+    Faulted,
 
-        /// <summary>
-        /// The reader has reached the end of the topic. This is a final state.
-        /// </summary>
-        ReachedEndOfTopic
-    }
+    /// <summary>
+    /// The reader has reached the end of the topic. This is a final state.
+    /// </summary>
+    ReachedEndOfTopic
 }
diff --git a/src/DotPulsar/ReaderStateChanged.cs b/src/DotPulsar/ReaderStateChanged.cs
index c727e0f..6b415d3 100644
--- a/src/DotPulsar/ReaderStateChanged.cs
+++ b/src/DotPulsar/ReaderStateChanged.cs
@@ -12,29 +12,28 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using Abstractions;
+
+/// <summary>
+/// Representation of a reader state change.
+/// </summary>
+public sealed class ReaderStateChanged
 {
-    using Abstractions;
+    internal ReaderStateChanged(IReader reader, ReaderState readerState)
+    {
+        Reader = reader;
+        ReaderState = readerState;
+    }
 
     /// <summary>
-    /// Representation of a reader state change.
+    /// The reader that changed state.
     /// </summary>
-    public sealed class ReaderStateChanged
-    {
-        internal ReaderStateChanged(IReader reader, ReaderState readerState)
-        {
-            Reader = reader;
-            ReaderState = readerState;
-        }
+    public IReader Reader { get; }
 
-        /// <summary>
-        /// The reader that changed state.
-        /// </summary>
-        public IReader Reader { get; }
-
-        /// <summary>
-        /// The state that it changed to.
-        /// </summary>
-        public ReaderState ReaderState { get; }
-    }
+    /// <summary>
+    /// The state that it changed to.
+    /// </summary>
+    public ReaderState ReaderState { get; }
 }
diff --git a/src/DotPulsar/RoundRobinPartitionRouter.cs b/src/DotPulsar/RoundRobinPartitionRouter.cs
index 8a932ec..f6c0d48 100644
--- a/src/DotPulsar/RoundRobinPartitionRouter.cs
+++ b/src/DotPulsar/RoundRobinPartitionRouter.cs
@@ -12,39 +12,38 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using Abstractions;
+using HashDepot;
+using System.Threading;
+
+/// <summary>
+/// The round robin partition messages router, which is the default router.
+/// If a key is provided, the producer will hash the key and publish the message to a particular partition.
+/// If a key is not provided, the producer will publish messages across all partitions in a round-robin fashion to achieve maximum throughput.
+/// </summary>
+public sealed class RoundRobinPartitionRouter : IMessageRouter
 {
-    using Abstractions;
-    using HashDepot;
-    using System.Threading;
+    private int _partitionIndex;
 
     /// <summary>
-    /// The round robin partition messages router, which is the default router.
-    /// If a key is provided, the producer will hash the key and publish the message to a particular partition.
-    /// If a key is not provided, the producer will publish messages across all partitions in a round-robin fashion to achieve maximum throughput.
+    /// Initializes a new instance of the round robin partition router
     /// </summary>
-    public sealed class RoundRobinPartitionRouter : IMessageRouter
+    public RoundRobinPartitionRouter()
     {
-        private int _partitionIndex;
+        _partitionIndex = -1;
+    }
 
-        /// <summary>
-        /// Initializes a new instance of the round robin partition router
-        /// </summary>
-        public RoundRobinPartitionRouter()
-        {
-            _partitionIndex = -1;
-        }
+    /// <summary>
+    /// Choose a partition in round robin routing mode
+    /// </summary>
+    public int ChoosePartition(MessageMetadata messageMetadata, int numberOfPartitions)
+    {
+        var keyBytes = messageMetadata.KeyBytes;
+        if (keyBytes is not null && keyBytes.Length > 0)
+            return (int) MurmurHash3.Hash32(keyBytes, 0) % numberOfPartitions;
 
-        /// <summary>
-        /// Choose a partition in round robin routing mode
-        /// </summary>
-        public int ChoosePartition(MessageMetadata messageMetadata, int numberOfPartitions)
-        {
-            var keyBytes = messageMetadata.KeyBytes;
-            if (keyBytes is not null && keyBytes.Length > 0)
-                return (int) MurmurHash3.Hash32(keyBytes, 0) % numberOfPartitions;
-
-            return Interlocked.Increment(ref _partitionIndex) % numberOfPartitions;
-        }
+        return Interlocked.Increment(ref _partitionIndex) % numberOfPartitions;
     }
 }
diff --git a/src/DotPulsar/Schema.cs b/src/DotPulsar/Schema.cs
index 6116631..8aa8375 100644
--- a/src/DotPulsar/Schema.cs
+++ b/src/DotPulsar/Schema.cs
@@ -12,89 +12,88 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using DotPulsar.Schemas;
+
+/// <summary>
+/// Message schema definitions.
+/// </summary>
+public static class Schema
 {
-    using DotPulsar.Schemas;
+    static Schema()
+    {
+        ByteSequence = new ByteSequenceSchema();
+        ByteArray = new ByteArraySchema();
+        String = StringSchema.UTF8;
+        Boolean = new BooleanSchema();
+        Int8 = new ByteSchema();
+        Int16 = new ShortSchema();
+        Int32 = new IntegerSchema();
+        Int64 = new LongSchema();
+        Float = new FloatSchema();
+        TimeStamp = TimestampSchema.Timestamp;
+        Date = TimestampSchema.Date;
+        Time = new TimeSchema();
+    }
 
     /// <summary>
-    /// Message schema definitions.
+    /// Raw bytes schema using ReadOnlySequence of bytes.
     /// </summary>
-    public static class Schema
-    {
-        static Schema()
-        {
-            ByteSequence = new ByteSequenceSchema();
-            ByteArray = new ByteArraySchema();
-            String = StringSchema.UTF8;
-            Boolean = new BooleanSchema();
-            Int8 = new ByteSchema();
-            Int16 = new ShortSchema();
-            Int32 = new IntegerSchema();
-            Int64 = new LongSchema();
-            Float = new FloatSchema();
-            TimeStamp = TimestampSchema.Timestamp;
-            Date = TimestampSchema.Date;
-            Time = new TimeSchema();
-        }
+    public static ByteSequenceSchema ByteSequence { get; }
 
-        /// <summary>
-        /// Raw bytes schema using ReadOnlySequence of bytes.
-        /// </summary>
-        public static ByteSequenceSchema ByteSequence { get; }
+    /// <summary>
+    /// Raw bytes schema using byte[].
+    /// </summary>
+    public static ByteArraySchema ByteArray { get; }
 
-        /// <summary>
-        /// Raw bytes schema using byte[].
-        /// </summary>
-        public static ByteArraySchema ByteArray { get; }
+    /// <summary>
+    /// UTF-8 schema.
+    /// </summary>
+    public static StringSchema String { get; }
 
-        /// <summary>
-        /// UTF-8 schema.
-        /// </summary>
-        public static StringSchema String { get; }
+    /// <summary>
+    /// Boolean schema.
+    /// </summary>
+    public static BooleanSchema Boolean { get; }
 
-        /// <summary>
-        /// Boolean schema.
-        /// </summary>
-        public static BooleanSchema Boolean { get; }
+    /// <summary>
+    /// Byte schema.
+    /// </summary>
+    public static ByteSchema Int8 { get; }
 
-        /// <summary>
-        /// Byte schema.
-        /// </summary>
-        public static ByteSchema Int8 { get; }
+    /// <summary>
+    /// Short schema.
+    /// </summary>
+    public static ShortSchema Int16 { get; }
 
-        /// <summary>
-        /// Short schema.
-        /// </summary>
-        public static ShortSchema Int16 { get; }
+    /// <summary>
+    /// Integer schema.
+    /// </summary>
+    public static IntegerSchema Int32 { get; }
 
-        /// <summary>
-        /// Integer schema.
-        /// </summary>
-        public static IntegerSchema Int32 { get; }
+    /// <summary>
+    /// Long schema.
+    /// </summary>
+    public static LongSchema Int64 { get; }
 
-        /// <summary>
-        /// Long schema.
-        /// </summary>
-        public static LongSchema Int64 { get; }
+    /// <summary>
+    /// Float schema.
+    /// </summary>
+    public static FloatSchema Float { get; }
 
-        /// <summary>
-        /// Float schema.
-        /// </summary>
-        public static FloatSchema Float { get; }
+    /// <summary>
+    /// Timestamp schema using DateTime.
+    /// </summary>
+    public static TimestampSchema TimeStamp { get; }
 
-        /// <summary>
-        /// Timestamp schema using DateTime.
-        /// </summary>
-        public static TimestampSchema TimeStamp { get; }
+    /// <summary>
+    /// Date schema using DateTime.
+    /// </summary>
+    public static TimestampSchema Date { get; }
 
-        /// <summary>
-        /// Date schema using DateTime.
-        /// </summary>
-        public static TimestampSchema Date { get; }
-
-        /// <summary>
-        /// Time schema using TimeSpan.
-        /// </summary>
-        public static TimeSchema Time { get; }
-    }
+    /// <summary>
+    /// Time schema using TimeSpan.
+    /// </summary>
+    public static TimeSchema Time { get; }
 }
diff --git a/src/DotPulsar/SchemaInfo.cs b/src/DotPulsar/SchemaInfo.cs
index 8e0a375..3e3c831 100644
--- a/src/DotPulsar/SchemaInfo.cs
+++ b/src/DotPulsar/SchemaInfo.cs
@@ -12,60 +12,59 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using System.Collections.Generic;
+using System.Linq;
+
+/// <summary>
+/// Information about the schema.
+/// </summary>
+public sealed class SchemaInfo
 {
-    using System.Collections.Generic;
-    using System.Linq;
+    internal SchemaInfo(Internal.PulsarApi.Schema schema)
+        => PulsarSchema = schema;
 
-    /// <summary>
-    /// Information about the schema.
-    /// </summary>
-    public sealed class SchemaInfo
+    public SchemaInfo(string name, byte[] data, SchemaType type, IReadOnlyDictionary<string, string> properties)
     {
-        internal SchemaInfo(Internal.PulsarApi.Schema schema)
-            => PulsarSchema = schema;
-
-        public SchemaInfo(string name, byte[] data, SchemaType type, IReadOnlyDictionary<string, string> properties)
+        PulsarSchema = new Internal.PulsarApi.Schema
         {
-            PulsarSchema = new Internal.PulsarApi.Schema
+            Name = name,
+            SchemaData = data,
+            Type = (Internal.PulsarApi.Schema.SchemaType) type,
+        };
+
+        foreach (var property in properties)
+        {
+            var keyValue = new Internal.PulsarApi.KeyValue
             {
-                Name = name,
-                SchemaData = data,
-                Type = (Internal.PulsarApi.Schema.SchemaType) type,
+                Key = property.Key,
+                Value = property.Value
             };
 
-            foreach (var property in properties)
-            {
-                var keyValue = new Internal.PulsarApi.KeyValue
-                {
-                    Key = property.Key,
-                    Value = property.Value
-                };
-
-                PulsarSchema.Properties.Add(keyValue);
-            }
+            PulsarSchema.Properties.Add(keyValue);
         }
-
-        internal Internal.PulsarApi.Schema PulsarSchema { get; }
-
-        /// <summary>
-        /// The name of the schema.
-        /// </summary>
-        public string Name => PulsarSchema.Name;
-
-        /// <summary>
-        /// The data of the schema.
-        /// </summary>
-        public byte[] Data => PulsarSchema.SchemaData;
-
-        /// <summary>
-        /// The type of the schema.
-        /// </summary>
-        public SchemaType Type => (SchemaType) PulsarSchema.Type;
-
-        /// <summary>
-        /// The properties of the schema.
-        /// </summary>
-        public IReadOnlyDictionary<string, string> Properties => PulsarSchema.Properties.ToDictionary(p => p.Key, p => p.Value);
     }
+
+    internal Internal.PulsarApi.Schema PulsarSchema { get; }
+
+    /// <summary>
+    /// The name of the schema.
+    /// </summary>
+    public string Name => PulsarSchema.Name;
+
+    /// <summary>
+    /// The data of the schema.
+    /// </summary>
+    public byte[] Data => PulsarSchema.SchemaData;
+
+    /// <summary>
+    /// The type of the schema.
+    /// </summary>
+    public SchemaType Type => (SchemaType) PulsarSchema.Type;
+
+    /// <summary>
+    /// The properties of the schema.
+    /// </summary>
+    public IReadOnlyDictionary<string, string> Properties => PulsarSchema.Properties.ToDictionary(p => p.Key, p => p.Value);
 }
diff --git a/src/DotPulsar/SchemaType.cs b/src/DotPulsar/SchemaType.cs
index 2c9f57a..81ad9b4 100644
--- a/src/DotPulsar/SchemaType.cs
+++ b/src/DotPulsar/SchemaType.cs
@@ -12,116 +12,115 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// The supported schema types for messages.
+/// </summary>
+public enum SchemaType : byte
 {
     /// <summary>
-    /// The supported schema types for messages.
+    /// No schema.
     /// </summary>
-    public enum SchemaType : byte
-    {
-        /// <summary>
-        /// No schema.
-        /// </summary>
-        None = 0,
+    None = 0,
 
-        /// <summary>
-        /// UTF-8 schema.
-        /// </summary>
-        String = 1,
+    /// <summary>
+    /// UTF-8 schema.
+    /// </summary>
+    String = 1,
 
-        /// <summary>
-        /// JSON schema.
-        /// </summary>
-        Json = 2,
+    /// <summary>
+    /// JSON schema.
+    /// </summary>
+    Json = 2,
 
-        /// <summary>
-        /// Protobuf schema.
-        /// </summary>
-        Protobuf = 3,
+    /// <summary>
+    /// Protobuf schema.
+    /// </summary>
+    Protobuf = 3,
 
-        /// <summary>
-        /// Avro schema.
-        /// </summary>
-        Avro = 4,
+    /// <summary>
+    /// Avro schema.
+    /// </summary>
+    Avro = 4,
 
-        /// <summary>
-        /// Boolean schema.
-        /// </summary>
-        Boolean = 5,
+    /// <summary>
+    /// Boolean schema.
+    /// </summary>
+    Boolean = 5,
 
-        /// <summary>
-        /// 8-byte integer schema.
-        /// </summary>
-        Int8 = 6,
+    /// <summary>
+    /// 8-byte integer schema.
+    /// </summary>
+    Int8 = 6,
 
-        /// <summary>
-        /// 16-byte integer schema.
-        /// </summary>
-        Int16 = 7,
+    /// <summary>
+    /// 16-byte integer schema.
+    /// </summary>
+    Int16 = 7,
 
-        /// <summary>
-        ///32-byte integer schema.
-        /// </summary>
-        Int32 = 8,
+    /// <summary>
+    ///32-byte integer schema.
+    /// </summary>
+    Int32 = 8,
 
-        /// <summary>
-        /// 64-byte integer schema.
-        /// </summary>
-        Int64 = 9,
+    /// <summary>
+    /// 64-byte integer schema.
+    /// </summary>
+    Int64 = 9,
 
-        /// <summary>
-        /// Float schema.
-        /// </summary>
-        Float = 10,
+    /// <summary>
+    /// Float schema.
+    /// </summary>
+    Float = 10,
 
-        /// <summary>
-        /// Double schema.
-        /// </summary>
-        Double = 11,
+    /// <summary>
+    /// Double schema.
+    /// </summary>
+    Double = 11,
 
-        /// <summary>
-        /// Date schema.
-        /// </summary>
-        Date = 12,
+    /// <summary>
+    /// Date schema.
+    /// </summary>
+    Date = 12,
 
-        /// <summary>
-        /// Time schema.
-        /// </summary>
-        Time = 13,
+    /// <summary>
+    /// Time schema.
+    /// </summary>
+    Time = 13,
 
-        /// <summary>
-        /// Timestamp schema.
-        /// </summary>
-        Timestamp = 14,
+    /// <summary>
+    /// Timestamp schema.
+    /// </summary>
+    Timestamp = 14,
 
-        /// <summary>
-        /// KeyValue schema.
-        /// </summary>
-        KeyValue = 15,
+    /// <summary>
+    /// KeyValue schema.
+    /// </summary>
+    KeyValue = 15,
 
-        /// <summary>
-        /// Instant schema.
-        /// </summary>
-        Instant = 16,
+    /// <summary>
+    /// Instant schema.
+    /// </summary>
+    Instant = 16,
 
-        /// <summary>
-        /// Local date schema.
-        /// </summary>
-        LocalDate = 17,
+    /// <summary>
+    /// Local date schema.
+    /// </summary>
+    LocalDate = 17,
 
-        /// <summary>
-        /// Local time schema.
-        /// </summary>
-        LocalTime = 18,
+    /// <summary>
+    /// Local time schema.
+    /// </summary>
+    LocalTime = 18,
 
-        /// <summary>
-        /// Local data time schema.
-        /// </summary>
-        LocalDateTime = 19,
+    /// <summary>
+    /// Local data time schema.
+    /// </summary>
+    LocalDateTime = 19,
 
-        /// <summary>
-        /// Protobuf native schema.
-        /// </summary>
-        ProtobufNative = 20
-    }
+    /// <summary>
+    /// Protobuf native schema.
+    /// </summary>
+    ProtobufNative = 20
 }
diff --git a/src/DotPulsar/Schemas/BooleanSchema.cs b/src/DotPulsar/Schemas/BooleanSchema.cs
index 962379e..be16429 100644
--- a/src/DotPulsar/Schemas/BooleanSchema.cs
+++ b/src/DotPulsar/Schemas/BooleanSchema.cs
@@ -12,42 +12,41 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+
+/// <summary>
+/// Schema definition for Boolean messages.
+/// </summary>
+public sealed class BooleanSchema : ISchema<bool>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
+    private static readonly ReadOnlySequence<byte> _true;
+    private static readonly ReadOnlySequence<byte> _false;
 
-    /// <summary>
-    /// Schema definition for Boolean messages.
-    /// </summary>
-    public sealed class BooleanSchema : ISchema<bool>
+    static BooleanSchema()
     {
-        private static readonly ReadOnlySequence<byte> _true;
-        private static readonly ReadOnlySequence<byte> _false;
-
-        static BooleanSchema()
-        {
-            _true = new ReadOnlySequence<byte>(new byte[] { 1 });
-            _false = new ReadOnlySequence<byte>(new byte[] { 0 });
-        }
-
-        public BooleanSchema()
-            => SchemaInfo = new SchemaInfo("Boolean", Array.Empty<byte>(), SchemaType.Boolean, ImmutableDictionary<string, string>.Empty);
-
-        public SchemaInfo SchemaInfo { get; }
-
-        public bool Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 1)
-                throw new SchemaSerializationException($"{nameof(BooleanSchema)} expected to decode 1 byte, but received {bytes} bytes");
-
-            return bytes.First.Span[0] != 0;
-        }
-
-        public ReadOnlySequence<byte> Encode(bool message)
-            => message ? _true : _false;
+        _true = new ReadOnlySequence<byte>(new byte[] { 1 });
+        _false = new ReadOnlySequence<byte>(new byte[] { 0 });
     }
+
+    public BooleanSchema()
+        => SchemaInfo = new SchemaInfo("Boolean", Array.Empty<byte>(), SchemaType.Boolean, ImmutableDictionary<string, string>.Empty);
+
+    public SchemaInfo SchemaInfo { get; }
+
+    public bool Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
+    {
+        if (bytes.Length != 1)
+            throw new SchemaSerializationException($"{nameof(BooleanSchema)} expected to decode 1 byte, but received {bytes} bytes");
+
+        return bytes.First.Span[0] != 0;
+    }
+
+    public ReadOnlySequence<byte> Encode(bool message)
+        => message ? _true : _false;
 }
diff --git a/src/DotPulsar/Schemas/ByteArraySchema.cs b/src/DotPulsar/Schemas/ByteArraySchema.cs
index 979562c..fdeeb6a 100644
--- a/src/DotPulsar/Schemas/ByteArraySchema.cs
+++ b/src/DotPulsar/Schemas/ByteArraySchema.cs
@@ -12,27 +12,26 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+
+/// <summary>
+/// Schema definition for raw messages using byte[].
+/// </summary>
+public sealed class ByteArraySchema : ISchema<byte[]>
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
+    public ByteArraySchema()
+        => SchemaInfo = new SchemaInfo("Bytes", Array.Empty<byte>(), SchemaType.None, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for raw messages using byte[].
-    /// </summary>
-    public sealed class ByteArraySchema : ISchema<byte[]>
-    {
-        public ByteArraySchema()
-            => SchemaInfo = new SchemaInfo("Bytes", Array.Empty<byte>(), SchemaType.None, ImmutableDictionary<string, string>.Empty);
+    public SchemaInfo SchemaInfo { get; }
 
-        public SchemaInfo SchemaInfo { get; }
+    public byte[] Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
+        => bytes.ToArray();
 
-        public byte[] Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-            => bytes.ToArray();
-
-        public ReadOnlySequence<byte> Encode(byte[] message)
-            => new(message);
-    }
+    public ReadOnlySequence<byte> Encode(byte[] message)
+        => new(message);
 }
diff --git a/src/DotPulsar/Schemas/ByteSchema.cs b/src/DotPulsar/Schemas/ByteSchema.cs
index 14caebc..4eb1133 100644
--- a/src/DotPulsar/Schemas/ByteSchema.cs
+++ b/src/DotPulsar/Schemas/ByteSchema.cs
@@ -12,33 +12,32 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+
+/// <summary>
+/// Schema definition for Byte (int8) messages.
+/// </summary>
+public sealed class ByteSchema : ISchema<byte>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
+    public ByteSchema()
+        => SchemaInfo = new SchemaInfo("INT8", Array.Empty<byte>(), SchemaType.Int8, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for Byte (int8) messages.
-    /// </summary>
-    public sealed class ByteSchema : ISchema<byte>
+    public SchemaInfo SchemaInfo { get; }
+
+    public byte Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
     {
-        public ByteSchema()
-            => SchemaInfo = new SchemaInfo("INT8", Array.Empty<byte>(), SchemaType.Int8, ImmutableDictionary<string, string>.Empty);
+        if (bytes.Length != 1)
+            throw new SchemaSerializationException($"{nameof(ByteSchema)} expected to decode 1 byte, but received {bytes} bytes");
 
-        public SchemaInfo SchemaInfo { get; }
-
-        public byte Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 1)
-                throw new SchemaSerializationException($"{nameof(ByteSchema)} expected to decode 1 byte, but received {bytes} bytes");
-
-            return bytes.First.Span[0];
-        }
-
-        public ReadOnlySequence<byte> Encode(byte message)
-            => new(new[] { message });
+        return bytes.First.Span[0];
     }
+
+    public ReadOnlySequence<byte> Encode(byte message)
+        => new(new[] { message });
 }
diff --git a/src/DotPulsar/Schemas/ByteSequenceSchema.cs b/src/DotPulsar/Schemas/ByteSequenceSchema.cs
index d8c8282..617891d 100644
--- a/src/DotPulsar/Schemas/ByteSequenceSchema.cs
+++ b/src/DotPulsar/Schemas/ByteSequenceSchema.cs
@@ -12,27 +12,26 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+
+/// <summary>
+/// Schema definition for raw messages using ReadOnlySequence of bytes.
+/// </summary>
+public sealed class ByteSequenceSchema : ISchema<ReadOnlySequence<byte>>
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
+    public ByteSequenceSchema()
+        => SchemaInfo = new SchemaInfo("Bytes", Array.Empty<byte>(), SchemaType.None, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for raw messages using ReadOnlySequence of bytes.
-    /// </summary>
-    public sealed class ByteSequenceSchema : ISchema<ReadOnlySequence<byte>>
-    {
-        public ByteSequenceSchema()
-            => SchemaInfo = new SchemaInfo("Bytes", Array.Empty<byte>(), SchemaType.None, ImmutableDictionary<string, string>.Empty);
+    public SchemaInfo SchemaInfo { get; }
 
-        public SchemaInfo SchemaInfo { get; }
+    public ReadOnlySequence<byte> Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
+        => bytes;
 
-        public ReadOnlySequence<byte> Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-            => bytes;
-
-        public ReadOnlySequence<byte> Encode(ReadOnlySequence<byte> message)
-            => message;
-    }
+    public ReadOnlySequence<byte> Encode(ReadOnlySequence<byte> message)
+        => message;
 }
diff --git a/src/DotPulsar/Schemas/DoubleSchema.cs b/src/DotPulsar/Schemas/DoubleSchema.cs
index 0f7552e..c827424 100644
--- a/src/DotPulsar/Schemas/DoubleSchema.cs
+++ b/src/DotPulsar/Schemas/DoubleSchema.cs
@@ -12,47 +12,46 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+using System.Linq;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// Schema definition for Double messages.
+/// </summary>
+public sealed class DoubleSchema : ISchema<double>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
-    using System.Linq;
-    using System.Runtime.InteropServices;
+    public DoubleSchema()
+        => SchemaInfo = new SchemaInfo("Double", Array.Empty<byte>(), SchemaType.Double, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for Double messages.
-    /// </summary>
-    public sealed class DoubleSchema : ISchema<double>
+    public SchemaInfo SchemaInfo { get; }
+
+    public double Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
     {
-        public DoubleSchema()
-            => SchemaInfo = new SchemaInfo("Double", Array.Empty<byte>(), SchemaType.Double, ImmutableDictionary<string, string>.Empty);
+        if (bytes.Length != 8)
+            throw new SchemaSerializationException($"{nameof(DoubleSchema)} expected to decode 8 bytes, but received {bytes} bytes");
 
-        public SchemaInfo SchemaInfo { get; }
+        var array = bytes.ToArray();
 
-        public double Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 8)
-                throw new SchemaSerializationException($"{nameof(DoubleSchema)} expected to decode 8 bytes, but received {bytes} bytes");
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-            var array = bytes.ToArray();
+        return MemoryMarshal.Read<double>(array);
+    }
 
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
+    public ReadOnlySequence<byte> Encode(double message)
+    {
+        var array = BitConverter.GetBytes(message);
 
-            return MemoryMarshal.Read<double>(array);
-        }
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-        public ReadOnlySequence<byte> Encode(double message)
-        {
-            var array = BitConverter.GetBytes(message);
-
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
-
-            return new(array);
-        }
+        return new(array);
     }
 }
diff --git a/src/DotPulsar/Schemas/FloatSchema .cs b/src/DotPulsar/Schemas/FloatSchema .cs
index 3040669..d62ecc7 100644
--- a/src/DotPulsar/Schemas/FloatSchema .cs
+++ b/src/DotPulsar/Schemas/FloatSchema .cs
@@ -12,47 +12,46 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+using System.Linq;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// Schema definition for Float messages.
+/// </summary>
+public sealed class FloatSchema : ISchema<float>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
-    using System.Linq;
-    using System.Runtime.InteropServices;
+    public FloatSchema()
+        => SchemaInfo = new SchemaInfo("Float", Array.Empty<byte>(), SchemaType.Float, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for Float messages.
-    /// </summary>
-    public sealed class FloatSchema : ISchema<float>
+    public SchemaInfo SchemaInfo { get; }
+
+    public float Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
     {
-        public FloatSchema()
-            => SchemaInfo = new SchemaInfo("Float", Array.Empty<byte>(), SchemaType.Float, ImmutableDictionary<string, string>.Empty);
+        if (bytes.Length != 4)
+            throw new SchemaSerializationException($"{nameof(FloatSchema)} expected to decode 4 bytes, but received {bytes} bytes");
 
-        public SchemaInfo SchemaInfo { get; }
+        var array = bytes.ToArray();
 
-        public float Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 4)
-                throw new SchemaSerializationException($"{nameof(FloatSchema)} expected to decode 4 bytes, but received {bytes} bytes");
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-            var array = bytes.ToArray();
+        return MemoryMarshal.Read<float>(array);
+    }
 
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
+    public ReadOnlySequence<byte> Encode(float message)
+    {
+        var array = BitConverter.GetBytes(message);
 
-            return MemoryMarshal.Read<float>(array);
-        }
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-        public ReadOnlySequence<byte> Encode(float message)
-        {
-            var array = BitConverter.GetBytes(message);
-
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
-
-            return new(array);
-        }
+        return new(array);
     }
 }
diff --git a/src/DotPulsar/Schemas/IntegerSchema.cs b/src/DotPulsar/Schemas/IntegerSchema.cs
index 69d079b..25ebb23 100644
--- a/src/DotPulsar/Schemas/IntegerSchema.cs
+++ b/src/DotPulsar/Schemas/IntegerSchema.cs
@@ -12,47 +12,46 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+using System.Linq;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// Schema definition for Integer (int32) messages.
+/// </summary>
+public sealed class IntegerSchema : ISchema<int>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
-    using System.Linq;
-    using System.Runtime.InteropServices;
+    public IntegerSchema()
+        => SchemaInfo = new SchemaInfo("INT32", Array.Empty<byte>(), SchemaType.Int32, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for Integer (int32) messages.
-    /// </summary>
-    public sealed class IntegerSchema : ISchema<int>
+    public SchemaInfo SchemaInfo { get; }
+
+    public int Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
     {
-        public IntegerSchema()
-            => SchemaInfo = new SchemaInfo("INT32", Array.Empty<byte>(), SchemaType.Int32, ImmutableDictionary<string, string>.Empty);
+        if (bytes.Length != 4)
+            throw new SchemaSerializationException($"{nameof(IntegerSchema)} expected to decode 4 bytes, but received {bytes} bytes");
 
-        public SchemaInfo SchemaInfo { get; }
+        var array = bytes.ToArray();
 
-        public int Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 4)
-                throw new SchemaSerializationException($"{nameof(IntegerSchema)} expected to decode 4 bytes, but received {bytes} bytes");
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-            var array = bytes.ToArray();
+        return MemoryMarshal.Read<int>(array);
+    }
 
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
+    public ReadOnlySequence<byte> Encode(int message)
+    {
+        var array = BitConverter.GetBytes(message);
 
-            return MemoryMarshal.Read<int>(array);
-        }
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-        public ReadOnlySequence<byte> Encode(int message)
-        {
-            var array = BitConverter.GetBytes(message);
-
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
-
-            return new(array);
-        }
+        return new(array);
     }
 }
diff --git a/src/DotPulsar/Schemas/LongSchema.cs b/src/DotPulsar/Schemas/LongSchema.cs
index be40c4f..2976f7a 100644
--- a/src/DotPulsar/Schemas/LongSchema.cs
+++ b/src/DotPulsar/Schemas/LongSchema.cs
@@ -12,47 +12,46 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+using System.Linq;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// Schema definition for Long (int64) messages.
+/// </summary>
+public sealed class LongSchema : ISchema<long>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
-    using System.Linq;
-    using System.Runtime.InteropServices;
+    public LongSchema()
+        => SchemaInfo = new SchemaInfo("INT64", Array.Empty<byte>(), SchemaType.Int64, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for Long (int64) messages.
-    /// </summary>
-    public sealed class LongSchema : ISchema<long>
+    public SchemaInfo SchemaInfo { get; }
+
+    public long Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
     {
-        public LongSchema()
-            => SchemaInfo = new SchemaInfo("INT64", Array.Empty<byte>(), SchemaType.Int64, ImmutableDictionary<string, string>.Empty);
+        if (bytes.Length != 8)
+            throw new SchemaSerializationException($"{nameof(LongSchema)} expected to decode 8 bytes, but received {bytes} bytes");
 
-        public SchemaInfo SchemaInfo { get; }
+        var array = bytes.ToArray();
 
-        public long Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 8)
-                throw new SchemaSerializationException($"{nameof(LongSchema)} expected to decode 8 bytes, but received {bytes} bytes");
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-            var array = bytes.ToArray();
+        return MemoryMarshal.Read<long>(array);
+    }
 
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
+    public ReadOnlySequence<byte> Encode(long message)
+    {
+        var array = BitConverter.GetBytes(message);
 
-            return MemoryMarshal.Read<long>(array);
-        }
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-        public ReadOnlySequence<byte> Encode(long message)
-        {
-            var array = BitConverter.GetBytes(message);
-
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
-
-            return new(array);
-        }
+        return new(array);
     }
 }
diff --git a/src/DotPulsar/Schemas/ShortSchema.cs b/src/DotPulsar/Schemas/ShortSchema.cs
index 3c84100..21b1978 100644
--- a/src/DotPulsar/Schemas/ShortSchema.cs
+++ b/src/DotPulsar/Schemas/ShortSchema.cs
@@ -12,47 +12,46 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+using System.Linq;
+using System.Runtime.InteropServices;
+
+/// <summary>
+/// Schema definition for Short (int16) messages.
+/// </summary>
+public sealed class ShortSchema : ISchema<short>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
-    using System.Linq;
-    using System.Runtime.InteropServices;
+    public ShortSchema()
+        => SchemaInfo = new SchemaInfo("INT16", Array.Empty<byte>(), SchemaType.Int16, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for Short (int16) messages.
-    /// </summary>
-    public sealed class ShortSchema : ISchema<short>
+    public SchemaInfo SchemaInfo { get; }
+
+    public short Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
     {
-        public ShortSchema()
-            => SchemaInfo = new SchemaInfo("INT16", Array.Empty<byte>(), SchemaType.Int16, ImmutableDictionary<string, string>.Empty);
+        if (bytes.Length != 2)
+            throw new SchemaSerializationException($"{nameof(ShortSchema)} expected to decode 2 bytes, but received {bytes} bytes");
 
-        public SchemaInfo SchemaInfo { get; }
+        var array = bytes.ToArray();
 
-        public short Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 2)
-                throw new SchemaSerializationException($"{nameof(ShortSchema)} expected to decode 2 bytes, but received {bytes} bytes");
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-            var array = bytes.ToArray();
+        return MemoryMarshal.Read<short>(array);
+    }
 
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
+    public ReadOnlySequence<byte> Encode(short message)
+    {
+        var array = BitConverter.GetBytes(message);
 
-            return MemoryMarshal.Read<short>(array);
-        }
+        if (BitConverter.IsLittleEndian)
+            Array.Reverse(array);
 
-        public ReadOnlySequence<byte> Encode(short message)
-        {
-            var array = BitConverter.GetBytes(message);
-
-            if (BitConverter.IsLittleEndian)
-                Array.Reverse(array);
-
-            return new(array);
-        }
+        return new(array);
     }
 }
diff --git a/src/DotPulsar/Schemas/StringSchema.cs b/src/DotPulsar/Schemas/StringSchema.cs
index 50a688b..d80c5cc 100644
--- a/src/DotPulsar/Schemas/StringSchema.cs
+++ b/src/DotPulsar/Schemas/StringSchema.cs
@@ -12,99 +12,98 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using System;
+using System.Buffers;
+using System.Collections.Generic;
+using System.Text;
+
+/// <summary>
+/// Schema definition for UTF-8 (default), UTF-16 (unicode) or US-ASCII encoded strings.
+/// </summary>
+public sealed class StringSchema : ISchema<string>
 {
-    using DotPulsar.Abstractions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Generic;
-    using System.Text;
+    private const string _charSetKey = "__charset";
+    private const string _utf8 = "UTF-8";
+    private const string _unicode = "UTF-16";
+    private const string _ascii = "US-ASCII";
+
+    static StringSchema()
+    {
+        UTF8 = new StringSchema(Encoding.UTF8);
+        Unicode = new StringSchema(Encoding.Unicode);
+        ASCII = new StringSchema(Encoding.ASCII);
+    }
 
     /// <summary>
-    /// Schema definition for UTF-8 (default), UTF-16 (unicode) or US-ASCII encoded strings.
+    /// Schema definition for UTF-8 encoded strings.
     /// </summary>
-    public sealed class StringSchema : ISchema<string>
+    public static StringSchema UTF8 { get; }
+
+    /// <summary>
+    /// Schema definition for UTF-16 encoded strings.
+    /// </summary>
+    public static StringSchema Unicode { get; }
+
+    /// <summary>
+    /// Schema definition for US-ASCII encoded strings.
+    /// </summary>
+    public static StringSchema ASCII { get; }
+
+    private static string GetCharSet(string encodingName)
     {
-        private const string _charSetKey = "__charset";
-        private const string _utf8 = "UTF-8";
-        private const string _unicode = "UTF-16";
-        private const string _ascii = "US-ASCII";
-
-        static StringSchema()
+        return encodingName switch
         {
-            UTF8 = new StringSchema(Encoding.UTF8);
-            Unicode = new StringSchema(Encoding.Unicode);
-            ASCII = new StringSchema(Encoding.ASCII);
-        }
+            "Unicode (UTF-8)" => _utf8,
+            "Unicode" => _unicode,
+            "US-ASCII" => _ascii,
+            _ => throw new Exception($"Encoding '{encodingName}' is not supported!")
+        };
+    }
 
-        /// <summary>
-        /// Schema definition for UTF-8 encoded strings.
-        /// </summary>
-        public static StringSchema UTF8 { get; }
-
-        /// <summary>
-        /// Schema definition for UTF-16 encoded strings.
-        /// </summary>
-        public static StringSchema Unicode { get; }
-
-        /// <summary>
-        /// Schema definition for US-ASCII encoded strings.
-        /// </summary>
-        public static StringSchema ASCII { get; }
-
-        private static string GetCharSet(string encodingName)
+    private static StringSchema GetSchema(string charSet)
+    {
+        return charSet switch
         {
-            return encodingName switch
-            {
-                "Unicode (UTF-8)" => _utf8,
-                "Unicode" => _unicode,
-                "US-ASCII" => _ascii,
-                _ => throw new Exception($"Encoding '{encodingName}' is not supported!")
-            };
-        }
+            _utf8 => UTF8,
+            _unicode => Unicode,
+            _ascii => ASCII,
+            _ => throw new Exception($"CharSet '{charSet}' is not supported!")
+        };
+    }
 
-        private static StringSchema GetSchema(string charSet)
-        {
-            return charSet switch
-            {
-                _utf8 => UTF8,
-                _unicode => Unicode,
-                _ascii => ASCII,
-                _ => throw new Exception($"CharSet '{charSet}' is not supported!")
-            };
-        }
+    public static StringSchema From(SchemaInfo schemaInfo)
+    {
+        if (schemaInfo.Type != SchemaType.String)
+            throw new Exception("Not a string schema!");
 
-        public static StringSchema From(SchemaInfo schemaInfo)
-        {
-            if (schemaInfo.Type != SchemaType.String)
-                throw new Exception("Not a string schema!");
+        if (schemaInfo.Properties.TryGetValue(_charSetKey, out var charset))
+            return GetSchema(charset);
+        else
+            return UTF8;
+    }
 
-            if (schemaInfo.Properties.TryGetValue(_charSetKey, out var charset))
-                return GetSchema(charset);
-            else
-                return UTF8;
-        }
+    private readonly Encoding _encoding;
 
-        private readonly Encoding _encoding;
+    public StringSchema(Encoding encoding)
+    {
+        _encoding = encoding;
 
-        public StringSchema(Encoding encoding)
-        {
-            _encoding = encoding;
-
-            var properties = new Dictionary<string, string>
+        var properties = new Dictionary<string, string>
             {
                 { _charSetKey, GetCharSet(encoding.EncodingName) }
             };
 
-            SchemaInfo = new SchemaInfo("String", Array.Empty<byte>(), SchemaType.String, properties);
-        }
-
-        public SchemaInfo SchemaInfo { get; }
-
-        public string Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion)
-            => _encoding.GetString(bytes.ToArray());
-
-        public ReadOnlySequence<byte> Encode(string message)
-            => new(_encoding.GetBytes(message));
+        SchemaInfo = new SchemaInfo("String", Array.Empty<byte>(), SchemaType.String, properties);
     }
+
+    public SchemaInfo SchemaInfo { get; }
+
+    public string Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion)
+        => _encoding.GetString(bytes.ToArray());
+
+    public ReadOnlySequence<byte> Encode(string message)
+        => new(_encoding.GetBytes(message));
 }
diff --git a/src/DotPulsar/Schemas/TimeSchema.cs b/src/DotPulsar/Schemas/TimeSchema.cs
index 67d6775..7b9e9d6 100644
--- a/src/DotPulsar/Schemas/TimeSchema.cs
+++ b/src/DotPulsar/Schemas/TimeSchema.cs
@@ -12,37 +12,36 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+
+/// <summary>
+/// Schema definition for Time (TimeSpan) messages.
+/// </summary>
+public sealed class TimeSchema : ISchema<TimeSpan>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
+    public TimeSchema()
+        => SchemaInfo = new SchemaInfo("Time", Array.Empty<byte>(), SchemaType.Time, ImmutableDictionary<string, string>.Empty);
 
-    /// <summary>
-    /// Schema definition for Time (TimeSpan) messages.
-    /// </summary>
-    public sealed class TimeSchema : ISchema<TimeSpan>
+    public SchemaInfo SchemaInfo { get; }
+
+    public TimeSpan Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
     {
-        public TimeSchema()
-            => SchemaInfo = new SchemaInfo("Time", Array.Empty<byte>(), SchemaType.Time, ImmutableDictionary<string, string>.Empty);
+        if (bytes.Length != 8)
+            throw new SchemaSerializationException($"{nameof(TimestampSchema)} expected to decode 8 bytes, but received {bytes} bytes");
 
-        public SchemaInfo SchemaInfo { get; }
+        var milliseconds = Schema.Int64.Decode(bytes);
+        return TimeSpan.FromMilliseconds(milliseconds);
+    }
 
-        public TimeSpan Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 8)
-                throw new SchemaSerializationException($"{nameof(TimestampSchema)} expected to decode 8 bytes, but received {bytes} bytes");
-
-            var milliseconds = Schema.Int64.Decode(bytes);
-            return TimeSpan.FromMilliseconds(milliseconds);
-        }
-
-        public ReadOnlySequence<byte> Encode(TimeSpan message)
-        {
-            var milliseconds = (long) message.TotalMilliseconds;
-            return Schema.Int64.Encode(milliseconds);
-        }
+    public ReadOnlySequence<byte> Encode(TimeSpan message)
+    {
+        var milliseconds = (long) message.TotalMilliseconds;
+        return Schema.Int64.Encode(milliseconds);
     }
 }
diff --git a/src/DotPulsar/Schemas/TimestampSchema.cs b/src/DotPulsar/Schemas/TimestampSchema.cs
index 18bee0a..9f21b34 100644
--- a/src/DotPulsar/Schemas/TimestampSchema.cs
+++ b/src/DotPulsar/Schemas/TimestampSchema.cs
@@ -12,53 +12,52 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Schemas
+namespace DotPulsar.Schemas;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Exceptions;
+using System;
+using System.Buffers;
+using System.Collections.Immutable;
+
+/// <summary>
+/// Schema definition for Timestamp (DateTime) messages.
+/// </summary>
+public sealed class TimestampSchema : ISchema<DateTime>
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Exceptions;
-    using System;
-    using System.Buffers;
-    using System.Collections.Immutable;
-
-    /// <summary>
-    /// Schema definition for Timestamp (DateTime) messages.
-    /// </summary>
-    public sealed class TimestampSchema : ISchema<DateTime>
+    static TimestampSchema()
     {
-        static TimestampSchema()
-        {
-            Timestamp = new TimestampSchema(new SchemaInfo("Timestamp", Array.Empty<byte>(), SchemaType.Timestamp, ImmutableDictionary<string, string>.Empty));
-            Date = new TimestampSchema(new SchemaInfo("Date", Array.Empty<byte>(), SchemaType.Date, ImmutableDictionary<string, string>.Empty));
-        }
+        Timestamp = new TimestampSchema(new SchemaInfo("Timestamp", Array.Empty<byte>(), SchemaType.Timestamp, ImmutableDictionary<string, string>.Empty));
+        Date = new TimestampSchema(new SchemaInfo("Date", Array.Empty<byte>(), SchemaType.Date, ImmutableDictionary<string, string>.Empty));
+    }
 
-        public static TimestampSchema Timestamp { get; }
-        public static TimestampSchema Date { get; }
+    public static TimestampSchema Timestamp { get; }
+    public static TimestampSchema Date { get; }
 
-        public TimestampSchema(SchemaInfo schemaInfo)
-            => SchemaInfo = schemaInfo;
+    public TimestampSchema(SchemaInfo schemaInfo)
+        => SchemaInfo = schemaInfo;
 
-        public SchemaInfo SchemaInfo { get; }
+    public SchemaInfo SchemaInfo { get; }
 
-        public DateTime Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
-        {
-            if (bytes.Length != 8)
-                throw new SchemaSerializationException($"{nameof(TimestampSchema)} expected to decode 8 bytes, but received {bytes} bytes");
+    public DateTime Decode(ReadOnlySequence<byte> bytes, byte[]? schemaVersion = null)
+    {
+        if (bytes.Length != 8)
+            throw new SchemaSerializationException($"{nameof(TimestampSchema)} expected to decode 8 bytes, but received {bytes} bytes");
 
-            var milliseconds = Schema.Int64.Decode(bytes);
+        var milliseconds = Schema.Int64.Decode(bytes);
 
-            if (milliseconds < -62135596800000)
-                return DateTime.MinValue;
+        if (milliseconds < -62135596800000)
+            return DateTime.MinValue;
 
-            if (milliseconds > 253402300799999)
-                return DateTime.MaxValue;
+        if (milliseconds > 253402300799999)
+            return DateTime.MaxValue;
 
-            return DateTimeOffset.FromUnixTimeMilliseconds(milliseconds).DateTime;
-        }
+        return DateTimeOffset.FromUnixTimeMilliseconds(milliseconds).DateTime;
+    }
 
-        public ReadOnlySequence<byte> Encode(DateTime message)
-        {
-            var milliseconds = new DateTimeOffset(message).ToUnixTimeMilliseconds();
-            return Schema.Int64.Encode(milliseconds);
-        }
+    public ReadOnlySequence<byte> Encode(DateTime message)
+    {
+        var milliseconds = new DateTimeOffset(message).ToUnixTimeMilliseconds();
+        return Schema.Int64.Encode(milliseconds);
     }
 }
diff --git a/src/DotPulsar/SinglePartitionRouter.cs b/src/DotPulsar/SinglePartitionRouter.cs
index 44e80eb..af13c91 100644
--- a/src/DotPulsar/SinglePartitionRouter.cs
+++ b/src/DotPulsar/SinglePartitionRouter.cs
@@ -12,50 +12,49 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+using Abstractions;
+using HashDepot;
+using System;
+
+/// <summary>
+/// The single partition messages router.
+/// If a key is provided, the producer will hash the key and publish the message to a particular partition.
+/// If a key is not provided, the producer will randomly pick one single partition and publish all messages to that partition.
+/// </summary>
+public sealed class SinglePartitionRouter : IMessageRouter
 {
-    using Abstractions;
-    using HashDepot;
-    using System;
+    private int _partitionIndex;
 
     /// <summary>
-    /// The single partition messages router.
-    /// If a key is provided, the producer will hash the key and publish the message to a particular partition.
-    /// If a key is not provided, the producer will randomly pick one single partition and publish all messages to that partition.
+    /// Initializes a new instance of the single partition router that will randomly select a partition
     /// </summary>
-    public sealed class SinglePartitionRouter : IMessageRouter
+    public SinglePartitionRouter()
     {
-        private int _partitionIndex;
+        _partitionIndex = -1;
+    }
 
-        /// <summary>
-        /// Initializes a new instance of the single partition router that will randomly select a partition
-        /// </summary>
-        public SinglePartitionRouter()
-        {
-            _partitionIndex = -1;
-        }
+    /// <summary>
+    /// Initializes a new instance of the single partition router that will publish all messages to the given partition
+    /// </summary>
+    public SinglePartitionRouter(int partitionIndex)
+    {
+        _partitionIndex = partitionIndex;
+    }
 
-        /// <summary>
-        /// Initializes a new instance of the single partition router that will publish all messages to the given partition
-        /// </summary>
-        public SinglePartitionRouter(int partitionIndex)
-        {
-            _partitionIndex = partitionIndex;
-        }
+    /// <summary>
+    /// Choose a partition in single partition routing mode
+    /// </summary>
+    public int ChoosePartition(MessageMetadata messageMetadata, int numberOfPartitions)
+    {
+        var keyBytes = messageMetadata.KeyBytes;
+        if (keyBytes is not null && keyBytes.Length > 0)
+            return (int) MurmurHash3.Hash32(keyBytes, 0) % numberOfPartitions;
 
-        /// <summary>
-        /// Choose a partition in single partition routing mode
-        /// </summary>
-        public int ChoosePartition(MessageMetadata messageMetadata, int numberOfPartitions)
-        {
-            var keyBytes = messageMetadata.KeyBytes;
-            if (keyBytes is not null && keyBytes.Length > 0)
-                return (int) MurmurHash3.Hash32(keyBytes, 0) % numberOfPartitions;
+        if (_partitionIndex == -1)
+            _partitionIndex = new Random().Next(0, numberOfPartitions);
 
-            if (_partitionIndex == -1)
-                _partitionIndex = new Random().Next(0, numberOfPartitions);
-
-            return _partitionIndex;
-        }
+        return _partitionIndex;
     }
 }
diff --git a/src/DotPulsar/SubscriptionInitialPosition.cs b/src/DotPulsar/SubscriptionInitialPosition.cs
index a5dc9e8..8360cc2 100644
--- a/src/DotPulsar/SubscriptionInitialPosition.cs
+++ b/src/DotPulsar/SubscriptionInitialPosition.cs
@@ -12,21 +12,20 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// Intial position at which the cursor will be set when subscribing.
+/// </summary>
+public enum SubscriptionInitialPosition : byte
 {
     /// <summary>
-    /// Intial position at which the cursor will be set when subscribing.
+    /// Consumption will start at the last message.
     /// </summary>
-    public enum SubscriptionInitialPosition : byte
-    {
-        /// <summary>
-        /// Consumption will start at the last message.
-        /// </summary>
-        Latest = 0,
+    Latest = 0,
 
-        /// <summary>
-        /// Consumption will start at the first message.
-        /// </summary>
-        Earliest = 1
-    }
+    /// <summary>
+    /// Consumption will start at the first message.
+    /// </summary>
+    Earliest = 1
 }
diff --git a/src/DotPulsar/SubscriptionType.cs b/src/DotPulsar/SubscriptionType.cs
index 34c2061..e0e941b 100644
--- a/src/DotPulsar/SubscriptionType.cs
+++ b/src/DotPulsar/SubscriptionType.cs
@@ -12,31 +12,30 @@
  * limitations under the License.
  */
 
-namespace DotPulsar
+namespace DotPulsar;
+
+/// <summary>
+/// Subscription types the consumer can choose from when subscribing.
+/// </summary>
+public enum SubscriptionType : byte
 {
     /// <summary>
-    /// Subscription types the consumer can choose from when subscribing.
+    /// There can be only 1 consumer on the same topic with the same subscription name.
     /// </summary>
-    public enum SubscriptionType : byte
-    {
-        /// <summary>
-        /// There can be only 1 consumer on the same topic with the same subscription name.
-        /// </summary>
-        Exclusive = 0,
+    Exclusive = 0,
 
-        /// <summary>
-        /// Multiple consumers will be able to use the same subscription name and the messages will be dispatched according to a round-robin rotation.
-        /// </summary>
-        Shared = 1,
+    /// <summary>
+    /// Multiple consumers will be able to use the same subscription name and the messages will be dispatched according to a round-robin rotation.
+    /// </summary>
+    Shared = 1,
 
-        /// <summary>
-        /// Multiple consumers will be able to use the same subscription name but only 1 consumer will receive the messages.
-        /// </summary>
-        Failover = 2,
+    /// <summary>
+    /// Multiple consumers will be able to use the same subscription name but only 1 consumer will receive the messages.
+    /// </summary>
+    Failover = 2,
 
-        /// <summary>
-        /// Multiple consumers will be able to use the same subscription name and the messages will be dispatched according to the key.
-        /// </summary>
-        KeyShared = 3
-    }
+    /// <summary>
+    /// Multiple consumers will be able to use the same subscription name and the messages will be dispatched according to the key.
+    /// </summary>
+    KeyShared = 3
 }
diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props
index 7254a3d..be011ab 100644
--- a/tests/Directory.Build.props
+++ b/tests/Directory.Build.props
@@ -1,7 +1,7 @@
 <Project>
 
   <PropertyGroup>
-    <LangVersion>9.0</LangVersion>
+    <LangVersion>10.0</LangVersion>
     <Nullable>enable</Nullable>
   </PropertyGroup>
 
diff --git a/tests/DotPulsar.IntegrationTests/Abstraction/IPulsarService.cs b/tests/DotPulsar.IntegrationTests/Abstraction/IPulsarService.cs
index 84dfec9..4c9332f 100644
--- a/tests/DotPulsar.IntegrationTests/Abstraction/IPulsarService.cs
+++ b/tests/DotPulsar.IntegrationTests/Abstraction/IPulsarService.cs
@@ -12,33 +12,32 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.IntegrationTests.Abstraction
+namespace DotPulsar.IntegrationTests.Abstraction;
+
+using System;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Xunit;
+
+/// <summary>
+/// Pulsar Service interface
+/// </summary>
+public interface IPulsarService : IAsyncLifetime
 {
-    using System;
-    using System.Net.Http;
-    using System.Threading.Tasks;
-    using Xunit;
+    /// <summary>
+    /// Get broker binary protocol uri
+    /// </summary>
+    Uri GetBrokerUri();
 
     /// <summary>
-    /// Pulsar Service interface
+    /// Get broker rest uri
     /// </summary>
-    public interface IPulsarService : IAsyncLifetime
-    {
-        /// <summary>
-        /// Get broker binary protocol uri
-        /// </summary>
-        Uri GetBrokerUri();
+    Uri GetWebServiceUri();
 
-        /// <summary>
-        /// Get broker rest uri
-        /// </summary>
-        Uri GetWebServiceUri();
-
-        /// <summary>
-        /// Create a partitioned topic
-        /// The format of the restTopic must be `{schema}/{tenant}/{namespace}/{topicName}`
-        /// For example, `persistent/public/default/test-topic`
-        /// </summary>
-        Task<HttpResponseMessage?> CreatePartitionedTopic(string restTopic, int numPartitions);
-    }
+    /// <summary>
+    /// Create a partitioned topic
+    /// The format of the restTopic must be `{schema}/{tenant}/{namespace}/{topicName}`
+    /// For example, `persistent/public/default/test-topic`
+    /// </summary>
+    Task<HttpResponseMessage?> CreatePartitionedTopic(string restTopic, int numPartitions);
 }
diff --git a/tests/DotPulsar.IntegrationTests/DotPulsar.IntegrationTests.csproj b/tests/DotPulsar.IntegrationTests/DotPulsar.IntegrationTests.csproj
index b3f1211..b419d2f 100644
--- a/tests/DotPulsar.IntegrationTests/DotPulsar.IntegrationTests.csproj
+++ b/tests/DotPulsar.IntegrationTests/DotPulsar.IntegrationTests.csproj
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFramework>net5.0</TargetFramework>
+        <TargetFramework>net6.0</TargetFramework>
 
         <IsPackable>false</IsPackable>
     </PropertyGroup>
diff --git a/tests/DotPulsar.IntegrationTests/Fixtures/StandaloneClusterFixture.cs b/tests/DotPulsar.IntegrationTests/Fixtures/StandaloneClusterFixture.cs
index eb2d072..c3e8d9d 100644
--- a/tests/DotPulsar.IntegrationTests/Fixtures/StandaloneClusterFixture.cs
+++ b/tests/DotPulsar.IntegrationTests/Fixtures/StandaloneClusterFixture.cs
@@ -12,27 +12,26 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.IntegrationTests.Fixtures
+namespace DotPulsar.IntegrationTests.Fixtures;
+
+using Abstraction;
+using Services;
+using System.Threading.Tasks;
+using Xunit;
+
+public class StandaloneClusterFixture : IAsyncLifetime
 {
-    using Abstraction;
-    using Services;
-    using System.Threading.Tasks;
-    using Xunit;
+    public IPulsarService? PulsarService { private set; get; }
 
-    public class StandaloneClusterFixture : IAsyncLifetime
+    public async Task InitializeAsync()
     {
-        public IPulsarService? PulsarService { private set; get; }
+        PulsarService = ServiceFactory.CreatePulsarService();
+        await PulsarService.InitializeAsync();
+    }
 
-        public async Task InitializeAsync()
-        {
-            PulsarService = ServiceFactory.CreatePulsarService();
-            await PulsarService.InitializeAsync();
-        }
-
-        public async Task DisposeAsync()
-        {
-            if (PulsarService != null)
-                await PulsarService.DisposeAsync();
-        }
+    public async Task DisposeAsync()
+    {
+        if (PulsarService != null)
+            await PulsarService.DisposeAsync();
     }
 }
diff --git a/tests/DotPulsar.IntegrationTests/Fixtures/StandaloneClusterTests.cs b/tests/DotPulsar.IntegrationTests/Fixtures/StandaloneClusterTests.cs
index 51ba95d..1a3504b 100644
--- a/tests/DotPulsar.IntegrationTests/Fixtures/StandaloneClusterTests.cs
+++ b/tests/DotPulsar.IntegrationTests/Fixtures/StandaloneClusterTests.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.IntegrationTests.Fixtures
-{
-    using Xunit;
+namespace DotPulsar.IntegrationTests.Fixtures;
 
-    [CollectionDefinition(nameof(StandaloneClusterTest))]
-    public class StandaloneClusterTest : ICollectionFixture<StandaloneClusterFixture> { }
-}
+using Xunit;
+
+[CollectionDefinition(nameof(StandaloneClusterTest))]
+public class StandaloneClusterTest : ICollectionFixture<StandaloneClusterFixture> { }
diff --git a/tests/DotPulsar.IntegrationTests/ProducerTests.cs b/tests/DotPulsar.IntegrationTests/ProducerTests.cs
index 6384ed9..6c1ac25 100644
--- a/tests/DotPulsar.IntegrationTests/ProducerTests.cs
+++ b/tests/DotPulsar.IntegrationTests/ProducerTests.cs
@@ -12,144 +12,143 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.IntegrationTests
+namespace DotPulsar.IntegrationTests;
+
+using Abstraction;
+using Abstractions;
+using Extensions;
+using Fixtures;
+using FluentAssertions;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Threading.Tasks;
+using Xunit;
+using Xunit.Abstractions;
+
+[Collection(nameof(StandaloneClusterTest))]
+public class ProducerTests
 {
-    using Abstraction;
-    using Abstractions;
-    using Extensions;
-    using Fixtures;
-    using FluentAssertions;
-    using System;
-    using System.Collections.Generic;
-    using System.Diagnostics;
-    using System.Threading.Tasks;
-    using Xunit;
-    using Xunit.Abstractions;
+    private readonly ITestOutputHelper _testOutputHelper;
+    private readonly IPulsarService _pulsarService;
 
-    [Collection(nameof(StandaloneClusterTest))]
-    public class ProducerTests
+    public ProducerTests(ITestOutputHelper outputHelper, StandaloneClusterFixture fixture)
     {
-        private readonly ITestOutputHelper _testOutputHelper;
-        private readonly IPulsarService _pulsarService;
+        _testOutputHelper = outputHelper;
+        Debug.Assert(fixture.PulsarService != null, "fixture.PulsarService != null");
+        _pulsarService = fixture.PulsarService;
+    }
 
-        public ProducerTests(ITestOutputHelper outputHelper, StandaloneClusterFixture fixture)
+    [Fact]
+    public async Task SimpleProduceConsume_WhenSendingMessagesToProducer_ThenReceiveMessagesFromConsumer()
+    {
+        //Arrange
+        await using var client = PulsarClient.Builder().ServiceUrl(_pulsarService.GetBrokerUri()).Build();
+        string topicName = $"simple-produce-consume{Guid.NewGuid():N}";
+        const string content = "test-message";
+
+        //Act
+        await using var producer = client.NewProducer(Schema.String)
+            .Topic(topicName)
+            .Create();
+
+        await using var consumer = client.NewConsumer(Schema.String)
+            .Topic(topicName)
+            .SubscriptionName("test-sub")
+            .InitialPosition(SubscriptionInitialPosition.Earliest)
+            .Create();
+
+        await producer.Send(content);
+        _testOutputHelper.WriteLine($"Sent a message: {content}");
+
+        //Assert
+        (await consumer.Receive()).Value().Should().Be(content);
+    }
+
+    [Fact]
+    public async Task SinglePartition_WhenSendMessages_ThenGetMessagesFromSinglePartition()
+    {
+        //Arrange
+        var serviceUrl = _pulsarService.GetBrokerUri();
+        const string content = "test-message";
+        const int partitions = 3;
+        const int msgCount = 3;
+        var topicName = $"single-partitioned-{Guid.NewGuid():N}";
+        await _pulsarService.CreatePartitionedTopic($"persistent/public/default/{topicName}", partitions);
+        await using var client = PulsarClient.Builder().ServiceUrl(serviceUrl).Build();
+
+        //Act
+        var consumers = new List<IConsumer<string>>();
+        for (var i = 0; i < partitions; ++i)
         {
-            _testOutputHelper = outputHelper;
-            Debug.Assert(fixture.PulsarService != null, "fixture.PulsarService != null");
-            _pulsarService = fixture.PulsarService;
-        }
-
-        [Fact]
-        public async Task SimpleProduceConsume_WhenSendingMessagesToProducer_ThenReceiveMessagesFromConsumer()
-        {
-            //Arrange
-            await using var client = PulsarClient.Builder().ServiceUrl(_pulsarService.GetBrokerUri()).Build();
-            string topicName = $"simple-produce-consume{Guid.NewGuid():N}";
-            const string content = "test-message";
-
-            //Act
-            await using var producer = client.NewProducer(Schema.String)
-                .Topic(topicName)
-                .Create();
-
-            await using var consumer = client.NewConsumer(Schema.String)
-                .Topic(topicName)
+            consumers.Add(client.NewConsumer(Schema.String)
+                .Topic($"{topicName}-partition-{i}")
                 .SubscriptionName("test-sub")
                 .InitialPosition(SubscriptionInitialPosition.Earliest)
-                .Create();
-
-            await producer.Send(content);
-            _testOutputHelper.WriteLine($"Sent a message: {content}");
-
-            //Assert
-            (await consumer.Receive()).Value().Should().Be(content);
+                .Create());
         }
 
-        [Fact]
-        public async Task SinglePartition_WhenSendMessages_ThenGetMessagesFromSinglePartition()
+        for (var i = 0; i < partitions; ++i)
         {
-            //Arrange
-            var serviceUrl = _pulsarService.GetBrokerUri();
-            const string content = "test-message";
-            const int partitions = 3;
-            const int msgCount = 3;
-            var topicName = $"single-partitioned-{Guid.NewGuid():N}";
-            await _pulsarService.CreatePartitionedTopic($"persistent/public/default/{topicName}", partitions);
-            await using var client = PulsarClient.Builder().ServiceUrl(serviceUrl).Build();
-
-            //Act
-            var consumers = new List<IConsumer<string>>();
-            for (var i = 0; i < partitions; ++i)
-            {
-                consumers.Add(client.NewConsumer(Schema.String)
-                    .Topic($"{topicName}-partition-{i}")
-                    .SubscriptionName("test-sub")
-                    .InitialPosition(SubscriptionInitialPosition.Earliest)
-                    .Create());
-            }
-
-            for (var i = 0; i < partitions; ++i)
-            {
-                await using var producer = client.NewProducer(Schema.String)
-                    .Topic(topicName)
-                    .MessageRouter(new SinglePartitionRouter(i))
-                    .Create();
-
-                for (var msgIndex = 0; msgIndex < msgCount; ++msgIndex)
-                {
-                    var message = $"{content}-{i}-{msgIndex}";
-                    _ = await producer.Send(message);
-                    _testOutputHelper.WriteLine($"Sent a message: {message}");
-                }
-            }
-
-            //Assert
-            for (var i = 0; i < partitions; ++i)
-            {
-                var consumer = consumers[i];
-
-                for (var msgIndex = 0; msgIndex < msgCount; ++msgIndex)
-                {
-                    var message = await consumer.Receive();
-                    message.Value().Should().Be($"{content}-{i}-{msgIndex}");
-                }
-            }
-        }
-
-        [Fact]
-        public async Task RoundRobinPartition_WhenSendMessages_ThenGetMessagesFromPartitionsInOrder()
-        {
-            //Arrange
-            await using var client = PulsarClient.Builder().ServiceUrl(_pulsarService.GetBrokerUri()).Build();
-            string topicName = $"round-robin-partitioned-{Guid.NewGuid():N}";
-            const string content = "test-message";
-            const int partitions = 3;
-            var consumers = new List<IConsumer<string>>();
-
-            await _pulsarService.CreatePartitionedTopic($"persistent/public/default/{topicName}", partitions);
-
-            //Act
             await using var producer = client.NewProducer(Schema.String)
                 .Topic(topicName)
+                .MessageRouter(new SinglePartitionRouter(i))
                 .Create();
-            await producer.StateChangedTo(ProducerState.Connected);
 
-            for (var i = 0; i < partitions; ++i)
+            for (var msgIndex = 0; msgIndex < msgCount; ++msgIndex)
             {
-                consumers.Add(client.NewConsumer(Schema.String)
-                    .Topic($"{topicName}-partition-{i}")
-                    .SubscriptionName("test-sub")
-                    .InitialPosition(SubscriptionInitialPosition.Earliest)
-                    .Create());
-                await producer.Send($"{content}-{i}");
-                _testOutputHelper.WriteLine($"Sent a message to consumer [{i}]");
+                var message = $"{content}-{i}-{msgIndex}";
+                _ = await producer.Send(message);
+                _testOutputHelper.WriteLine($"Sent a message: {message}");
             }
+        }
 
-            //Assert
-            for (var i = 0; i < partitions; ++i)
+        //Assert
+        for (var i = 0; i < partitions; ++i)
+        {
+            var consumer = consumers[i];
+
+            for (var msgIndex = 0; msgIndex < msgCount; ++msgIndex)
             {
-                (await consumers[i].Receive()).Value().Should().Be($"{content}-{i}");
+                var message = await consumer.Receive();
+                message.Value().Should().Be($"{content}-{i}-{msgIndex}");
             }
         }
     }
+
+    [Fact]
+    public async Task RoundRobinPartition_WhenSendMessages_ThenGetMessagesFromPartitionsInOrder()
+    {
+        //Arrange
+        await using var client = PulsarClient.Builder().ServiceUrl(_pulsarService.GetBrokerUri()).Build();
+        string topicName = $"round-robin-partitioned-{Guid.NewGuid():N}";
+        const string content = "test-message";
+        const int partitions = 3;
+        var consumers = new List<IConsumer<string>>();
+
+        await _pulsarService.CreatePartitionedTopic($"persistent/public/default/{topicName}", partitions);
+
+        //Act
+        await using var producer = client.NewProducer(Schema.String)
+            .Topic(topicName)
+            .Create();
+        await producer.StateChangedTo(ProducerState.Connected);
+
+        for (var i = 0; i < partitions; ++i)
+        {
+            consumers.Add(client.NewConsumer(Schema.String)
+                .Topic($"{topicName}-partition-{i}")
+                .SubscriptionName("test-sub")
+                .InitialPosition(SubscriptionInitialPosition.Earliest)
+                .Create());
+            await producer.Send($"{content}-{i}");
+            _testOutputHelper.WriteLine($"Sent a message to consumer [{i}]");
+        }
+
+        //Assert
+        for (var i = 0; i < partitions; ++i)
+        {
+            (await consumers[i].Receive()).Value().Should().Be($"{content}-{i}");
+        }
+    }
 }
diff --git a/tests/DotPulsar.IntegrationTests/Services/PulsarServiceBase.cs b/tests/DotPulsar.IntegrationTests/Services/PulsarServiceBase.cs
index bc52005..7f642d8 100644
--- a/tests/DotPulsar.IntegrationTests/Services/PulsarServiceBase.cs
+++ b/tests/DotPulsar.IntegrationTests/Services/PulsarServiceBase.cs
@@ -12,46 +12,45 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.IntegrationTests.Services
+namespace DotPulsar.IntegrationTests.Services;
+
+using Abstraction;
+using System;
+using System.Net.Http;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+public class PulsarServiceBase : IPulsarService
 {
-    using Abstraction;
-    using System;
-    using System.Net.Http;
-    using System.Text;
-    using System.Threading;
-    using System.Threading.Tasks;
+    private readonly CancellationTokenSource _cts;
+    private readonly HttpClient _adminClient;
 
-    public class PulsarServiceBase : IPulsarService
+    protected PulsarServiceBase()
     {
-        private readonly CancellationTokenSource _cts;
-        private readonly HttpClient _adminClient;
+        _cts = new CancellationTokenSource();
+        _adminClient = new HttpClient();
+    }
 
-        protected PulsarServiceBase()
-        {
-            _cts = new CancellationTokenSource();
-            _adminClient = new HttpClient();
-        }
+    public virtual Task InitializeAsync()
+        => Task.CompletedTask;
 
-        public virtual Task InitializeAsync()
-            => Task.CompletedTask;
+    public virtual Task DisposeAsync()
+    {
+        _adminClient.Dispose();
+        _cts.Dispose();
+        return Task.CompletedTask;
+    }
 
-        public virtual Task DisposeAsync()
-        {
-            _adminClient.Dispose();
-            _cts.Dispose();
-            return Task.CompletedTask;
-        }
+    public virtual Uri GetBrokerUri()
+        => throw new NotImplementedException();
 
-        public virtual Uri GetBrokerUri()
-            => throw new NotImplementedException();
+    public virtual Uri GetWebServiceUri()
+        => throw new NotImplementedException();
 
-        public virtual Uri GetWebServiceUri()
-            => throw new NotImplementedException();
-
-        public async Task<HttpResponseMessage?> CreatePartitionedTopic(string restTopic, int numPartitions)
-        {
-            var content = new StringContent(numPartitions.ToString(), Encoding.UTF8, "application/json");
-            return await _adminClient.PutAsync($"{GetWebServiceUri()}admin/v2/{restTopic}/partitions", content, _cts.Token).ConfigureAwait(false);
-        }
+    public async Task<HttpResponseMessage?> CreatePartitionedTopic(string restTopic, int numPartitions)
+    {
+        var content = new StringContent(numPartitions.ToString(), Encoding.UTF8, "application/json");
+        return await _adminClient.PutAsync($"{GetWebServiceUri()}admin/v2/{restTopic}/partitions", content, _cts.Token).ConfigureAwait(false);
     }
 }
diff --git a/tests/DotPulsar.IntegrationTests/Services/ServiceFactory.cs b/tests/DotPulsar.IntegrationTests/Services/ServiceFactory.cs
index dd0187c..3b9e0a1 100644
--- a/tests/DotPulsar.IntegrationTests/Services/ServiceFactory.cs
+++ b/tests/DotPulsar.IntegrationTests/Services/ServiceFactory.cs
@@ -12,25 +12,24 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.IntegrationTests.Services
+namespace DotPulsar.IntegrationTests.Services;
+
+using Abstraction;
+
+public static class ServiceFactory
 {
-    using Abstraction;
+    private const string _pulsarDeploymentType = "PULSAR_DEPLOYMENT_TYPE";
+    private const string _containerDeployment = "container";
 
-    public static class ServiceFactory
+    public static IPulsarService CreatePulsarService()
     {
-        private const string _pulsarDeploymentType = "PULSAR_DEPLOYMENT_TYPE";
-        private const string _containerDeployment = "container";
+        var deploymentType = System.Environment.GetEnvironmentVariable(_pulsarDeploymentType);
 
-        public static IPulsarService CreatePulsarService()
+        if (deploymentType == _containerDeployment)
         {
-            var deploymentType = System.Environment.GetEnvironmentVariable(_pulsarDeploymentType);
-
-            if (deploymentType == _containerDeployment)
-            {
-                return new StandaloneContainerService();
-            }
-
-            return new StandaloneExternalService();
+            return new StandaloneContainerService();
         }
+
+        return new StandaloneExternalService();
     }
 }
diff --git a/tests/DotPulsar.IntegrationTests/Services/StandaloneContainerService.cs b/tests/DotPulsar.IntegrationTests/Services/StandaloneContainerService.cs
index e711d0c..e54b0fb 100644
--- a/tests/DotPulsar.IntegrationTests/Services/StandaloneContainerService.cs
+++ b/tests/DotPulsar.IntegrationTests/Services/StandaloneContainerService.cs
@@ -12,77 +12,76 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.IntegrationTests.Services
+namespace DotPulsar.IntegrationTests.Services;
+
+using System;
+using System.Diagnostics;
+using System.Net.Http;
+using System.Threading.Tasks;
+
+public sealed class StandaloneContainerService : PulsarServiceBase
 {
-    using System;
-    using System.Diagnostics;
-    using System.Net.Http;
-    using System.Threading.Tasks;
-
-    public sealed class StandaloneContainerService : PulsarServiceBase
+    public override async Task InitializeAsync()
     {
-        public override async Task InitializeAsync()
+        await base.InitializeAsync().ConfigureAwait(false);
+        TakeDownPulsar(); // clean-up if anything was left running from previous run
+
+        RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml up -d");
+
+        var waitTries = 10;
+
+        using var handler = new HttpClientHandler { AllowAutoRedirect = true };
+
+        using var client = new HttpClient(handler);
+
+        while (waitTries > 0)
         {
-            await base.InitializeAsync().ConfigureAwait(false);
-            TakeDownPulsar(); // clean-up if anything was left running from previous run
-
-            RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml up -d");
-
-            var waitTries = 10;
-
-            using var handler = new HttpClientHandler { AllowAutoRedirect = true };
-
-            using var client = new HttpClient(handler);
-
-            while (waitTries > 0)
+            try
             {
-                try
-                {
-                    await client.GetAsync("http://localhost:54546/metrics/").ConfigureAwait(false);
-                    return;
-                }
-                catch
-                {
-                    waitTries--;
-                    await Task.Delay(5000).ConfigureAwait(false);
-                }
+                await client.GetAsync("http://localhost:54546/metrics/").ConfigureAwait(false);
+                return;
             }
-
-            throw new Exception("Unable to confirm Pulsar has initialized");
+            catch
+            {
+                waitTries--;
+                await Task.Delay(5000).ConfigureAwait(false);
+            }
         }
 
-        public override async Task DisposeAsync()
-        {
-            await base.DisposeAsync().ConfigureAwait(false);
-            TakeDownPulsar();
-        }
-
-        private static void TakeDownPulsar()
-            => RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml down");
-
-        private static void RunProcess(string name, string arguments)
-        {
-            var processStartInfo = new ProcessStartInfo { FileName = name, Arguments = arguments };
-
-            processStartInfo.Environment["TAG"] = "test";
-            processStartInfo.Environment["CONFIGURATION"] = "Debug";
-            processStartInfo.Environment["COMPUTERNAME"] = Environment.MachineName;
-
-            var process = Process.Start(processStartInfo);
-
-            if (process is null)
-                throw new Exception("Process.Start returned null");
-
-            process.WaitForExit();
-
-            if (process.ExitCode != 0)
-                throw new Exception($"Exit code {process.ExitCode} when running process {name} with arguments {arguments}");
-        }
-
-        public override Uri GetBrokerUri()
-            => new("pulsar://localhost:54545");
-
-        public override Uri GetWebServiceUri()
-            => new("http://localhost:54546");
+        throw new Exception("Unable to confirm Pulsar has initialized");
     }
+
+    public override async Task DisposeAsync()
+    {
+        await base.DisposeAsync().ConfigureAwait(false);
+        TakeDownPulsar();
+    }
+
+    private static void TakeDownPulsar()
+        => RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml down");
+
+    private static void RunProcess(string name, string arguments)
+    {
+        var processStartInfo = new ProcessStartInfo { FileName = name, Arguments = arguments };
+
+        processStartInfo.Environment["TAG"] = "test";
+        processStartInfo.Environment["CONFIGURATION"] = "Debug";
+        processStartInfo.Environment["COMPUTERNAME"] = Environment.MachineName;
+
+        var process = Process.Start(processStartInfo);
+
+        if (process is null)
+            throw new Exception("Process.Start returned null");
+
+        process.WaitForExit();
+
+        if (process.ExitCode != 0)
+            throw new Exception($"Exit code {process.ExitCode} when running process {name} with arguments {arguments}");
+    }
+
+    public override Uri GetBrokerUri()
+        => new("pulsar://localhost:54545");
+
+    public override Uri GetWebServiceUri()
+        => new("http://localhost:54546");
 }
diff --git a/tests/DotPulsar.IntegrationTests/Services/StandaloneExternalService.cs b/tests/DotPulsar.IntegrationTests/Services/StandaloneExternalService.cs
index 87daec4..ed7222b 100644
--- a/tests/DotPulsar.IntegrationTests/Services/StandaloneExternalService.cs
+++ b/tests/DotPulsar.IntegrationTests/Services/StandaloneExternalService.cs
@@ -12,16 +12,15 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.IntegrationTests.Services
+namespace DotPulsar.IntegrationTests.Services;
+
+using System;
+
+public sealed class StandaloneExternalService : PulsarServiceBase
 {
-    using System;
+    public override Uri GetBrokerUri()
+        => new("pulsar://localhost:6650");
 
-    public sealed class StandaloneExternalService : PulsarServiceBase
-    {
-        public override Uri GetBrokerUri()
-            => new("pulsar://localhost:6650");
-
-        public override Uri GetWebServiceUri()
-            => new("http://localhost:8080");
-    }
+    public override Uri GetWebServiceUri()
+        => new("http://localhost:8080");
 }
diff --git a/tests/DotPulsar.StressTests/ConnectionTests.cs b/tests/DotPulsar.StressTests/ConnectionTests.cs
index 19bdbb3..f09b61c 100644
--- a/tests/DotPulsar.StressTests/ConnectionTests.cs
+++ b/tests/DotPulsar.StressTests/ConnectionTests.cs
@@ -12,51 +12,50 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.StressTests
+namespace DotPulsar.StressTests;
+
+using Extensions;
+using Fixtures;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+using Xunit.Abstractions;
+
+[Collection(nameof(StandaloneClusterTest))]
+public class ConnectionTests
 {
-    using Extensions;
-    using Fixtures;
-    using System;
-    using System.Threading;
-    using System.Threading.Tasks;
-    using Xunit;
-    using Xunit.Abstractions;
+    private readonly ITestOutputHelper _output;
 
-    [Collection(nameof(StandaloneClusterTest))]
-    public class ConnectionTests
+    public ConnectionTests(ITestOutputHelper output)
+        => _output = output;
+
+    [Theory]
+    [InlineData("pulsar://localhost:54545")] // test that we can connect directly to a broker
+    [InlineData("pulsar://localhost:6666")] // test that we can connect through a reverse proxy (NOT a pulsar proxy)
+    public async Task ConnectionHandshake_GivenValidServiceUrls_ShouldEstablishConnection(string serviceUrl)
     {
-        private readonly ITestOutputHelper _output;
+        //Arrange
+        var testRunId = Guid.NewGuid().ToString("N");
 
-        public ConnectionTests(ITestOutputHelper output)
-            => _output = output;
+        var topic = $"persistent://public/default/consumer-tests-{testRunId}";
 
-        [Theory]
-        [InlineData("pulsar://localhost:54545")] // test that we can connect directly to a broker
-        [InlineData("pulsar://localhost:6666")] // test that we can connect through a reverse proxy (NOT a pulsar proxy)
-        public async Task ConnectionHandshake_GivenValidServiceUrls_ShouldEstablishConnection(string serviceUrl)
-        {
-            //Arrange
-            var testRunId = Guid.NewGuid().ToString("N");
+        var builder = PulsarClient.Builder()
+            .ExceptionHandler(new XunitExceptionHandler(_output));
 
-            var topic = $"persistent://public/default/consumer-tests-{testRunId}";
+        if (!string.IsNullOrEmpty(serviceUrl))
+            builder.ServiceUrl(new Uri(serviceUrl));
 
-            var builder = PulsarClient.Builder()
-                .ExceptionHandler(new XunitExceptionHandler(_output));
+        await using var client = builder.Build();
 
-            if (!string.IsNullOrEmpty(serviceUrl))
-                builder.ServiceUrl(new Uri(serviceUrl));
+        await using var producer = client.NewProducer(Schema.ByteArray)
+            .ProducerName($"producer-{testRunId}")
+            .Topic(topic)
+            .Create();
 
-            await using var client = builder.Build();
+        var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
 
-            await using var producer = client.NewProducer(Schema.ByteArray)
-                .ProducerName($"producer-{testRunId}")
-                .Topic(topic)
-                .Create();
-
-            var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
-
-            //Act & Assert
-            await producer.StateChangedTo(ProducerState.Connected, cts.Token);
-        }
+        //Act & Assert
+        await producer.StateChangedTo(ProducerState.Connected, cts.Token);
     }
 }
diff --git a/tests/DotPulsar.StressTests/ConsumerTests.cs b/tests/DotPulsar.StressTests/ConsumerTests.cs
index 684205a..b731fcf 100644
--- a/tests/DotPulsar.StressTests/ConsumerTests.cs
+++ b/tests/DotPulsar.StressTests/ConsumerTests.cs
@@ -12,94 +12,93 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.StressTests
+namespace DotPulsar.StressTests;
+
+using DotPulsar.Abstractions;
+using DotPulsar.Extensions;
+using Fixtures;
+using FluentAssertions;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+using Xunit.Abstractions;
+
+[Collection(nameof(StandaloneClusterTest))]
+public class ConsumerTests
 {
-    using DotPulsar.Abstractions;
-    using DotPulsar.Extensions;
-    using Fixtures;
-    using FluentAssertions;
-    using System;
-    using System.Collections.Generic;
-    using System.Text;
-    using System.Threading;
-    using System.Threading.Tasks;
-    using Xunit;
-    using Xunit.Abstractions;
+    private readonly ITestOutputHelper _output;
 
-    [Collection(nameof(StandaloneClusterTest))]
-    public class ConsumerTests
+    public ConsumerTests(ITestOutputHelper output)
+        => _output = output;
+
+    [Theory]
+    [InlineData(10000)]
+    public async Task Messages_GivenTopicWithMessages_ShouldConsumeAll(int numberOfMessages)
     {
-        private readonly ITestOutputHelper _output;
+        //Arrange
+        var testRunId = Guid.NewGuid().ToString("N");
 
-        public ConsumerTests(ITestOutputHelper output)
-            => _output = output;
+        var topic = $"persistent://public/default/consumer-tests-{testRunId}";
 
-        [Theory]
-        [InlineData(10000)]
-        public async Task Messages_GivenTopicWithMessages_ShouldConsumeAll(int numberOfMessages)
+        await using var client = PulsarClient.Builder()
+            .ExceptionHandler(new XunitExceptionHandler(_output))
+            .ServiceUrl(new Uri("pulsar://localhost:54545"))
+            .Build();
+
+        await using var consumer = client.NewConsumer(Schema.ByteArray)
+            .ConsumerName($"consumer-{testRunId}")
+            .InitialPosition(SubscriptionInitialPosition.Earliest)
+            .SubscriptionName($"subscription-{testRunId}")
+            .Topic(topic)
+            .Create();
+
+        await using var producer = client.NewProducer(Schema.ByteArray)
+            .ProducerName($"producer-{testRunId}")
+            .Topic(topic)
+            .Create();
+
+        var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
+
+        //Act
+        var produced = await ProduceMessages(producer, numberOfMessages, cts.Token);
+        var consumed = await ConsumeMessages(consumer, numberOfMessages, cts.Token);
+
+        //Assert
+        consumed.Should().BeEquivalentTo(produced);
+    }
+
+    private static async Task<IEnumerable<MessageId>> ProduceMessages(IProducer<byte[]> producer, int numberOfMessages, CancellationToken ct)
+    {
+        var messageIds = new MessageId[numberOfMessages];
+
+        for (var i = 0; i < numberOfMessages; ++i)
         {
-            //Arrange
-            var testRunId = Guid.NewGuid().ToString("N");
-
-            var topic = $"persistent://public/default/consumer-tests-{testRunId}";
-
-            await using var client = PulsarClient.Builder()
-                .ExceptionHandler(new XunitExceptionHandler(_output))
-                .ServiceUrl(new Uri("pulsar://localhost:54545"))
-                .Build();
-
-            await using var consumer = client.NewConsumer(Schema.ByteArray)
-                .ConsumerName($"consumer-{testRunId}")
-                .InitialPosition(SubscriptionInitialPosition.Earliest)
-                .SubscriptionName($"subscription-{testRunId}")
-                .Topic(topic)
-                .Create();
-
-            await using var producer = client.NewProducer(Schema.ByteArray)
-                .ProducerName($"producer-{testRunId}")
-                .Topic(topic)
-                .Create();
-
-            var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
-
-            //Act
-            var produced = await ProduceMessages(producer, numberOfMessages, cts.Token);
-            var consumed = await ConsumeMessages(consumer, numberOfMessages, cts.Token);
-
-            //Assert
-            consumed.Should().BeEquivalentTo(produced);
+            var data = Encoding.UTF8.GetBytes($"Sent #{i} at {DateTimeOffset.UtcNow:s}");
+            messageIds[i] = await producer.Send(data, ct);
         }
 
-        private static async Task<IEnumerable<MessageId>> ProduceMessages(IProducer<byte[]> producer, int numberOfMessages, CancellationToken ct)
+        return messageIds;
+    }
+
+    private static async Task<IEnumerable<MessageId>> ConsumeMessages(IConsumer<byte[]> consumer, int numberOfMessages, CancellationToken ct)
+    {
+        var messageIds = new List<MessageId>(numberOfMessages);
+
+        await foreach (var message in consumer.Messages(ct))
         {
-            var messageIds = new MessageId[numberOfMessages];
+            messageIds.Add(message.MessageId);
 
-            for (var i = 0; i < numberOfMessages; ++i)
-            {
-                var data = Encoding.UTF8.GetBytes($"Sent #{i} at {DateTimeOffset.UtcNow:s}");
-                messageIds[i] = await producer.Send(data, ct);
-            }
+            if (messageIds.Count != numberOfMessages)
+                continue;
 
-            return messageIds;
+            await consumer.AcknowledgeCumulative(message, ct);
+
+            break;
         }
 
-        private static async Task<IEnumerable<MessageId>> ConsumeMessages(IConsumer<byte[]> consumer, int numberOfMessages, CancellationToken ct)
-        {
-            var messageIds = new List<MessageId>(numberOfMessages);
-
-            await foreach (var message in consumer.Messages(ct))
-            {
-                messageIds.Add(message.MessageId);
-
-                if (messageIds.Count != numberOfMessages)
-                    continue;
-
-                await consumer.AcknowledgeCumulative(message, ct);
-
-                break;
-            }
-
-            return messageIds;
-        }
+        return messageIds;
     }
 }
diff --git a/tests/DotPulsar.StressTests/DotPulsar.StressTests.csproj b/tests/DotPulsar.StressTests/DotPulsar.StressTests.csproj
index 4e53183..3e1a58a 100644
--- a/tests/DotPulsar.StressTests/DotPulsar.StressTests.csproj
+++ b/tests/DotPulsar.StressTests/DotPulsar.StressTests.csproj
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <IsPackable>false</IsPackable>
   </PropertyGroup>
 
diff --git a/tests/DotPulsar.StressTests/EnumerableTaskExtensions.cs b/tests/DotPulsar.StressTests/EnumerableTaskExtensions.cs
index cef7485..078057d 100644
--- a/tests/DotPulsar.StressTests/EnumerableTaskExtensions.cs
+++ b/tests/DotPulsar.StressTests/EnumerableTaskExtensions.cs
@@ -14,81 +14,80 @@
 
 #pragma warning disable 8601, 8618
 
-namespace DotPulsar.StressTests
+namespace DotPulsar.StressTests;
+
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+
+public static class EnumerableValueTaskExtensions
 {
-    using System.Collections.Generic;
-    using System.Diagnostics;
-    using System.Linq;
-    using System.Threading.Tasks;
-
-    public static class EnumerableValueTaskExtensions
+    [DebuggerStepThrough]
+    public static async ValueTask<TResult[]> WhenAll<TResult>(this IEnumerable<ValueTask<TResult>> source) where TResult : notnull
     {
-        [DebuggerStepThrough]
-        public static async ValueTask<TResult[]> WhenAll<TResult>(this IEnumerable<ValueTask<TResult>> source) where TResult : notnull
+        // the volatile property IsCompleted must be accessed only once
+        var tasks = source.Select(GetInfo).ToArray();
+
+        // run incomplete tasks
+        foreach (var task in tasks)
         {
-            // the volatile property IsCompleted must be accessed only once
-            var tasks = source.Select(GetInfo).ToArray();
-
-            // run incomplete tasks
-            foreach (var task in tasks)
-            {
-                if (task.Task is not null && !task.Task.IsCompleted)
-                    await task.Task.ConfigureAwait(false);
-            }
-
-            // return ordered mixed tasks \m/
-            return tasks
-                .Select(x => x.Task is not null ? x.Task.Result : x.Result)
-                .ToArray();
+            if (task.Task is not null && !task.Task.IsCompleted)
+                await task.Task.ConfigureAwait(false);
         }
 
-        [DebuggerStepThrough]
-        public static async Task<TResult[]> WhenAllAsTask<TResult>(this IEnumerable<ValueTask<TResult>> source) where TResult : notnull
-            => await source.WhenAll().ConfigureAwait(false);
+        // return ordered mixed tasks \m/
+        return tasks
+            .Select(x => x.Task is not null ? x.Task.Result : x.Result)
+            .ToArray();
+    }
 
-        [DebuggerStepThrough]
-        public static async IAsyncEnumerable<TResult> Enumerate<TResult>(this IEnumerable<ValueTask<TResult>> source) where TResult : notnull
+    [DebuggerStepThrough]
+    public static async Task<TResult[]> WhenAllAsTask<TResult>(this IEnumerable<ValueTask<TResult>> source) where TResult : notnull
+        => await source.WhenAll().ConfigureAwait(false);
+
+    [DebuggerStepThrough]
+    public static async IAsyncEnumerable<TResult> Enumerate<TResult>(this IEnumerable<ValueTask<TResult>> source) where TResult : notnull
+    {
+        foreach (var operation in source.Select(GetInfo))
         {
-            foreach (var operation in source.Select(GetInfo))
-            {
-                yield return operation.Task is not null
-                    ? await operation.Task.ConfigureAwait(false)
-                    : operation.Result;
-            }
-        }
-
-        private static ValueTaskInfo<TResult> GetInfo<TResult>(this ValueTask<TResult> source) where TResult : notnull
-            => source.IsCompleted
-                ? new ValueTaskInfo<TResult>(source.Result)
-                : new ValueTaskInfo<TResult>(source.AsTask());
-
-        private readonly struct ValueTaskInfo<TResult> where TResult : notnull
-        {
-            public ValueTaskInfo(Task<TResult> task)
-            {
-                Result = default;
-                Task = task;
-            }
-
-            public ValueTaskInfo(TResult result)
-            {
-                Result = result;
-                Task = default;
-            }
-
-            public TResult Result { get; }
-            public Task<TResult>? Task { get; }
+            yield return operation.Task is not null
+                ? await operation.Task.ConfigureAwait(false)
+                : operation.Result;
         }
     }
 
-    public static class EnumerableTaskExtensions
-    {
-        [DebuggerStepThrough]
-        public static Task WhenAll(this IEnumerable<Task> source)
-            => Task.WhenAll(source);
+    private static ValueTaskInfo<TResult> GetInfo<TResult>(this ValueTask<TResult> source) where TResult : notnull
+        => source.IsCompleted
+            ? new ValueTaskInfo<TResult>(source.Result)
+            : new ValueTaskInfo<TResult>(source.AsTask());
 
-        [DebuggerStepThrough]
-        public static Task<T[]> WhenAll<T>(this IEnumerable<Task<T>> source)
-            => Task.WhenAll(source);
+    private readonly struct ValueTaskInfo<TResult> where TResult : notnull
+    {
+        public ValueTaskInfo(Task<TResult> task)
+        {
+            Result = default;
+            Task = task;
+        }
+
+        public ValueTaskInfo(TResult result)
+        {
+            Result = result;
+            Task = default;
+        }
+
+        public TResult Result { get; }
+        public Task<TResult>? Task { get; }
     }
 }
+
+public static class EnumerableTaskExtensions
+{
+    [DebuggerStepThrough]
+    public static Task WhenAll(this IEnumerable<Task> source)
+        => Task.WhenAll(source);
+
+    [DebuggerStepThrough]
+    public static Task<T[]> WhenAll<T>(this IEnumerable<Task<T>> source)
+        => Task.WhenAll(source);
+}
diff --git a/tests/DotPulsar.StressTests/Fixtures/StandaloneClusterFixture.cs b/tests/DotPulsar.StressTests/Fixtures/StandaloneClusterFixture.cs
index 28b12f0..ef7321c 100644
--- a/tests/DotPulsar.StressTests/Fixtures/StandaloneClusterFixture.cs
+++ b/tests/DotPulsar.StressTests/Fixtures/StandaloneClusterFixture.cs
@@ -12,77 +12,76 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.StressTests.Fixtures
+namespace DotPulsar.StressTests.Fixtures;
+
+using System;
+using System.Diagnostics;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Xunit;
+
+public class StandaloneClusterFixture : IAsyncLifetime
 {
-    using System;
-    using System.Diagnostics;
-    using System.Net.Http;
-    using System.Threading.Tasks;
-    using Xunit;
-
-    public class StandaloneClusterFixture : IAsyncLifetime
+    public async Task InitializeAsync()
     {
-        public async Task InitializeAsync()
+        TakeDownPulsar(); // clean-up if anything was left running from previous run
+
+        RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml up -d");
+
+        var waitTries = 10;
+
+        using var handler = new HttpClientHandler
         {
-            TakeDownPulsar(); // clean-up if anything was left running from previous run
+            AllowAutoRedirect = true
+        };
 
-            RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml up -d");
+        using var client = new HttpClient(handler);
 
-            var waitTries = 10;
-
-            using var handler = new HttpClientHandler
+        while (waitTries > 0)
+        {
+            try
             {
-                AllowAutoRedirect = true
-            };
-
-            using var client = new HttpClient(handler);
-
-            while (waitTries > 0)
-            {
-                try
-                {
-                    await client.GetAsync("http://localhost:54546/metrics/").ConfigureAwait(false);
-                    return;
-                }
-                catch
-                {
-                    waitTries--;
-                    await Task.Delay(5000).ConfigureAwait(false);
-                }
+                await client.GetAsync("http://localhost:54546/metrics/").ConfigureAwait(false);
+                return;
             }
-
-            throw new Exception("Unable to confirm Pulsar has initialized");
-        }
-
-        public Task DisposeAsync()
-        {
-            TakeDownPulsar();
-            return Task.CompletedTask;
-        }
-
-        private static void TakeDownPulsar()
-            => RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml down");
-
-        private static void RunProcess(string name, string arguments)
-        {
-            var processStartInfo = new ProcessStartInfo
+            catch
             {
-                FileName = name,
-                Arguments = arguments
-            };
-
-            processStartInfo.Environment["TAG"] = "test";
-            processStartInfo.Environment["CONFIGURATION"] = "Debug";
-            processStartInfo.Environment["COMPUTERNAME"] = Environment.MachineName;
-
-            var process = Process.Start(processStartInfo);
-            if (process is null)
-                throw new Exception("Process.Start returned null");
-
-            process.WaitForExit();
-
-            if (process.ExitCode != 0)
-                throw new Exception($"Exit code {process.ExitCode} when running process {name} with arguments {arguments}");
+                waitTries--;
+                await Task.Delay(5000).ConfigureAwait(false);
+            }
         }
+
+        throw new Exception("Unable to confirm Pulsar has initialized");
+    }
+
+    public Task DisposeAsync()
+    {
+        TakeDownPulsar();
+        return Task.CompletedTask;
+    }
+
+    private static void TakeDownPulsar()
+        => RunProcess("docker-compose", "-f docker-compose-standalone-tests.yml down");
+
+    private static void RunProcess(string name, string arguments)
+    {
+        var processStartInfo = new ProcessStartInfo
+        {
+            FileName = name,
+            Arguments = arguments
+        };
+
+        processStartInfo.Environment["TAG"] = "test";
+        processStartInfo.Environment["CONFIGURATION"] = "Debug";
+        processStartInfo.Environment["COMPUTERNAME"] = Environment.MachineName;
+
+        var process = Process.Start(processStartInfo);
+        if (process is null)
+            throw new Exception("Process.Start returned null");
+
+        process.WaitForExit();
+
+        if (process.ExitCode != 0)
+            throw new Exception($"Exit code {process.ExitCode} when running process {name} with arguments {arguments}");
     }
 }
diff --git a/tests/DotPulsar.StressTests/Fixtures/StandaloneClusterTests.cs b/tests/DotPulsar.StressTests/Fixtures/StandaloneClusterTests.cs
index 1067269..44dd08c 100644
--- a/tests/DotPulsar.StressTests/Fixtures/StandaloneClusterTests.cs
+++ b/tests/DotPulsar.StressTests/Fixtures/StandaloneClusterTests.cs
@@ -12,10 +12,9 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.StressTests.Fixtures
-{
-    using Xunit;
+namespace DotPulsar.StressTests.Fixtures;
 
-    [CollectionDefinition(nameof(StandaloneClusterTest))]
-    public class StandaloneClusterTest : ICollectionFixture<StandaloneClusterFixture> { }
-}
+using Xunit;
+
+[CollectionDefinition(nameof(StandaloneClusterTest))]
+public class StandaloneClusterTest : ICollectionFixture<StandaloneClusterFixture> { }
diff --git a/tests/DotPulsar.StressTests/XunitExceptionHandler.cs b/tests/DotPulsar.StressTests/XunitExceptionHandler.cs
index 2fa2a4c..59211f4 100644
--- a/tests/DotPulsar.StressTests/XunitExceptionHandler.cs
+++ b/tests/DotPulsar.StressTests/XunitExceptionHandler.cs
@@ -12,36 +12,35 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.StressTests
+namespace DotPulsar.StressTests;
+
+using Abstractions;
+using Internal;
+using System;
+using System.Threading.Tasks;
+using Xunit.Abstractions;
+
+internal class XunitExceptionHandler : IHandleException
 {
-    using Abstractions;
-    using Internal;
-    using System;
-    using System.Threading.Tasks;
-    using Xunit.Abstractions;
+    private readonly ITestOutputHelper _output;
+    private readonly IHandleException _exceptionHandler;
 
-    internal class XunitExceptionHandler : IHandleException
+    public XunitExceptionHandler(ITestOutputHelper output, IHandleException exceptionHandler)
     {
-        private readonly ITestOutputHelper _output;
-        private readonly IHandleException _exceptionHandler;
+        _output = output;
+        _exceptionHandler = exceptionHandler;
+    }
 
-        public XunitExceptionHandler(ITestOutputHelper output, IHandleException exceptionHandler)
-        {
-            _output = output;
-            _exceptionHandler = exceptionHandler;
-        }
+    public XunitExceptionHandler(ITestOutputHelper output) : this(output, new DefaultExceptionHandler(TimeSpan.FromSeconds(3))) { }
 
-        public XunitExceptionHandler(ITestOutputHelper output) : this(output, new DefaultExceptionHandler(TimeSpan.FromSeconds(3))) { }
+    public async ValueTask OnException(ExceptionContext exceptionContext)
+    {
+        await _exceptionHandler.OnException(exceptionContext).ConfigureAwait(false);
 
-        public async ValueTask OnException(ExceptionContext exceptionContext)
-        {
-            await _exceptionHandler.OnException(exceptionContext).ConfigureAwait(false);
-
-            if (!exceptionContext.ExceptionHandled)
-                _output.WriteLine(
-                    $"{exceptionContext.Exception.GetType().Name} " +
-                    $"{exceptionContext.Exception.Message}{Environment.NewLine}" +
-                    $"{exceptionContext.Exception.StackTrace}");
-        }
+        if (!exceptionContext.ExceptionHandled)
+            _output.WriteLine(
+                $"{exceptionContext.Exception.GetType().Name} " +
+                $"{exceptionContext.Exception.Message}{Environment.NewLine}" +
+                $"{exceptionContext.Exception.StackTrace}");
     }
 }
diff --git a/tests/DotPulsar.Tests/DotPulsar.Tests.csproj b/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
index 7e44e50..f35db24 100644
--- a/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
+++ b/tests/DotPulsar.Tests/DotPulsar.Tests.csproj
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <IsPackable>false</IsPackable>
   </PropertyGroup>
 
diff --git a/tests/DotPulsar.Tests/Internal/AsyncLockTests.cs b/tests/DotPulsar.Tests/Internal/AsyncLockTests.cs
index bbd8594..9ef98e0 100644
--- a/tests/DotPulsar.Tests/Internal/AsyncLockTests.cs
+++ b/tests/DotPulsar.Tests/Internal/AsyncLockTests.cs
@@ -12,141 +12,140 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Tests.Internal
+namespace DotPulsar.Tests.Internal;
+
+using DotPulsar.Internal;
+using DotPulsar.Internal.Exceptions;
+using FluentAssertions;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+public class AsyncLockTests
 {
-    using DotPulsar.Internal;
-    using DotPulsar.Internal.Exceptions;
-    using FluentAssertions;
-    using System.Threading;
-    using System.Threading.Tasks;
-    using Xunit;
-
-    public class AsyncLockTests
+    [Fact]
+    public async Task Lock_GivenLockIsFree_ShouldReturnCompletedTask()
     {
-        [Fact]
-        public async Task Lock_GivenLockIsFree_ShouldReturnCompletedTask()
-        {
-            //Arrange
-            var sut = new AsyncLock();
+        //Arrange
+        var sut = new AsyncLock();
 
-            //Act
-            var actual = sut.Lock(CancellationToken.None);
+        //Act
+        var actual = sut.Lock(CancellationToken.None);
 
-            //Assert
-            actual.IsCompleted.Should().BeTrue();
+        //Assert
+        actual.IsCompleted.Should().BeTrue();
 
-            //Annihilate 
-            actual.Result.Dispose();
-            await sut.DisposeAsync().ConfigureAwait(false);
-        }
+        //Annihilate 
+        actual.Result.Dispose();
+        await sut.DisposeAsync().ConfigureAwait(false);
+    }
 
-        [Fact]
-        public async Task Lock_GivenLockIsTaken_ShouldReturnIncompletedTask()
-        {
-            //Arrange
-            var sut = new AsyncLock();
-            var alreadyTaken = await sut.Lock(CancellationToken.None).ConfigureAwait(false);
+    [Fact]
+    public async Task Lock_GivenLockIsTaken_ShouldReturnIncompletedTask()
+    {
+        //Arrange
+        var sut = new AsyncLock();
+        var alreadyTaken = await sut.Lock(CancellationToken.None).ConfigureAwait(false);
 
-            //Act
-            var actual = sut.Lock(CancellationToken.None);
+        //Act
+        var actual = sut.Lock(CancellationToken.None);
 
-            //Assert
-            actual.IsCompleted.Should().BeFalse();
+        //Assert
+        actual.IsCompleted.Should().BeFalse();
 
-            //Annihilate
-            alreadyTaken.Dispose();
-            actual.Result.Dispose();
-            await sut.DisposeAsync().ConfigureAwait(false);
-        }
+        //Annihilate
+        alreadyTaken.Dispose();
+        actual.Result.Dispose();
+        await sut.DisposeAsync().ConfigureAwait(false);
+    }
 
-        [Fact]
-        public async Task Lock_GivenLockIsDisposed_ShouldThrowAsyncLockDisposedException()
-        {
-            //Arrange
-            var sut = new AsyncLock();
-            await sut.DisposeAsync().ConfigureAwait(false);
+    [Fact]
+    public async Task Lock_GivenLockIsDisposed_ShouldThrowAsyncLockDisposedException()
+    {
+        //Arrange
+        var sut = new AsyncLock();
+        await sut.DisposeAsync().ConfigureAwait(false);
 
-            //Act
-            var exception = await Record.ExceptionAsync(() => sut.Lock(CancellationToken.None)).ConfigureAwait(false);
+        //Act
+        var exception = await Record.ExceptionAsync(() => sut.Lock(CancellationToken.None)).ConfigureAwait(false);
 
-            //Assert
-            exception.Should().BeOfType<AsyncLockDisposedException>();
-        }
+        //Assert
+        exception.Should().BeOfType<AsyncLockDisposedException>();
+    }
 
-        [Fact]
-        public async Task Lock_GivenLockIsDisposedWhileAwaitingLock_ShouldThrowTaskCanceledException()
-        {
-            //Arrange
-            var sut = new AsyncLock();
-            var gotLock = await sut.Lock(CancellationToken.None).ConfigureAwait(false);
-            var awaiting = sut.Lock(CancellationToken.None);
-            _ = Task.Run(async () => await sut.DisposeAsync().ConfigureAwait(false));
+    [Fact]
+    public async Task Lock_GivenLockIsDisposedWhileAwaitingLock_ShouldThrowTaskCanceledException()
+    {
+        //Arrange
+        var sut = new AsyncLock();
+        var gotLock = await sut.Lock(CancellationToken.None).ConfigureAwait(false);
+        var awaiting = sut.Lock(CancellationToken.None);
+        _ = Task.Run(async () => await sut.DisposeAsync().ConfigureAwait(false));
 
-            //Act
-            var exception = await Record.ExceptionAsync(() => awaiting).ConfigureAwait(false);
+        //Act
+        var exception = await Record.ExceptionAsync(() => awaiting).ConfigureAwait(false);
 
-            //Assert
-            exception.Should().BeOfType<TaskCanceledException>();
+        //Assert
+        exception.Should().BeOfType<TaskCanceledException>();
 
-            //Annihilate
-            await sut.DisposeAsync().ConfigureAwait(false);
-            gotLock.Dispose();
-        }
+        //Annihilate
+        await sut.DisposeAsync().ConfigureAwait(false);
+        gotLock.Dispose();
+    }
 
-        [Fact]
-        public async Task Lock_GivenLockIsTakenAndCancellationTokenIsActivated_ShouldThrowTaskCanceledException()
-        {
-            //Arrange
-            var cts = new CancellationTokenSource();
-            var sut = new AsyncLock();
-            var gotLock = await sut.Lock(CancellationToken.None).ConfigureAwait(false);
-            var awaiting = sut.Lock(cts.Token);
+    [Fact]
+    public async Task Lock_GivenLockIsTakenAndCancellationTokenIsActivated_ShouldThrowTaskCanceledException()
+    {
+        //Arrange
+        var cts = new CancellationTokenSource();
+        var sut = new AsyncLock();
+        var gotLock = await sut.Lock(CancellationToken.None).ConfigureAwait(false);
+        var awaiting = sut.Lock(cts.Token);
 
-            //Act
-            cts.Cancel();
-            var exception = await Record.ExceptionAsync(() => awaiting).ConfigureAwait(false);
+        //Act
+        cts.Cancel();
+        var exception = await Record.ExceptionAsync(() => awaiting).ConfigureAwait(false);
 
-            //Assert
-            exception.Should().BeOfType<TaskCanceledException>();
+        //Assert
+        exception.Should().BeOfType<TaskCanceledException>();
 
-            //Annihilate
-            cts.Dispose();
-            gotLock.Dispose();
-            await sut.DisposeAsync().ConfigureAwait(false);
-        }
+        //Annihilate
+        cts.Dispose();
+        gotLock.Dispose();
+        await sut.DisposeAsync().ConfigureAwait(false);
+    }
 
-        [Fact]
-        public async Task Dispose_GivenLockIsDisposedWhileItIsTaken_ShouldNotCompleteBeforeItIsReleased()
-        {
-            //Arrange
-            var sut = new AsyncLock();
-            var gotLock = await sut.Lock(CancellationToken.None).ConfigureAwait(false);
-            var disposeTask = Task.Run(async () => await sut.DisposeAsync().ConfigureAwait(false));
-            Assert.False(disposeTask.IsCompleted);
+    [Fact]
+    public async Task Dispose_GivenLockIsDisposedWhileItIsTaken_ShouldNotCompleteBeforeItIsReleased()
+    {
+        //Arrange
+        var sut = new AsyncLock();
+        var gotLock = await sut.Lock(CancellationToken.None).ConfigureAwait(false);
+        var disposeTask = Task.Run(async () => await sut.DisposeAsync().ConfigureAwait(false));
+        Assert.False(disposeTask.IsCompleted);
 
-            //Act
-            gotLock.Dispose();
-            await disposeTask.ConfigureAwait(false);
+        //Act
+        gotLock.Dispose();
+        await disposeTask.ConfigureAwait(false);
 
-            //Assert
-            disposeTask.IsCompleted.Should().BeTrue();
+        //Assert
+        disposeTask.IsCompleted.Should().BeTrue();
 
-            //Annihilate
-            await sut.DisposeAsync().ConfigureAwait(false);
-        }
+        //Annihilate
+        await sut.DisposeAsync().ConfigureAwait(false);
+    }
 
-        [Fact]
-        public async Task Dispose_WhenCalledMultipleTimes_ShouldBeSafeToDoSo()
-        {
-            //Arrange
-            var sut = new AsyncLock();
+    [Fact]
+    public async Task Dispose_WhenCalledMultipleTimes_ShouldBeSafeToDoSo()
+    {
+        //Arrange
+        var sut = new AsyncLock();
 
-            //Act
-            await sut.DisposeAsync().ConfigureAwait(false);
-            var exception = await Record.ExceptionAsync(() => sut.DisposeAsync().AsTask()).ConfigureAwait(false); // xUnit can't record ValueTask yet
+        //Act
+        await sut.DisposeAsync().ConfigureAwait(false);
+        var exception = await Record.ExceptionAsync(() => sut.DisposeAsync().AsTask()).ConfigureAwait(false); // xUnit can't record ValueTask yet
 
-            //Assert
-            exception.Should().BeNull();
-        }
+        //Assert
+        exception.Should().BeNull();
     }
 }
diff --git a/tests/DotPulsar.Tests/Internal/AsyncQueueTests.cs b/tests/DotPulsar.Tests/Internal/AsyncQueueTests.cs
index 78a3d3c..7c60c21 100644
--- a/tests/DotPulsar.Tests/Internal/AsyncQueueTests.cs
+++ b/tests/DotPulsar.Tests/Internal/AsyncQueueTests.cs
@@ -12,121 +12,120 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Tests.Internal
+namespace DotPulsar.Tests.Internal;
+
+using DotPulsar.Internal;
+using FluentAssertions;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+public class AsyncQueueTests
 {
-    using DotPulsar.Internal;
-    using FluentAssertions;
-    using System.Threading;
-    using System.Threading.Tasks;
-    using Xunit;
-
-    public class AsyncQueueTests
+    [Fact]
+    public async Task Enqueue_GivenDequeueTaskWasWaiting_ShouldCompleteDequeueTask()
     {
-        [Fact]
-        public async Task Enqueue_GivenDequeueTaskWasWaiting_ShouldCompleteDequeueTask()
-        {
-            //Arrange
-            const int expected = 1;
-            var queue = new AsyncQueue<int>();
-            var dequeueTask = queue.Dequeue();
-            queue.Enqueue(expected);
+        //Arrange
+        const int expected = 1;
+        var queue = new AsyncQueue<int>();
+        var dequeueTask = queue.Dequeue();
+        queue.Enqueue(expected);
 
-            //Act
-            var actual = await dequeueTask.ConfigureAwait(false);
+        //Act
+        var actual = await dequeueTask.ConfigureAwait(false);
 
-            //Assert
-            actual.Should().Be(expected);
+        //Assert
+        actual.Should().Be(expected);
 
-            //Annihilate
-            queue.Dispose();
-        }
+        //Annihilate
+        queue.Dispose();
+    }
 
-        [Fact]
-        public async Task DequeueAsync_GivenQueueWasNotEmpty_ShouldCompleteDequeueTask()
-        {
-            //Arrange
-            const int expected = 1;
-            var queue = new AsyncQueue<int>();
-            queue.Enqueue(expected);
+    [Fact]
+    public async Task DequeueAsync_GivenQueueWasNotEmpty_ShouldCompleteDequeueTask()
+    {
+        //Arrange
+        const int expected = 1;
+        var queue = new AsyncQueue<int>();
+        queue.Enqueue(expected);
 
-            //Act
-            var actual = await queue.Dequeue().ConfigureAwait(false);
+        //Act
+        var actual = await queue.Dequeue().ConfigureAwait(false);
 
-            //Assert
-            actual.Should().Be(expected);
+        //Assert
+        actual.Should().Be(expected);
 
-            //Annihilate
-            queue.Dispose();
-        }
+        //Annihilate
+        queue.Dispose();
+    }
 
-        [Fact]
-        public async Task DequeueAsync_GivenMultipleDequeues_ShouldCompleteInOrderedSequence()
-        {
-            //Arrange
-            const int expected1 = 1, expected2 = 2;
-            var queue = new AsyncQueue<int>();
-            var dequeue1 = queue.Dequeue();
-            var dequeue2 = queue.Dequeue();
-            queue.Enqueue(expected1);
-            queue.Enqueue(expected2);
+    [Fact]
+    public async Task DequeueAsync_GivenMultipleDequeues_ShouldCompleteInOrderedSequence()
+    {
+        //Arrange
+        const int expected1 = 1, expected2 = 2;
+        var queue = new AsyncQueue<int>();
+        var dequeue1 = queue.Dequeue();
+        var dequeue2 = queue.Dequeue();
+        queue.Enqueue(expected1);
+        queue.Enqueue(expected2);
 
-            //Act
-            var actual1 = await dequeue1.ConfigureAwait(false);
-            var actual2 = await dequeue2.ConfigureAwait(false);
+        //Act
+        var actual1 = await dequeue1.ConfigureAwait(false);
+        var actual2 = await dequeue2.ConfigureAwait(false);
 
-            //Assert
-            actual1.Should().Be(expected1);
-            actual2.Should().Be(expected2);
+        //Assert
+        actual1.Should().Be(expected1);
+        actual2.Should().Be(expected2);
 
-            //Annihilate
-            queue.Dispose();
-        }
+        //Annihilate
+        queue.Dispose();
+    }
 
-        [Fact]
-        public async Task DequeueAsync_GivenSequenceOfInput_ShouldReturnSameSequenceOfOutput()
-        {
-            //Arrange
-            const int expected1 = 1, expected2 = 2;
-            var queue = new AsyncQueue<int>();
-            queue.Enqueue(expected1);
-            queue.Enqueue(expected2);
+    [Fact]
+    public async Task DequeueAsync_GivenSequenceOfInput_ShouldReturnSameSequenceOfOutput()
+    {
+        //Arrange
+        const int expected1 = 1, expected2 = 2;
+        var queue = new AsyncQueue<int>();
+        queue.Enqueue(expected1);
+        queue.Enqueue(expected2);
 
-            //Act
-            var actual1 = await queue.Dequeue().ConfigureAwait(false);
-            var actual2 = await queue.Dequeue().ConfigureAwait(false);
+        //Act
+        var actual1 = await queue.Dequeue().ConfigureAwait(false);
+        var actual2 = await queue.Dequeue().ConfigureAwait(false);
 
-            //Assert
-            actual1.Should().Be(expected1);
-            actual2.Should().Be(expected2);
+        //Assert
+        actual1.Should().Be(expected1);
+        actual2.Should().Be(expected2);
 
-            //Annihilate
-            queue.Dispose();
-        }
+        //Annihilate
+        queue.Dispose();
+    }
 
-        [Fact]
-        public async Task DequeueAsync_GivenTokenIsCanceled_ShouldCancelTask()
-        {
-            //Arrange
-            CancellationTokenSource source1 = new(), source2 = new();
-            const int excepted = 1;
-            var queue = new AsyncQueue<int>();
-            var task1 = queue.Dequeue(source1.Token).AsTask();
-            var task2 = queue.Dequeue(source2.Token).AsTask();
+    [Fact]
+    public async Task DequeueAsync_GivenTokenIsCanceled_ShouldCancelTask()
+    {
+        //Arrange
+        CancellationTokenSource source1 = new(), source2 = new();
+        const int excepted = 1;
+        var queue = new AsyncQueue<int>();
+        var task1 = queue.Dequeue(source1.Token).AsTask();
+        var task2 = queue.Dequeue(source2.Token).AsTask();
 
-            //Act
-            source1.Cancel();
-            queue.Enqueue(excepted);
-            var exception = await Record.ExceptionAsync(() => task1).ConfigureAwait(false);
-            await task2.ConfigureAwait(false);
+        //Act
+        source1.Cancel();
+        queue.Enqueue(excepted);
+        var exception = await Record.ExceptionAsync(() => task1).ConfigureAwait(false);
+        await task2.ConfigureAwait(false);
 
-            //Assert
-            exception.Should().BeOfType<TaskCanceledException>();
-            task2.Result.Should().Be(excepted);
+        //Assert
+        exception.Should().BeOfType<TaskCanceledException>();
+        task2.Result.Should().Be(excepted);
 
-            //Annihilate
-            source1.Dispose();
-            source2.Dispose();
-            queue.Dispose();
-        }
+        //Annihilate
+        source1.Dispose();
+        source2.Dispose();
+        queue.Dispose();
     }
 }
diff --git a/tests/DotPulsar.Tests/Internal/ChunkingPipelineTests.cs b/tests/DotPulsar.Tests/Internal/ChunkingPipelineTests.cs
index 65ab5f5..1d9b072 100644
--- a/tests/DotPulsar.Tests/Internal/ChunkingPipelineTests.cs
+++ b/tests/DotPulsar.Tests/Internal/ChunkingPipelineTests.cs
@@ -12,107 +12,106 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Tests.Internal
+namespace DotPulsar.Tests.Internal;
+
+using DotPulsar.Internal;
+using FluentAssertions;
+using System;
+using System.Buffers;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Xunit;
+
+public class ChunkingPipelineTests
 {
-    using DotPulsar.Internal;
-    using FluentAssertions;
-    using System;
-    using System.Buffers;
-    using System.IO;
-    using System.Linq;
-    using System.Threading.Tasks;
-    using Xunit;
-
-    public class ChunkingPipelineTests
+    [Fact]
+    public async Task Send_GivenSequenceIsUnderChunkSize_ShouldWriteArrayOnce()
     {
-        [Fact]
-        public async Task Send_GivenSequenceIsUnderChunkSize_ShouldWriteArrayOnce()
+        //Arrange
+        var a = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+        var b = new byte[] { 0x04, 0x05, 0x06, 0x07 };
+        var sequence = new SequenceBuilder<byte>().Append(a).Append(b).Build();
+        var mockStream = new MockStream();
+        var sut = new ChunkingPipeline(mockStream, 9);
+
+        //Act
+        await sut.Send(sequence);
+
+        //Assert
+        var expected = sequence.ToArray();
+        var actual = mockStream.GetReadOnlySequence();
+        actual.ToArray().Should().Equal(expected);
+        actual.IsSingleSegment.Should().BeTrue();
+    }
+
+    [Theory]
+    [InlineData(4, 6, 3, 4, 6, 3)]     // No segments can be merged
+    [InlineData(1, 6, 4, 7, 4, null)]  // Can merge a and b
+    [InlineData(4, 6, 1, 4, 7, null)]  // Can merge b and c
+    public async Task Send_GivenSequenceIsOverChunkSize_ShouldWriteMultipleArrays(int length1, int length2, int length3, int expected1, int expected2, int? expected3)
+    {
+        //Arrange
+        var a = Enumerable.Range(0, length1).Select(i => (byte) i).ToArray();
+        var b = Enumerable.Range(length1, length2).Select(i => (byte) i).ToArray();
+        var c = Enumerable.Range(length1 + length2, length3).Select(i => (byte) i).ToArray();
+        var sequence = new SequenceBuilder<byte>().Append(a).Append(b).Append(c).Build();
+        var mockStream = new MockStream();
+        var sut = new ChunkingPipeline(mockStream, 8);
+
+        //Act
+        await sut.Send(sequence);
+
+        //Assert
+        var expected = sequence.ToArray();
+        var actual = mockStream.GetReadOnlySequence();
+        actual.ToArray().Should().Equal(expected);
+        GetNumberOfSegments(actual).Should().Be(expected3.HasValue ? 3 : 2);
+
+        var segmentNumber = 0;
+        foreach (var segment in actual)
         {
-            //Arrange
-            var a = new byte[] { 0x00, 0x01, 0x02, 0x03 };
-            var b = new byte[] { 0x04, 0x05, 0x06, 0x07 };
-            var sequence = new SequenceBuilder<byte>().Append(a).Append(b).Build();
-            var mockStream = new MockStream();
-            var sut = new ChunkingPipeline(mockStream, 9);
-
-            //Act
-            await sut.Send(sequence);
-
-            //Assert
-            var expected = sequence.ToArray();
-            var actual = mockStream.GetReadOnlySequence();
-            actual.ToArray().Should().Equal(expected);
-            actual.IsSingleSegment.Should().BeTrue();
-        }
-
-        [Theory]
-        [InlineData(4, 6, 3, 4, 6, 3)]     // No segments can be merged
-        [InlineData(1, 6, 4, 7, 4, null)]  // Can merge a and b
-        [InlineData(4, 6, 1, 4, 7, null)]  // Can merge b and c
-        public async Task Send_GivenSequenceIsOverChunkSize_ShouldWriteMultipleArrays(int length1, int length2, int length3, int expected1, int expected2, int? expected3)
-        {
-            //Arrange
-            var a = Enumerable.Range(0, length1).Select(i => (byte) i).ToArray();
-            var b = Enumerable.Range(length1, length2).Select(i => (byte) i).ToArray();
-            var c = Enumerable.Range(length1 + length2, length3).Select(i => (byte) i).ToArray();
-            var sequence = new SequenceBuilder<byte>().Append(a).Append(b).Append(c).Build();
-            var mockStream = new MockStream();
-            var sut = new ChunkingPipeline(mockStream, 8);
-
-            //Act
-            await sut.Send(sequence);
-
-            //Assert
-            var expected = sequence.ToArray();
-            var actual = mockStream.GetReadOnlySequence();
-            actual.ToArray().Should().Equal(expected);
-            GetNumberOfSegments(actual).Should().Be(expected3.HasValue ? 3 : 2);
-
-            var segmentNumber = 0;
-            foreach (var segment in actual)
+            switch (segmentNumber)
             {
-                switch (segmentNumber)
-                {
-                    case 0:
-                        segment.Length.Should().Be(expected1);
-                        break;
-                    case 1:
-                        segment.Length.Should().Be(expected2);
-                        break;
-                    case 2:
-                        expected3.Should().NotBeNull();
-                        segment.Length.Should().Be(expected3);
-                        break;
-                }
-                ++segmentNumber;
+                case 0:
+                    segment.Length.Should().Be(expected1);
+                    break;
+                case 1:
+                    segment.Length.Should().Be(expected2);
+                    break;
+                case 2:
+                    expected3.Should().NotBeNull();
+                    segment.Length.Should().Be(expected3);
+                    break;
             }
+            ++segmentNumber;
         }
+    }
 
-        private static int GetNumberOfSegments(ReadOnlySequence<byte> sequence)
-        {
-            var numberOfSegments = 0;
-            var enumerator = sequence.GetEnumerator();
-            while (enumerator.MoveNext())
-                ++numberOfSegments;
-            return numberOfSegments;
-        }
+    private static int GetNumberOfSegments(ReadOnlySequence<byte> sequence)
+    {
+        var numberOfSegments = 0;
+        var enumerator = sequence.GetEnumerator();
+        while (enumerator.MoveNext())
+            ++numberOfSegments;
+        return numberOfSegments;
+    }
 
-        private class MockStream : Stream
-        {
-            private readonly SequenceBuilder<byte> _builder;
+    private class MockStream : Stream
+    {
+        private readonly SequenceBuilder<byte> _builder;
 
-            public MockStream() => _builder = new SequenceBuilder<byte>();
-            public override bool CanRead => throw new NotImplementedException();
-            public override bool CanSeek => throw new NotImplementedException();
-            public override bool CanWrite => true;
-            public override long Length => throw new NotImplementedException();
-            public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
-            public override void Flush() => throw new NotImplementedException();
-            public override int Read(byte[] buffer, int offset, int count) => throw new NotImplementedException();
-            public override long Seek(long offset, SeekOrigin origin) => throw new NotImplementedException();
-            public override void SetLength(long value) => throw new NotImplementedException();
-            public override void Write(byte[] buffer, int offset, int count) => _builder.Append(new ReadOnlyMemory<byte>(buffer, offset, count));
-            public ReadOnlySequence<byte> GetReadOnlySequence() => _builder.Build();
-        }
+        public MockStream() => _builder = new SequenceBuilder<byte>();
+        public override bool CanRead => throw new NotImplementedException();
+        public override bool CanSeek => throw new NotImplementedException();
+        public override bool CanWrite => true;
+        public override long Length => throw new NotImplementedException();
+        public override long Position { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+        public override void Flush() => throw new NotImplementedException();
+        public override int Read(byte[] buffer, int offset, int count) => throw new NotImplementedException();
+        public override long Seek(long offset, SeekOrigin origin) => throw new NotImplementedException();
+        public override void SetLength(long value) => throw new NotImplementedException();
+        public override void Write(byte[] buffer, int offset, int count) => _builder.Append(new ReadOnlyMemory<byte>(buffer, offset, count));
+        public ReadOnlySequence<byte> GetReadOnlySequence() => _builder.Build();
     }
 }
diff --git a/tests/DotPulsar.Tests/Internal/Crc32CTests.cs b/tests/DotPulsar.Tests/Internal/Crc32CTests.cs
index 63ca663..a426a35 100644
--- a/tests/DotPulsar.Tests/Internal/Crc32CTests.cs
+++ b/tests/DotPulsar.Tests/Internal/Crc32CTests.cs
@@ -12,51 +12,50 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Tests.Internal
+namespace DotPulsar.Tests.Internal;
+
+using DotPulsar.Internal;
+using FluentAssertions;
+using Xunit;
+
+public class Crc32CTests
 {
-    using DotPulsar.Internal;
-    using FluentAssertions;
-    using Xunit;
-
-    public class Crc32CTests
+    [Fact]
+    public void Calculate_GivenSequenceWithSingleSegment_ShouldReturnExpectedChecksum()
     {
-        [Fact]
-        public void Calculate_GivenSequenceWithSingleSegment_ShouldReturnExpectedChecksum()
+        //Arrange
+        var segment = new byte[] { 0x10, 0x01, 0x18, 0xc9, 0xf8, 0x86, 0x94, 0xeb, 0x2c };
+
+        var sequence = new SequenceBuilder<byte>().Append(segment).Build();
+
+        //Act
+        var actual = Crc32C.Calculate(sequence);
+
+        //Assert
+        const uint expected = 2355953212;
+        actual.Should().Be(expected);
+    }
+
+    [Fact]
+    public void Calculate_GivenSequenceWithMultipleSegments_ShouldReturnExpectedChecksum()
+    {
+        //Arrange
+        var s1 = new byte[]
         {
-            //Arrange
-            var segment = new byte[] { 0x10, 0x01, 0x18, 0xc9, 0xf8, 0x86, 0x94, 0xeb, 0x2c };
-
-            var sequence = new SequenceBuilder<byte>().Append(segment).Build();
-
-            //Act
-            var actual = Crc32C.Calculate(sequence);
-
-            //Assert
-            const uint expected = 2355953212;
-            actual.Should().Be(expected);
-        }
-
-        [Fact]
-        public void Calculate_GivenSequenceWithMultipleSegments_ShouldReturnExpectedChecksum()
-        {
-            //Arrange
-            var s1 = new byte[]
-            {
                 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x6c, 0x6f,
                 0x6e, 0x65, 0x2d, 0x33, 0x30, 0x2d, 0x35, 0x10, 0x00, 0x18,
                 0xc7, 0xee, 0xa3, 0x93, 0xeb, 0x2c, 0x58, 0x01
-            };
+        };
 
-            var s2 = new byte[] { 0x10, 0x01, 0x18, 0xc9, 0xf8, 0x86, 0x94, 0xeb, 0x2c };
+        var s2 = new byte[] { 0x10, 0x01, 0x18, 0xc9, 0xf8, 0x86, 0x94, 0xeb, 0x2c };
 
-            var sequence = new SequenceBuilder<byte>().Append(s1).Append(s2).Build();
+        var sequence = new SequenceBuilder<byte>().Append(s1).Append(s2).Build();
 
-            //Act
-            var actual = Crc32C.Calculate(sequence);
+        //Act
+        var actual = Crc32C.Calculate(sequence);
 
-            //Assert
-            const uint expected = 1079987866;
-            actual.Should().Be(expected);
-        }
+        //Assert
+        const uint expected = 1079987866;
+        actual.Should().Be(expected);
     }
 }
diff --git a/tests/DotPulsar.Tests/Internal/Extensions/ReadOnlySequenceExtensionsTests.cs b/tests/DotPulsar.Tests/Internal/Extensions/ReadOnlySequenceExtensionsTests.cs
index c4d9df6..65bf983 100644
--- a/tests/DotPulsar.Tests/Internal/Extensions/ReadOnlySequenceExtensionsTests.cs
+++ b/tests/DotPulsar.Tests/Internal/Extensions/ReadOnlySequenceExtensionsTests.cs
@@ -12,173 +12,172 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Tests.Internal.Extensions
+namespace DotPulsar.Tests.Internal.Extensions;
+
+using DotPulsar.Internal;
+using DotPulsar.Internal.Extensions;
+using FluentAssertions;
+using Xunit;
+
+public class ReadOnlySequenceExtensionsTests
 {
-    using DotPulsar.Internal;
-    using DotPulsar.Internal.Extensions;
-    using FluentAssertions;
-    using Xunit;
-
-    public class ReadOnlySequenceExtensionsTests
+    [Fact]
+    public void StartsWith_GivenToShortSequenceWithSingleSegment_ShouldReturnFalse()
     {
-        [Fact]
-        public void StartsWith_GivenToShortSequenceWithSingleSegment_ShouldReturnFalse()
-        {
-            //Arrange
-            var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00 }).Build();
+        //Arrange
+        var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00 }).Build();
 
-            //Act
-            var actual = sequence.StartsWith(new byte[] { 0x00, 0x01 });
+        //Act
+        var actual = sequence.StartsWith(new byte[] { 0x00, 0x01 });
 
-            //Assert
-            actual.Should().BeFalse();
-        }
+        //Assert
+        actual.Should().BeFalse();
+    }
 
-        [Fact]
-        public void StartsWith_GivenSequenceWithSingleSegment_ShouldReturnFalse()
-        {
-            //Arrange
-            var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x02, 0x01 }).Build();
+    [Fact]
+    public void StartsWith_GivenSequenceWithSingleSegment_ShouldReturnFalse()
+    {
+        //Arrange
+        var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x02, 0x01 }).Build();
 
-            //Act
-            var actual = sequence.StartsWith(new byte[] { 0x00, 0x01 });
+        //Act
+        var actual = sequence.StartsWith(new byte[] { 0x00, 0x01 });
 
-            //Assert
-            actual.Should().BeFalse();
-        }
+        //Assert
+        actual.Should().BeFalse();
+    }
 
-        [Fact]
-        public void StartsWith_GivenSequenceWithSingleSegment_ShouldReturnTrue()
-        {
-            //Arrange
-            var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x01, 0x02 }).Build();
+    [Fact]
+    public void StartsWith_GivenSequenceWithSingleSegment_ShouldReturnTrue()
+    {
+        //Arrange
+        var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x01, 0x02 }).Build();
 
-            //Act
-            var actual = sequence.StartsWith(new byte[] { 0x00, 0x01 });
+        //Act
+        var actual = sequence.StartsWith(new byte[] { 0x00, 0x01 });
 
-            //Assert
-            actual.Should().BeTrue();
-        }
+        //Assert
+        actual.Should().BeTrue();
+    }
 
-        [Fact]
-        public void StartsWith_GivenToShortSequenceWithMultipleSegments_ShouldReturnFalse()
-        {
-            //Arrange
-            var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x01 }).Append(new byte[] { 0x02 }).Build();
+    [Fact]
+    public void StartsWith_GivenToShortSequenceWithMultipleSegments_ShouldReturnFalse()
+    {
+        //Arrange
+        var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x01 }).Append(new byte[] { 0x02 }).Build();
 
-            //Act
-            var actual = sequence.StartsWith(new byte[] { 0x00, 0x01, 0x02, 0x03 });
+        //Act
+        var actual = sequence.StartsWith(new byte[] { 0x00, 0x01, 0x02, 0x03 });
 
-            //Assert
-            actual.Should().BeFalse();
-        }
+        //Assert
+        actual.Should().BeFalse();
+    }
 
-        [Fact]
-        public void StartsWith_GivenSequenceWithMultipleSegments_ShouldReturnFalse()
-        {
-            //Arrange
-            var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x02 }).Append(new byte[] { 0x01, 0x03 }).Build();
+    [Fact]
+    public void StartsWith_GivenSequenceWithMultipleSegments_ShouldReturnFalse()
+    {
+        //Arrange
+        var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x02 }).Append(new byte[] { 0x01, 0x03 }).Build();
 
-            //Act
-            var actual = sequence.StartsWith(new byte[] { 0x00, 0x01, 0x02 });
+        //Act
+        var actual = sequence.StartsWith(new byte[] { 0x00, 0x01, 0x02 });
 
-            //Assert
-            actual.Should().BeFalse();
-        }
+        //Assert
+        actual.Should().BeFalse();
+    }
 
-        [Fact]
-        public void StartsWith_GivenSequenceWithMultipleSegments_ShouldReturnTrue()
-        {
-            //Arrange
-            var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x01 }).Append(new byte[] { 0x02, 0x03 }).Build();
+    [Fact]
+    public void StartsWith_GivenSequenceWithMultipleSegments_ShouldReturnTrue()
+    {
+        //Arrange
+        var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x01 }).Append(new byte[] { 0x02, 0x03 }).Build();
 
-            //Act
-            var actual = sequence.StartsWith(new byte[] { 0x00, 0x01, 0x02 });
+        //Act
+        var actual = sequence.StartsWith(new byte[] { 0x00, 0x01, 0x02 });
 
-            //Assert
-            actual.Should().BeTrue();
-        }
+        //Assert
+        actual.Should().BeTrue();
+    }
 
-        [Fact]
-        public void ReadUInt32_GivenSequenceWithSingleSegment_ShouldGiveExceptedResult()
-        {
-            //Arrange
-            var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x01, 0x02, 0x03 }).Build();
+    [Fact]
+    public void ReadUInt32_GivenSequenceWithSingleSegment_ShouldGiveExceptedResult()
+    {
+        //Arrange
+        var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x00, 0x01, 0x02, 0x03 }).Build();
 
-            //Act
-            var actual = sequence.ReadUInt32(0, true);
+        //Act
+        var actual = sequence.ReadUInt32(0, true);
 
-            //Assert
-            const uint expected = 66051;
-            actual.Should().Be(expected);
-        }
+        //Assert
+        const uint expected = 66051;
+        actual.Should().Be(expected);
+    }
 
-        [Fact]
-        public void ReadUInt32_GivenSequenceWithSingleSegmentAndNonZeroStart_ShouldGiveExceptedResult()
-        {
-            //Arrange
-            var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x09, 0x00, 0x01, 0x02, 0x03 }).Build();
+    [Fact]
+    public void ReadUInt32_GivenSequenceWithSingleSegmentAndNonZeroStart_ShouldGiveExceptedResult()
+    {
+        //Arrange
+        var sequence = new SequenceBuilder<byte>().Append(new byte[] { 0x09, 0x00, 0x01, 0x02, 0x03 }).Build();
 
-            //Act
-            var actual = sequence.ReadUInt32(1, true);
+        //Act
+        var actual = sequence.ReadUInt32(1, true);
 
-            //Assert
-            const uint expected = 66051;
-            actual.Should().Be(expected);
-        }
+        //Assert
+        const uint expected = 66051;
+        actual.Should().Be(expected);
+    }
 
 #pragma warning disable xUnit1025 // Miscoded warning can't tell these are all different
-        [Theory]
-        [InlineData(new byte[] { }, new byte[] { 0x02, 0x03, 0x04, 0x05 })]
-        [InlineData(new byte[] { 0x02 }, new byte[] { 0x03, 0x04, 0x05 })]
-        [InlineData(new byte[] { 0x02, 0x03 }, new byte[] { 0x04, 0x05 })]
-        [InlineData(new byte[] { 0x02, 0x03, 0x04 }, new byte[] { 0x05 })]
-        [InlineData(new byte[] { 0x02, 0x03, 0x04, 0x05 }, new byte[] { })]
-        [InlineData(new byte[] { 0x02 }, new byte[] { }, new byte[] { 0x03, 0x04, 0x05 })]
-        [InlineData(new byte[] { 0x02, 0x03 }, new byte[] { }, new byte[] { 0x04, 0x05 })]
-        [InlineData(new byte[] { 0x02, 0x03, 0x04 }, new byte[] { }, new byte[] { 0x05 })]
-        [InlineData(new byte[] { 0x02, 0x03 }, new byte[] { 0x04 }, new byte[] { 0x05 })]
-        [InlineData(new byte[] { 0x02 }, new byte[] { 0x03, 0x04 }, new byte[] { 0x05 })]
-        [InlineData(new byte[] { 0x02 }, new byte[] { 0x03 }, new byte[] { 0x04, 0x05 })]
-        [InlineData(new byte[] { 0x02 }, new byte[] { 0x03 }, new byte[] { 0x04 }, new byte[] { 0x05 })]
-        [InlineData(new byte[] { 0x02, 0x03, 0x04 }, new byte[] { 0x05, 0x09 })]
-        [InlineData(new byte[] { 0x02 }, new byte[] { 0x03, 0x04, 0x05 }, new byte[] { 0x09 })]
-        [InlineData(new byte[] { 0x02 }, new byte[] { 0x03 }, new byte[] { 0x04, 0x05 }, new byte[] { 0x09 })]
+    [Theory]
+    [InlineData(new byte[] { }, new byte[] { 0x02, 0x03, 0x04, 0x05 })]
+    [InlineData(new byte[] { 0x02 }, new byte[] { 0x03, 0x04, 0x05 })]
+    [InlineData(new byte[] { 0x02, 0x03 }, new byte[] { 0x04, 0x05 })]
+    [InlineData(new byte[] { 0x02, 0x03, 0x04 }, new byte[] { 0x05 })]
+    [InlineData(new byte[] { 0x02, 0x03, 0x04, 0x05 }, new byte[] { })]
+    [InlineData(new byte[] { 0x02 }, new byte[] { }, new byte[] { 0x03, 0x04, 0x05 })]
+    [InlineData(new byte[] { 0x02, 0x03 }, new byte[] { }, new byte[] { 0x04, 0x05 })]
+    [InlineData(new byte[] { 0x02, 0x03, 0x04 }, new byte[] { }, new byte[] { 0x05 })]
+    [InlineData(new byte[] { 0x02, 0x03 }, new byte[] { 0x04 }, new byte[] { 0x05 })]
+    [InlineData(new byte[] { 0x02 }, new byte[] { 0x03, 0x04 }, new byte[] { 0x05 })]
+    [InlineData(new byte[] { 0x02 }, new byte[] { 0x03 }, new byte[] { 0x04, 0x05 })]
+    [InlineData(new byte[] { 0x02 }, new byte[] { 0x03 }, new byte[] { 0x04 }, new byte[] { 0x05 })]
+    [InlineData(new byte[] { 0x02, 0x03, 0x04 }, new byte[] { 0x05, 0x09 })]
+    [InlineData(new byte[] { 0x02 }, new byte[] { 0x03, 0x04, 0x05 }, new byte[] { 0x09 })]
+    [InlineData(new byte[] { 0x02 }, new byte[] { 0x03 }, new byte[] { 0x04, 0x05 }, new byte[] { 0x09 })]
 #pragma warning restore xUnit1025 // InlineData should be unique within the Theory it belongs to
-        public void ReadUInt32_GivenSequenceWithMultipleSegments_ShouldGiveExceptedResult(params byte[][] testPath)
-        {
-            //Arrange
-            var sequenceBuilder = new SequenceBuilder<byte>();
-            foreach (var array in testPath)
-                sequenceBuilder.Append(array);
-            var sequence = sequenceBuilder.Build();
+    public void ReadUInt32_GivenSequenceWithMultipleSegments_ShouldGiveExceptedResult(params byte[][] testPath)
+    {
+        //Arrange
+        var sequenceBuilder = new SequenceBuilder<byte>();
+        foreach (var array in testPath)
+            sequenceBuilder.Append(array);
+        var sequence = sequenceBuilder.Build();
 
-            //Act
-            var actual = sequence.ReadUInt32(0, true);
+        //Act
+        var actual = sequence.ReadUInt32(0, true);
 
-            //Assert
-            const uint expected = 0x02030405;
-            actual.Should().Be(expected);
-        }
+        //Assert
+        const uint expected = 0x02030405;
+        actual.Should().Be(expected);
+    }
 
-        [Theory]
-        [InlineData(2, new byte[] { 0x09, 0x09, 0x02 }, new byte[] { 0x03, 0x04, 0x05 }, new byte[] { 0x09, 0x09, 0x09 })]
-        [InlineData(3, new byte[] { 0x09, 0x09, 0x09 }, new byte[] { 0x02, 0x03, 0x04 }, new byte[] { 0x05, 0x09, 0x09 })]
-        [InlineData(4, new byte[] { 0x09, 0x09, 0x09 }, new byte[] { 0x09, 0x02, 0x03 }, new byte[] { 0x04, 0x05, 0x09 })]
-        public void ReadUInt32_GivenSequenceWithMultipleSegmentsAndNonZeroStart_ShouldGiveExceptedResult(long start, params byte[][] testPath)
-        {
-            //Arrange
-            var sequenceBuilder = new SequenceBuilder<byte>();
-            foreach (var array in testPath)
-                sequenceBuilder.Append(array);
-            var sequence = sequenceBuilder.Build();
+    [Theory]
+    [InlineData(2, new byte[] { 0x09, 0x09, 0x02 }, new byte[] { 0x03, 0x04, 0x05 }, new byte[] { 0x09, 0x09, 0x09 })]
+    [InlineData(3, new byte[] { 0x09, 0x09, 0x09 }, new byte[] { 0x02, 0x03, 0x04 }, new byte[] { 0x05, 0x09, 0x09 })]
+    [InlineData(4, new byte[] { 0x09, 0x09, 0x09 }, new byte[] { 0x09, 0x02, 0x03 }, new byte[] { 0x04, 0x05, 0x09 })]
+    public void ReadUInt32_GivenSequenceWithMultipleSegmentsAndNonZeroStart_ShouldGiveExceptedResult(long start, params byte[][] testPath)
+    {
+        //Arrange
+        var sequenceBuilder = new SequenceBuilder<byte>();
+        foreach (var array in testPath)
+            sequenceBuilder.Append(array);
+        var sequence = sequenceBuilder.Build();
 
-            //Act
-            var actual = sequence.ReadUInt32(start, true);
+        //Act
+        var actual = sequence.ReadUInt32(start, true);
 
-            //Assert
-            const uint expected = 0x02030405;
-            actual.Should().Be(expected);
-        }
+        //Assert
+        const uint expected = 0x02030405;
+        actual.Should().Be(expected);
     }
 }
diff --git a/tests/DotPulsar.Tests/Internal/SequenceBuilderTests.cs b/tests/DotPulsar.Tests/Internal/SequenceBuilderTests.cs
index 47e1dbe..9cb9060 100644
--- a/tests/DotPulsar.Tests/Internal/SequenceBuilderTests.cs
+++ b/tests/DotPulsar.Tests/Internal/SequenceBuilderTests.cs
@@ -12,121 +12,120 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Tests.Internal
+namespace DotPulsar.Tests.Internal;
+
+using DotPulsar.Internal;
+using FluentAssertions;
+using System.Buffers;
+using System.Linq;
+using Xunit;
+
+public class SequenceBuilderTests
 {
-    using DotPulsar.Internal;
-    using FluentAssertions;
-    using System.Buffers;
-    using System.Linq;
-    using Xunit;
-
-    public class SequenceBuilderTests
+    [Fact]
+    public void Append_GivenMultipleArrayInputs_ShouldArrangeInCorrectOrder()
     {
-        [Fact]
-        public void Append_GivenMultipleArrayInputs_ShouldArrangeInCorrectOrder()
-        {
-            //Arrange
-            var a = new byte[] { 0x00, 0x01, 0x02, 0x03 };
-            var b = new byte[] { 0x04, 0x05, 0x06, 0x07, 0x08 };
-            var c = new byte[] { 0x09 };
+        //Arrange
+        var a = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+        var b = new byte[] { 0x04, 0x05, 0x06, 0x07, 0x08 };
+        var c = new byte[] { 0x09 };
 
-            var builder = new SequenceBuilder<byte>().Append(a).Append(b).Append(c);
+        var builder = new SequenceBuilder<byte>().Append(a).Append(b).Append(c);
 
-            //Act
-            var actual = builder.Build().ToArray();
+        //Act
+        var actual = builder.Build().ToArray();
 
-            //Assert
-            var expected = CreateRange(0, 10);
-            actual.Should().Equal(expected);
-        }
+        //Assert
+        var expected = CreateRange(0, 10);
+        actual.Should().Equal(expected);
+    }
 
-        [Fact]
-        public void Append_GivenMultipleArrayAndSequenceInputs_ShouldArrangeInCorrectOrder()
-        {
-            //Arrange
-            var a = new byte[] { 0x00, 0x01 };
-            var b = new byte[] { 0x02, 0x03 };
-            var c = new byte[] { 0x04, 0x05 };
-            var d = new byte[] { 0x06, 0x07 };
-            var e = new byte[] { 0x08, 0x09 };
+    [Fact]
+    public void Append_GivenMultipleArrayAndSequenceInputs_ShouldArrangeInCorrectOrder()
+    {
+        //Arrange
+        var a = new byte[] { 0x00, 0x01 };
+        var b = new byte[] { 0x02, 0x03 };
+        var c = new byte[] { 0x04, 0x05 };
+        var d = new byte[] { 0x06, 0x07 };
+        var e = new byte[] { 0x08, 0x09 };
 
-            var seq = new SequenceBuilder<byte>().Append(b).Append(c).Append(d).Build();
-            var builder = new SequenceBuilder<byte>().Append(a).Append(seq).Append(e);
+        var seq = new SequenceBuilder<byte>().Append(b).Append(c).Append(d).Build();
+        var builder = new SequenceBuilder<byte>().Append(a).Append(seq).Append(e);
 
-            //Act
-            var actual = builder.Build().ToArray();
+        //Act
+        var actual = builder.Build().ToArray();
 
-            //Assert
-            var expected = CreateRange(0, 10);
-            actual.Should().Equal(expected);
-        }
+        //Assert
+        var expected = CreateRange(0, 10);
+        actual.Should().Equal(expected);
+    }
 
-        [Fact]
-        public void Prepend_GivenMultipleArrayInputs_ShouldArrangeInCorrectOrder()
-        {
-            //Arrange
-            var a = new byte[] { 0x00, 0x01, 0x02, 0x03 };
-            var b = new byte[] { 0x04, 0x05, 0x06, 0x07, 0x08 };
-            var c = new byte[] { 0x09 };
+    [Fact]
+    public void Prepend_GivenMultipleArrayInputs_ShouldArrangeInCorrectOrder()
+    {
+        //Arrange
+        var a = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+        var b = new byte[] { 0x04, 0x05, 0x06, 0x07, 0x08 };
+        var c = new byte[] { 0x09 };
 
-            var builder = new SequenceBuilder<byte>().Prepend(c).Prepend(b).Prepend(a);
+        var builder = new SequenceBuilder<byte>().Prepend(c).Prepend(b).Prepend(a);
 
-            //Act
-            var actual = builder.Build().ToArray();
+        //Act
+        var actual = builder.Build().ToArray();
 
-            //Assert
-            var expected = CreateRange(0, 10);
-            actual.Should().Equal(expected);
-        }
+        //Assert
+        var expected = CreateRange(0, 10);
+        actual.Should().Equal(expected);
+    }
 
-        [Fact]
-        public void Prepend_GivenMultipleArrayAndSequenceInputs_ShouldArrangeInCorrectOrder()
-        {
-            //Arrange
-            var a = new byte[] { 0x00, 0x01 };
-            var b = new byte[] { 0x02, 0x03 };
-            var c = new byte[] { 0x04, 0x05 };
-            var d = new byte[] { 0x06, 0x07 };
-            var e = new byte[] { 0x08, 0x09 };
+    [Fact]
+    public void Prepend_GivenMultipleArrayAndSequenceInputs_ShouldArrangeInCorrectOrder()
+    {
+        //Arrange
+        var a = new byte[] { 0x00, 0x01 };
+        var b = new byte[] { 0x02, 0x03 };
+        var c = new byte[] { 0x04, 0x05 };
+        var d = new byte[] { 0x06, 0x07 };
+        var e = new byte[] { 0x08, 0x09 };
 
-            var seq = new SequenceBuilder<byte>().Prepend(d).Prepend(c).Prepend(b).Build();
-            var builder = new SequenceBuilder<byte>().Prepend(e).Prepend(seq).Prepend(a);
+        var seq = new SequenceBuilder<byte>().Prepend(d).Prepend(c).Prepend(b).Build();
+        var builder = new SequenceBuilder<byte>().Prepend(e).Prepend(seq).Prepend(a);
 
-            //Act
-            var actual = builder.Build().ToArray();
+        //Act
+        var actual = builder.Build().ToArray();
 
-            //Assert
-            var expected = CreateRange(0, 10);
-            actual.Should().Equal(expected);
-        }
+        //Assert
+        var expected = CreateRange(0, 10);
+        actual.Should().Equal(expected);
+    }
 
-        [Fact]
-        public void Build_GivenMultipleInvocations_ShouldCreateIdenticalSequences()
-        {
-            //Arrange
-            var a = new byte[] { 0x00, 0x01 };
-            var b = new byte[] { 0x02, 0x03 };
+    [Fact]
+    public void Build_GivenMultipleInvocations_ShouldCreateIdenticalSequences()
+    {
+        //Arrange
+        var a = new byte[] { 0x00, 0x01 };
+        var b = new byte[] { 0x02, 0x03 };
 
-            var builder = new SequenceBuilder<byte>().Append(a).Append(b);
+        var builder = new SequenceBuilder<byte>().Append(a).Append(b);
 
-            //Act
-            var actual1 = builder.Build().ToArray();
-            var actual2 = builder.Build().ToArray();
+        //Act
+        var actual1 = builder.Build().ToArray();
+        var actual2 = builder.Build().ToArray();
 
-            //Assert
-            var expected = CreateRange(0, 4);
-            actual1.Should().Equal(expected);
-            actual2.Should().Equal(expected);
-        }
+        //Assert
+        var expected = CreateRange(0, 4);
+        actual1.Should().Equal(expected);
+        actual2.Should().Equal(expected);
+    }
 
-        private static byte[] CreateRange(int start, int count)
-        {
-            var bytes = new byte[count];
+    private static byte[] CreateRange(int start, int count)
+    {
+        var bytes = new byte[count];
 
-            for (var i = 0; i < count; ++i)
-                bytes[i] = System.Convert.ToByte(start + i);
+        for (var i = 0; i < count; ++i)
+            bytes[i] = System.Convert.ToByte(start + i);
 
-            return bytes;
-        }
+        return bytes;
     }
 }
diff --git a/tests/DotPulsar.Tests/Internal/SerializerTests.cs b/tests/DotPulsar.Tests/Internal/SerializerTests.cs
index 8968894..17c01dd 100644
--- a/tests/DotPulsar.Tests/Internal/SerializerTests.cs
+++ b/tests/DotPulsar.Tests/Internal/SerializerTests.cs
@@ -12,26 +12,25 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Tests.Internal
+namespace DotPulsar.Tests.Internal;
+
+using DotPulsar.Internal;
+using FluentAssertions;
+using Xunit;
+
+public class SerializerTests
 {
-    using DotPulsar.Internal;
-    using FluentAssertions;
-    using Xunit;
-
-    public class SerializerTests
+    [Fact]
+    public void ToBigEndianBytes_GivenUnsignedInteger_ShouldReturnExpectedBytes()
     {
-        [Fact]
-        public void ToBigEndianBytes_GivenUnsignedInteger_ShouldReturnExpectedBytes()
-        {
-            //Arrange
-            uint value = 66051;
+        //Arrange
+        uint value = 66051;
 
-            //Act
-            var actual = Serializer.ToBigEndianBytes(value);
+        //Act
+        var actual = Serializer.ToBigEndianBytes(value);
 
-            //Assert
-            var expected = new byte[] { 0x00, 0x01, 0x02, 0x03 };
-            actual.Should().Equal(expected);
-        }
+        //Assert
+        var expected = new byte[] { 0x00, 0x01, 0x02, 0x03 };
+        actual.Should().Equal(expected);
     }
 }
diff --git a/tests/DotPulsar.Tests/Internal/StateManagerTests.cs b/tests/DotPulsar.Tests/Internal/StateManagerTests.cs
index c95ac38..b01a999 100644
--- a/tests/DotPulsar.Tests/Internal/StateManagerTests.cs
+++ b/tests/DotPulsar.Tests/Internal/StateManagerTests.cs
@@ -12,235 +12,234 @@
  * limitations under the License.
  */
 
-namespace DotPulsar.Tests.Internal
+namespace DotPulsar.Tests.Internal;
+
+using DotPulsar.Internal;
+using FluentAssertions;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit;
+
+public class StateManagerTests
 {
-    using DotPulsar.Internal;
-    using FluentAssertions;
-    using System.Threading;
-    using System.Threading.Tasks;
-    using Xunit;
-
-    public class StateManagerTests
+    [Theory]
+    [InlineData(ProducerState.Connected, ProducerState.Connected, ProducerState.Connected)]
+    [InlineData(ProducerState.Connected, ProducerState.Disconnected, ProducerState.Connected)]
+    [InlineData(ProducerState.Connected, ProducerState.Closed, ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Connected, ProducerState.Disconnected)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Disconnected, ProducerState.Disconnected)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Closed, ProducerState.Disconnected)]
+    [InlineData(ProducerState.Closed, ProducerState.Connected, ProducerState.Closed)]
+    [InlineData(ProducerState.Closed, ProducerState.Disconnected, ProducerState.Closed)]
+    [InlineData(ProducerState.Closed, ProducerState.Closed, ProducerState.Closed)]
+    public void SetState_GivenNewState_ShouldReturnFormerState(ProducerState initialState, ProducerState newState, ProducerState expected)
     {
-        [Theory]
-        [InlineData(ProducerState.Connected, ProducerState.Connected, ProducerState.Connected)]
-        [InlineData(ProducerState.Connected, ProducerState.Disconnected, ProducerState.Connected)]
-        [InlineData(ProducerState.Connected, ProducerState.Closed, ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Connected, ProducerState.Disconnected)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Disconnected, ProducerState.Disconnected)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Closed, ProducerState.Disconnected)]
-        [InlineData(ProducerState.Closed, ProducerState.Connected, ProducerState.Closed)]
-        [InlineData(ProducerState.Closed, ProducerState.Disconnected, ProducerState.Closed)]
-        [InlineData(ProducerState.Closed, ProducerState.Closed, ProducerState.Closed)]
-        public void SetState_GivenNewState_ShouldReturnFormerState(ProducerState initialState, ProducerState newState, ProducerState expected)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
+        //Arrange
+        var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
 
-            //Act
-            var actual = sut.SetState(newState);
+        //Act
+        var actual = sut.SetState(newState);
 
-            //Assert
-            actual.Should().Be(expected);
-        }
+        //Assert
+        actual.Should().Be(expected);
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected)]
-        [InlineData(ProducerState.Closed)]
-        public void SetState_GivenStateIsFinal_ShouldNotChangeState(ProducerState newState)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(ProducerState.Closed, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected)]
+    [InlineData(ProducerState.Closed)]
+    public void SetState_GivenStateIsFinal_ShouldNotChangeState(ProducerState newState)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(ProducerState.Closed, ProducerState.Closed);
 
-            //Act
-            _ = sut.SetState(newState);
+        //Act
+        _ = sut.SetState(newState);
 
-            //Assert
-            sut.CurrentState.Should().Be(ProducerState.Closed);
-        }
+        //Assert
+        sut.CurrentState.Should().Be(ProducerState.Closed);
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
-        [InlineData(ProducerState.Connected, ProducerState.Closed)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Closed)]
-        public void SetState_GivenStateIsChangedToWanted_ShouldCompleteTask(ProducerState initialState, ProducerState newState)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
-            var task = sut.StateChangedTo(newState, default);
+    [Theory]
+    [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
+    [InlineData(ProducerState.Connected, ProducerState.Closed)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Closed)]
+    public void SetState_GivenStateIsChangedToWanted_ShouldCompleteTask(ProducerState initialState, ProducerState newState)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
+        var task = sut.StateChangedTo(newState, default);
 
-            //Act
-            _ = sut.SetState(newState);
+        //Act
+        _ = sut.SetState(newState);
 
-            //Assert
-            task.IsCompleted.Should().BeTrue();
-        }
+        //Assert
+        task.IsCompleted.Should().BeTrue();
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
-        [InlineData(ProducerState.Connected, ProducerState.Closed)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Closed)]
-        public void SetState_GivenStateIsChangedFromWanted_ShouldCompleteTask(ProducerState initialState, ProducerState newState)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
-            var task = sut.StateChangedFrom(initialState, default);
+    [Theory]
+    [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
+    [InlineData(ProducerState.Connected, ProducerState.Closed)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Closed)]
+    public void SetState_GivenStateIsChangedFromWanted_ShouldCompleteTask(ProducerState initialState, ProducerState newState)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
+        var task = sut.StateChangedFrom(initialState, default);
 
-            //Act
-            _ = sut.SetState(newState);
+        //Act
+        _ = sut.SetState(newState);
 
-            //Assert
-            task.IsCompleted.Should().BeTrue();
-        }
+        //Assert
+        task.IsCompleted.Should().BeTrue();
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected)]
-        [InlineData(ProducerState.Closed)]
-        public void StateChangedTo_GivenStateIsAlreadyWanted_ShouldCompleteTask(ProducerState state)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(state, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected)]
+    [InlineData(ProducerState.Closed)]
+    public void StateChangedTo_GivenStateIsAlreadyWanted_ShouldCompleteTask(ProducerState state)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(state, ProducerState.Closed);
 
-            //Act
-            var task = sut.StateChangedTo(state, default);
+        //Act
+        var task = sut.StateChangedTo(state, default);
 
-            //Assert
-            Assert.True(task.IsCompleted);
-        }
+        //Assert
+        Assert.True(task.IsCompleted);
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
-        [InlineData(ProducerState.Connected, ProducerState.Closed)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Closed)]
-        public void StateChangedTo_GivenStateIsNotWanted_ShouldNotCompleteTask(ProducerState initialState, ProducerState wantedState)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
+    [InlineData(ProducerState.Connected, ProducerState.Closed)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Closed)]
+    public void StateChangedTo_GivenStateIsNotWanted_ShouldNotCompleteTask(ProducerState initialState, ProducerState wantedState)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
 
-            //Act
-            var task = sut.StateChangedTo(wantedState, default);
+        //Act
+        var task = sut.StateChangedTo(wantedState, default);
 
-            //Assert
-            task.IsCompleted.Should().BeFalse();
-        }
+        //Assert
+        task.IsCompleted.Should().BeFalse();
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected)]
-        public void StateChangedTo_GivenStateIsFinal_ShouldCompleteTask(ProducerState state)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(ProducerState.Closed, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected)]
+    public void StateChangedTo_GivenStateIsFinal_ShouldCompleteTask(ProducerState state)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(ProducerState.Closed, ProducerState.Closed);
 
-            //Act
-            var task = sut.StateChangedTo(state, default);
+        //Act
+        var task = sut.StateChangedTo(state, default);
 
-            //Assert
-            task.IsCompleted.Should().BeTrue();
-        }
+        //Assert
+        task.IsCompleted.Should().BeTrue();
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected)]
-        public void StateChangedFrom_GivenStateHasNotChanged_ShouldNotCompleteTask(ProducerState state)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(state, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected)]
+    public void StateChangedFrom_GivenStateHasNotChanged_ShouldNotCompleteTask(ProducerState state)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(state, ProducerState.Closed);
 
-            //Act
-            var task = sut.StateChangedFrom(state, default);
+        //Act
+        var task = sut.StateChangedFrom(state, default);
 
-            //Assert
-            task.IsCompleted.Should().BeFalse();
-        }
+        //Assert
+        task.IsCompleted.Should().BeFalse();
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
-        [InlineData(ProducerState.Connected, ProducerState.Closed)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Closed)]
-        public void StateChangedFrom_GivenStateHasChanged_ShouldCompleteTask(ProducerState initialState, ProducerState fromState)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
+    [InlineData(ProducerState.Connected, ProducerState.Closed)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Closed)]
+    public void StateChangedFrom_GivenStateHasChanged_ShouldCompleteTask(ProducerState initialState, ProducerState fromState)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
 
-            //Act
-            var task = sut.StateChangedFrom(fromState, default);
+        //Act
+        var task = sut.StateChangedFrom(fromState, default);
 
-            //Assert
-            task.IsCompleted.Should().BeTrue();
-        }
+        //Assert
+        task.IsCompleted.Should().BeTrue();
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected)]
-        [InlineData(ProducerState.Disconnected)]
-        [InlineData(ProducerState.Closed)]
-        public void StateChangedFrom_GivenStateIsFinal_ShouldCompleteTask(ProducerState state)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(ProducerState.Closed, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected)]
+    [InlineData(ProducerState.Disconnected)]
+    [InlineData(ProducerState.Closed)]
+    public void StateChangedFrom_GivenStateIsFinal_ShouldCompleteTask(ProducerState state)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(ProducerState.Closed, ProducerState.Closed);
 
-            //Act
-            var task = sut.StateChangedFrom(state, default);
+        //Act
+        var task = sut.StateChangedFrom(state, default);
 
-            //Assert
-            task.IsCompleted.Should().BeTrue();
-        }
+        //Assert
+        task.IsCompleted.Should().BeTrue();
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
-        public void SetState_GivenStateIsChangeToFinalState_ShouldCompleteTask(ProducerState initialState, ProducerState wantedState)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected, ProducerState.Disconnected)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Connected)]
+    public void SetState_GivenStateIsChangeToFinalState_ShouldCompleteTask(ProducerState initialState, ProducerState wantedState)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
 
-            //Act
-            var task = sut.StateChangedTo(wantedState, default);
-            _ = sut.SetState(ProducerState.Closed);
+        //Act
+        var task = sut.StateChangedTo(wantedState, default);
+        _ = sut.SetState(ProducerState.Closed);
 
-            //Assert
-            task.IsCompleted.Should().BeTrue();
-        }
+        //Assert
+        task.IsCompleted.Should().BeTrue();
+    }
 
-        [Theory]
-        [InlineData(ProducerState.Connected, ProducerState.Disconnected, ProducerState.Closed)]
-        [InlineData(ProducerState.Disconnected, ProducerState.Connected, ProducerState.Closed)]
-        public void SetState_GivenStateIsChangedToNotWanted_ShouldNotCompleteTask(ProducerState initialState, ProducerState newState, ProducerState wantedState)
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
+    [Theory]
+    [InlineData(ProducerState.Connected, ProducerState.Disconnected, ProducerState.Closed)]
+    [InlineData(ProducerState.Disconnected, ProducerState.Connected, ProducerState.Closed)]
+    public void SetState_GivenStateIsChangedToNotWanted_ShouldNotCompleteTask(ProducerState initialState, ProducerState newState, ProducerState wantedState)
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(initialState, ProducerState.Closed);
 
-            //Act
-            var task = sut.StateChangedTo(wantedState, default);
-            _ = sut.SetState(newState);
+        //Act
+        var task = sut.StateChangedTo(wantedState, default);
+        _ = sut.SetState(newState);
 
-            //Assert
-            task.IsCompleted.Should().BeFalse();
-        }
+        //Assert
+        task.IsCompleted.Should().BeFalse();
+    }
 
-        [Fact]
-        public async Task CancelToken_GivenTaskWasStillWaiting_ShouldCancelTask()
-        {
-            //Arrange
-            var sut = new StateManager<ProducerState>(ProducerState.Connected, ProducerState.Closed);
-            var cts = new CancellationTokenSource();
-            var task = sut.StateChangedFrom(ProducerState.Connected, cts.Token);
+    [Fact]
+    public async Task CancelToken_GivenTaskWasStillWaiting_ShouldCancelTask()
+    {
+        //Arrange
+        var sut = new StateManager<ProducerState>(ProducerState.Connected, ProducerState.Closed);
+        var cts = new CancellationTokenSource();
+        var task = sut.StateChangedFrom(ProducerState.Connected, cts.Token);
 
-            //Act
-            cts.Cancel();
-            var exception = await Record.ExceptionAsync(() => task.AsTask()).ConfigureAwait(false); // xUnit can't record ValueTask yet
+        //Act
+        cts.Cancel();
+        var exception = await Record.ExceptionAsync(() => task.AsTask()).ConfigureAwait(false); // xUnit can't record ValueTask yet
 
-            //Assert
-            exception.Should().BeOfType<TaskCanceledException>();
+        //Assert
+        exception.Should().BeOfType<TaskCanceledException>();
 
-            //Annihilate
-            cts.Dispose();
-        }
+        //Annihilate
+        cts.Dispose();
     }
 }
diff --git a/tests/DotPulsar.Tests/MessageIdTests.cs b/tests/DotPulsar.Tests/MessageIdTests.cs
index 10268e4..32ad051 100644
--- a/tests/DotPulsar.Tests/MessageIdTests.cs
+++ b/tests/DotPulsar.Tests/MessageIdTests.cs
@@ -14,146 +14,145 @@
 
 #nullable disable
 
-namespace DotPulsar.Tests
+namespace DotPulsar.Tests;
+
+using DotPulsar;
+using FluentAssertions;
+using Xunit;
+
+public class MessageIdTests
 {
-    using DotPulsar;
-    using FluentAssertions;
-    using Xunit;
-
-    public class MessageIdTests
+    [Fact]
+    public void CompareTo_GivenTheSameValues_ShouldBeEqual()
     {
-        [Fact]
-        public void CompareTo_GivenTheSameValues_ShouldBeEqual()
-        {
-            var m1 = new MessageId(1, 2, 3, 4);
-            var m2 = new MessageId(1, 2, 3, 4);
+        var m1 = new MessageId(1, 2, 3, 4);
+        var m2 = new MessageId(1, 2, 3, 4);
 
-            m1.CompareTo(m2).Should().Be(0);
-            (m1 < m2).Should().BeFalse();
-            (m1 > m2).Should().BeFalse();
-            (m1 >= m2).Should().BeTrue();
-            (m1 <= m2).Should().BeTrue();
-        }
+        m1.CompareTo(m2).Should().Be(0);
+        (m1 < m2).Should().BeFalse();
+        (m1 > m2).Should().BeFalse();
+        (m1 >= m2).Should().BeTrue();
+        (m1 <= m2).Should().BeTrue();
+    }
 
-        [Fact]
-        public void CompareTo_GivenAllNull_ShouldBeEqual()
-        {
-            MessageId m1 = null;
-            MessageId m2 = null;
+    [Fact]
+    public void CompareTo_GivenAllNull_ShouldBeEqual()
+    {
+        MessageId m1 = null;
+        MessageId m2 = null;
 
-            (m1 < m2).Should().BeFalse();
-            (m1 > m2).Should().BeFalse();
-            (m1 <= m2).Should().BeTrue();
-            (m1 >= m2).Should().BeTrue();
-        }
+        (m1 < m2).Should().BeFalse();
+        (m1 > m2).Should().BeFalse();
+        (m1 <= m2).Should().BeTrue();
+        (m1 >= m2).Should().BeTrue();
+    }
 
-        [Fact]
-        public void CompareTo_GivenOneNull_ShouldFollowNull()
-        {
-            var m1 = new MessageId(1, 2, 3, 4);
-            MessageId m2 = null;
+    [Fact]
+    public void CompareTo_GivenOneNull_ShouldFollowNull()
+    {
+        var m1 = new MessageId(1, 2, 3, 4);
+        MessageId m2 = null;
 
-            m1.CompareTo(m2).Should().BePositive();
-            (m1 < m2).Should().BeFalse();
-            (m1 > m2).Should().BeTrue();
-            (m1 <= m2).Should().BeFalse();
-            (m1 >= m2).Should().BeTrue();
+        m1.CompareTo(m2).Should().BePositive();
+        (m1 < m2).Should().BeFalse();
+        (m1 > m2).Should().BeTrue();
+        (m1 <= m2).Should().BeFalse();
+        (m1 >= m2).Should().BeTrue();
 
-            (m2 < m1).Should().BeTrue();
-            (m2 > m1).Should().BeFalse();
-            (m2 <= m1).Should().BeTrue();
-            (m2 >= m1).Should().BeFalse();
-        }
+        (m2 < m1).Should().BeTrue();
+        (m2 > m1).Should().BeFalse();
+        (m2 <= m1).Should().BeTrue();
+        (m2 >= m1).Should().BeFalse();
+    }
 
-        [Theory]
-        [InlineData(2, 2, 3, 4)] // LegderId is greater
-        [InlineData(1, 3, 3, 4)] // EntryId is greater
-        [InlineData(1, 2, 4, 4)] // Partition is greater
-        [InlineData(1, 2, 3, 5)] // BatchIndex is greater
-        public void CompareTo_GivenCurrentFollowsArgument_ShouldReturnPositive(ulong ledgerId, ulong entryId, int partition, int batchIndex)
-        {
-            var m1 = new MessageId(ledgerId, entryId, partition, batchIndex);
-            var m2 = new MessageId(1, 2, 3, 4);
+    [Theory]
+    [InlineData(2, 2, 3, 4)] // LegderId is greater
+    [InlineData(1, 3, 3, 4)] // EntryId is greater
+    [InlineData(1, 2, 4, 4)] // Partition is greater
+    [InlineData(1, 2, 3, 5)] // BatchIndex is greater
+    public void CompareTo_GivenCurrentFollowsArgument_ShouldReturnPositive(ulong ledgerId, ulong entryId, int partition, int batchIndex)
+    {
+        var m1 = new MessageId(ledgerId, entryId, partition, batchIndex);
+        var m2 = new MessageId(1, 2, 3, 4);
 
-            m1.CompareTo(m2).Should().BePositive();
-            (m1 > m2).Should().BeTrue();
-            (m1 < m2).Should().BeFalse();
-        }
+        m1.CompareTo(m2).Should().BePositive();
+        (m1 > m2).Should().BeTrue();
+        (m1 < m2).Should().BeFalse();
+    }
 
-        [Theory]
-        [InlineData(0, 2, 3, 4)] // LegderId is less
-        [InlineData(1, 1, 3, 4)] // EntryId is less
-        [InlineData(1, 2, 2, 4)] // Partition is less
-        [InlineData(1, 2, 3, 3)] // BatchIndex is less
-        public void CompareTo_GivenCurrentPrecedesArgument_ShouldReturnNegative(ulong ledgerId, ulong entryId, int partition, int batchIndex)
-        {
-            var m1 = new MessageId(ledgerId, entryId, partition, batchIndex);
-            var m2 = new MessageId(1, 2, 3, 4);
+    [Theory]
+    [InlineData(0, 2, 3, 4)] // LegderId is less
+    [InlineData(1, 1, 3, 4)] // EntryId is less
+    [InlineData(1, 2, 2, 4)] // Partition is less
+    [InlineData(1, 2, 3, 3)] // BatchIndex is less
+    public void CompareTo_GivenCurrentPrecedesArgument_ShouldReturnNegative(ulong ledgerId, ulong entryId, int partition, int batchIndex)
+    {
+        var m1 = new MessageId(ledgerId, entryId, partition, batchIndex);
+        var m2 = new MessageId(1, 2, 3, 4);
 
-            m1.CompareTo(m2).Should().BeNegative();
-            (m1 < m2).Should().BeTrue();
-            (m1 > m2).Should().BeFalse();
-        }
+        m1.CompareTo(m2).Should().BeNegative();
+        (m1 < m2).Should().BeTrue();
+        (m1 > m2).Should().BeFalse();
+    }
 
-        [Fact]
-        public void Equals_GivenTheSameObject_ShouldBeEqual()
-        {
-            var m1 = new MessageId(1, 2, 3, 4);
-            var m2 = m1;
+    [Fact]
+    public void Equals_GivenTheSameObject_ShouldBeEqual()
+    {
+        var m1 = new MessageId(1, 2, 3, 4);
+        var m2 = m1;
 
-            m1.Equals(m2).Should().BeTrue();
-            (m1 == m2).Should().BeTrue();
-            (m1 != m2).Should().BeFalse();
-        }
+        m1.Equals(m2).Should().BeTrue();
+        (m1 == m2).Should().BeTrue();
+        (m1 != m2).Should().BeFalse();
+    }
 
-        [Fact]
-        public void Equals_GivenTheSameValues_ShouldBeEqual()
-        {
-            var m1 = new MessageId(1, 2, 3, 4);
-            var m2 = new MessageId(1, 2, 3, 4);
+    [Fact]
+    public void Equals_GivenTheSameValues_ShouldBeEqual()
+    {
+        var m1 = new MessageId(1, 2, 3, 4);
+        var m2 = new MessageId(1, 2, 3, 4);
 
-            m1.Equals(m2).Should().BeTrue();
-            (m1 == m2).Should().BeTrue();
-            (m1 != m2).Should().BeFalse();
-        }
+        m1.Equals(m2).Should().BeTrue();
+        (m1 == m2).Should().BeTrue();
+        (m1 != m2).Should().BeFalse();
+    }
 
-        [Theory]
-        [InlineData(0, 2, 3, 4)] // LegerId not the same
-        [InlineData(1, 0, 3, 4)] // EntryId not the same
-        [InlineData(1, 2, 0, 4)] // Partition not the same
-        [InlineData(1, 2, 3, 0)] // BatchIndex not the same
-        public void Equals_GivenDifferentValues_ShouldNotBeEqual(ulong ledgerId, ulong entryId, int partition, int batchIndex)
-        {
-            var m1 = new MessageId(ledgerId, entryId, partition, batchIndex);
-            var m2 = new MessageId(1, 2, 3, 4);
+    [Theory]
+    [InlineData(0, 2, 3, 4)] // LegerId not the same
+    [InlineData(1, 0, 3, 4)] // EntryId not the same
+    [InlineData(1, 2, 0, 4)] // Partition not the same
+    [InlineData(1, 2, 3, 0)] // BatchIndex not the same
+    public void Equals_GivenDifferentValues_ShouldNotBeEqual(ulong ledgerId, ulong entryId, int partition, int batchIndex)
+    {
+        var m1 = new MessageId(ledgerId, entryId, partition, batchIndex);
+        var m2 = new MessageId(1, 2, 3, 4);
 
-            m1.Equals(m2).Should().BeFalse();
-            (m1 == m2).Should().BeFalse();
-            (m1 != m2).Should().BeTrue();
-        }
+        m1.Equals(m2).Should().BeFalse();
+        (m1 == m2).Should().BeFalse();
+        (m1 != m2).Should().BeTrue();
+    }
 
-        [Fact]
-        public void Equals_GivenAllNull_ShouldBeEqual()
-        {
-            MessageId m1 = null;
-            MessageId m2 = null;
+    [Fact]
+    public void Equals_GivenAllNull_ShouldBeEqual()
+    {
+        MessageId m1 = null;
+        MessageId m2 = null;
 
-            (m1 == m2).Should().BeTrue();
-            (m1 is null).Should().BeTrue();
-            (m1 != m2).Should().BeFalse();
-        }
+        (m1 == m2).Should().BeTrue();
+        (m1 is null).Should().BeTrue();
+        (m1 != m2).Should().BeFalse();
+    }
 
-        [Fact]
-        public void Equals_GivenOneNull_ShouldNotBeEqual()
-        {
-            var m1 = new MessageId(1, 2, 3, 4);
-            MessageId m2 = null;
+    [Fact]
+    public void Equals_GivenOneNull_ShouldNotBeEqual()
+    {
+        var m1 = new MessageId(1, 2, 3, 4);
+        MessageId m2 = null;
 
-            (m1 is null).Should().BeFalse();
-            (m1 == m2).Should().BeFalse();
-            m1.Equals(m2).Should().BeFalse();
-            (m1 != m2).Should().BeTrue();
-        }
+        (m1 is null).Should().BeFalse();
+        (m1 == m2).Should().BeFalse();
+        m1.Equals(m2).Should().BeFalse();
+        (m1 != m2).Should().BeTrue();
     }
 }