Skip to content

Commit

Permalink
[fix][client] Create the retry producer async (apache#23157)
Browse files Browse the repository at this point in the history
Co-authored-by: Ómar Yasin <omarkj@apple.com>
(cherry picked from commit a025938)
(cherry picked from commit f2e1920)
  • Loading branch information
omarkj authored and nikhil-ctds committed Aug 16, 2024
1 parent a469492 commit 93f0546
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,25 @@ private void initRetryLetterProducerIfNeeded() {
}
}

private void initRetryLetterProducerIfNeeded() {
if (retryLetterProducer == null) {
createProducerLock.writeLock().lock();
try {
if (retryLetterProducer == null) {
retryLetterProducer = client
.newProducer(Schema.AUTO_PRODUCE_BYTES(schema))
.topic(this.deadLetterPolicy.getRetryLetterTopic())
.enableBatching(false)
.enableChunking(true)
.blockIfQueueFull(false)
.createAsync();
}
} finally {
createProducerLock.writeLock().unlock();
}
}
}

@Override
public void seek(MessageId messageId) throws PulsarClientException {
try {
Expand Down

0 comments on commit 93f0546

Please sign in to comment.