enable to specify the sequenceID (#62)
enable to specify the sequenceID
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 @@
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)