You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by bl...@apache.org on 2023/04/19 08:33:17 UTC

[pulsar-dotpulsar] branch master updated: Feature/object pooling issue (#148)

This is an automated email from the ASF dual-hosted git repository.

blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 895a4e8  Feature/object pooling issue (#148)
895a4e8 is described below

commit 895a4e8b79d888a487d6d1a8f7e41044d8159129
Author: Kristian Andersen <ka...@users.noreply.github.com>
AuthorDate: Wed Apr 19 10:33:11 2023 +0200

    Feature/object pooling issue (#148)
    
    * Reset sequenceId before returning to pool for reuse
    
    All other fields will not be sent when using the Send Extension methods and should therefore not have a value that needs to be reset.
    
    * Remove wrong ack ordering state
    
    WrongAckOrdering is an event. The resulting state is "Disconnected"
    
    * Add changelog entry
---
 CHANGELOG.md                                      | 10 ++++++++++
 src/DotPulsar/Extensions/SendChannelExtensions.cs |  1 +
 src/DotPulsar/Extensions/SendExtensions.cs        |  1 +
 src/DotPulsar/Internal/Abstractions/Process.cs    |  2 --
 src/DotPulsar/Internal/ChannelState.cs            |  1 -
 src/DotPulsar/Internal/ProducerProcess.cs         |  1 -
 6 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81c3a7e..b6e6976 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [2.12.0] - ?
+
+### Added
+
+- Support `ProducerAccessMode` to prevent multiple producers on a single topic.
+
+### Fixed
+
+- Fixed issue with `Send` extension methods that do include `MessageMetadata` in the parameter list. The issue prevents more than two messages from being published on namespaces where deduplication is enabled.
+
 ## [2.11.0] - 2023-03-13
 
 ### Added
diff --git a/src/DotPulsar/Extensions/SendChannelExtensions.cs b/src/DotPulsar/Extensions/SendChannelExtensions.cs
index 93ea2f1..046e18d 100644
--- a/src/DotPulsar/Extensions/SendChannelExtensions.cs
+++ b/src/DotPulsar/Extensions/SendChannelExtensions.cs
@@ -67,6 +67,7 @@ public static class SendChannelExtensions
 
         async ValueTask ReleaseMetadataAndCallCallback(MessageId id)
         {
+            metadata.Metadata.SequenceId = 0;
             metadata.Metadata.Properties.Clear();
             _messageMetadataPool.Return(metadata);
 
diff --git a/src/DotPulsar/Extensions/SendExtensions.cs b/src/DotPulsar/Extensions/SendExtensions.cs
index 00eef33..055b5fa 100644
--- a/src/DotPulsar/Extensions/SendExtensions.cs
+++ b/src/DotPulsar/Extensions/SendExtensions.cs
@@ -71,6 +71,7 @@ public static class SendExtensions
         }
         finally
         {
+            metadata.Metadata.SequenceId = 0;
             metadata.Metadata.Properties.Clear();
             _messageMetadataPool.Return(metadata);
         }
diff --git a/src/DotPulsar/Internal/Abstractions/Process.cs b/src/DotPulsar/Internal/Abstractions/Process.cs
index 51176cc..f6d42c5 100644
--- a/src/DotPulsar/Internal/Abstractions/Process.cs
+++ b/src/DotPulsar/Internal/Abstractions/Process.cs
@@ -62,8 +62,6 @@ public abstract class Process : IProcess
                 ChannelState = ChannelState.Inactive;
                 break;
             case SendReceiptWrongOrdering _:
-                ChannelState = ChannelState.WrongAckOrdering;
-                break;
             case ChannelDisconnected _:
                 ChannelState = ChannelState.Disconnected;
                 break;
diff --git a/src/DotPulsar/Internal/ChannelState.cs b/src/DotPulsar/Internal/ChannelState.cs
index 642de24..9b1bffe 100644
--- a/src/DotPulsar/Internal/ChannelState.cs
+++ b/src/DotPulsar/Internal/ChannelState.cs
@@ -19,7 +19,6 @@ public enum ChannelState : byte
     ClosedByServer,
     Connected,
     Disconnected,
-    WrongAckOrdering,
     ReachedEndOfTopic,
     Active,
     Inactive,
diff --git a/src/DotPulsar/Internal/ProducerProcess.cs b/src/DotPulsar/Internal/ProducerProcess.cs
index 3f19872..4ff3671 100644
--- a/src/DotPulsar/Internal/ProducerProcess.cs
+++ b/src/DotPulsar/Internal/ProducerProcess.cs
@@ -60,7 +60,6 @@ public sealed class ProducerProcess : Process
         {
             case ChannelState.ClosedByServer:
             case ChannelState.Disconnected:
-            case ChannelState.WrongAckOrdering:
                 _stateManager.SetState(ProducerState.Disconnected);
                 _actionQueue.Enqueue(async x =>
                 {