Skip to content

Commit

Permalink
support DisableReplication
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuto Furuta committed Jun 16, 2021
1 parent f17deac commit bc70f04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pulsar/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ type ProducerMessage struct {
// ReplicationClusters override the replication clusters for this message.
ReplicationClusters []string

// Disable the replication for this message
DisableReplication bool

// SequenceID set the sequence id to assign to the current message
SequenceID *int64

Expand Down
5 changes: 5 additions & 0 deletions pulsar/producer_partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ func (p *partitionProducer) internalSend(request *sendRequest) {
if !sendAsBatch {
p.internalFlushCurrentBatch()
}

if msg.DisableReplication {
msg.ReplicationClusters = [] string{"__local__"}
}

added := p.batchBuilder.Add(smm, p.sequenceIDGenerator, payload, request,
msg.ReplicationClusters, deliverAt)
if !added {
Expand Down

0 comments on commit bc70f04

Please sign in to comment.