You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by rx...@apache.org on 2019/09/12 08:36:52 UTC

[pulsar-client-go] branch master updated: enable to specify the sequenceID (#62)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 11755b2  enable to specify the sequenceID (#62)
11755b2 is described below

commit 11755b26da59f58c2675708af1470fe493d92e37
Author: banishee <gl...@live.com>
AuthorDate: Thu Sep 12 16:36:47 2019 +0800

    enable to specify the sequenceID (#62)
    
    enable to specify the sequenceID
---
 pulsar/impl_partition_producer.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pulsar/impl_partition_producer.go b/pulsar/impl_partition_producer.go
index 7cfc45d..07e2da0 100644
--- a/pulsar/impl_partition_producer.go
+++ b/pulsar/impl_partition_producer.go
@@ -246,7 +246,12 @@ func (p *partitionProducer) internalSend(request *sendRequest) {
 		smm.Properties = internal.ConvertFromStringMap(msg.Properties)
 	}
 
-	sequenceID := internal.GetAndAdd(p.sequenceIDGenerator, 1)
+	var sequenceID uint64
+	if msg.SequenceID != nil {
+		sequenceID = uint64(*msg.SequenceID)
+	} else {
+		sequenceID = internal.GetAndAdd(p.sequenceIDGenerator, 1)
+	}
 
 	if sendAsBatch {
 		ok := p.batchBuilder.Add(smm, sequenceID, msg.Payload, request, msg.ReplicationClusters)