lhotari commented on code in PR #24663:
URL: https://github.com/apache/pulsar/pull/24663#discussion_r2298559231
##########
pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java:
##########
@@ -1548,4 +1548,50 @@ public void
testDeadLetterTopicWithMaxUnackedMessagesBlocking() throws Exception
consumer.close();
}
+
+ // reproduce issue reported in
https://github.com/apache/pulsar/issues/24541
+ @Test
+ public void sendDeadLetterTopicWithMismatchSchemaProducer() throws
Exception {
+ String namespace = BrokerTestUtil.newUniqueName("my-property/my-ns");
+ admin.namespaces().createNamespace(namespace);
+ // don't enforce schema validation
+ admin.namespaces().setSchemaValidationEnforced(namespace, false);
+ // set schema compatibility strategy to always compatible
+ admin.namespaces().setSchemaCompatibilityStrategy(namespace,
SchemaCompatibilityStrategy.ALWAYS_COMPATIBLE);
+ String topic = BrokerTestUtil.newUniqueName("persistent://" + namespace
+ + "/sendDeadLetterTopicWithMismatchSchemaProducer");
+
+ // create topics
+ admin.topics().createNonPartitionedTopic(topic);
+ admin.topics().createNonPartitionedTopic(topic + "-DLQ");
+ admin.topics().createNonPartitionedTopic(topic + "-RETRY");
+
+ final int maxRedeliverCount = 1;
+ final String subscriptionName = "my-subscription";
+ Consumer<String> consumer =
pulsarClient.newConsumer(Schema.AVRO(String.class))
+ .topic(topic)
+ .subscriptionType(SubscriptionType.Shared)
+ .subscriptionName(subscriptionName)
+ .deadLetterPolicy(DeadLetterPolicy.builder()
+ .deadLetterTopic(topic + "-DLQ")
+ .retryLetterTopic(topic + "-RETRY")
+ .maxRedeliverCount(maxRedeliverCount)
+ .build())
+ .negativeAckRedeliveryDelay(1, TimeUnit.SECONDS)
+ .messageListener((Consumer::negativeAcknowledge))
Review Comment:
code style: there are unnecessary double parenthesis here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]