This is an automated email from the ASF dual-hosted git repository.
xyz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new 7891ac5 Disable batch send for dlq producer. (#403)
7891ac5 is described below
commit 7891ac569eeca8e8cfeedf4ee005a26f98a0ca71
Author: Baodi Shi <[email protected]>
AuthorDate: Mon Feb 19 10:18:11 2024 +0800
Disable batch send for dlq producer. (#403)
---
lib/ConsumerImpl.cc | 1 +
tests/DeadLetterQueueTest.cc | 2 ++
2 files changed, 3 insertions(+)
diff --git a/lib/ConsumerImpl.cc b/lib/ConsumerImpl.cc
index 0051ed6..4181f05 100644
--- a/lib/ConsumerImpl.cc
+++ b/lib/ConsumerImpl.cc
@@ -1736,6 +1736,7 @@ void ConsumerImpl::processPossibleToDLQ(const MessageId&
messageId, ProcessDLQCa
ProducerConfiguration producerConfiguration;
producerConfiguration.setSchema(config_.getSchema());
producerConfiguration.setBlockIfQueueFull(false);
+ producerConfiguration.setBatchingEnabled(false);
producerConfiguration.impl_->initialSubscriptionName =
deadLetterPolicy_.getInitialSubscriptionName();
ClientImplPtr client = client_.lock();
diff --git a/tests/DeadLetterQueueTest.cc b/tests/DeadLetterQueueTest.cc
index 1a747cc..06cd196 100644
--- a/tests/DeadLetterQueueTest.cc
+++ b/tests/DeadLetterQueueTest.cc
@@ -270,6 +270,8 @@ TEST_P(DeadLetterQueueTest,
testSendDLQTriggerByRedeliverUnacknowledgedMessages)
ASSERT_EQ(msg.getPartitionKey(), "p-key");
ASSERT_EQ(msg.getOrderingKey(), "o-key");
ASSERT_EQ(msg.getProperty("pk-1"), "pv-1");
+ ASSERT_EQ(msg.getMessageId().batchSize(), 0);
+ ASSERT_EQ(msg.getMessageId().batchIndex(), -1);
ASSERT_TRUE(msg.getProperty(SYSTEM_PROPERTY_REAL_TOPIC).find(topic_));
ASSERT_FALSE(msg.getProperty(PROPERTY_ORIGIN_MESSAGE_ID).empty());
}