You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "shashank (Jira)" <ji...@apache.org> on 2026/10/23 01:42:00 UTC
[jira] [Created] (CAMEL-26046) camel-pulsar - deadLetterTopic is ignored with enableRetry=true, and enableRetry without maxRedeliverCount fails with a NullPointerException
shashank created CAMEL-26046:
--------------------------------
Summary: camel-pulsar - deadLetterTopic is ignored with enableRetry=true, and enableRetry without maxRedeliverCount fails with a NullPointerException
Key: CAMEL-26046
URL: https://issues.apache.org/jira/browse/CAMEL-26046
Project: Camel
Issue Type: Bug
Components: camel-pulsar
Reporter: shashank
Assignee: shashank
With {{enableRetry=true}}, {{CommonCreationStrategyImpl.getBuilder}} builds the {{DeadLetterPolicy}} with {{maxRedeliverCount}} and {{retryLetterTopic}}, but not with {{deadLetterTopic}}; only the branch without retry mode copies it (main 9f839f4bcc9d, since CAMEL-17840). In pulsar-client 4.2.4, {{ConsumerBuilderImpl.subscribeAsync}} in retry mode replaces a blank dead letter topic of the policy with its default {{<topic>-<subscription>-DLQ}} (or {{<subscription>-DLQ}} when that topic exists), and keeps a non-blank one. So a message that failed {{maxRedeliverCount}} times (Camel negatively acknowledges a failed exchange) goes to the default topic, not to the configured {{deadLetterTopic}}, and the route that reads the configured topic never sees it. In the same branch, {{enableRetry=true}} without {{maxRedeliverCount}} unboxes a null {{Integer}} into {{DeadLetterPolicyBuilder.maxRedeliverCount(int)}}, and the consumer fails to start with a {{NullPointerException}}.
*Fix*: in retry mode the configured {{deadLetterTopic}} is set on the policy, and without {{maxRedeliverCount}} no policy is created, as the option description says, so the consumer starts and the Pulsar client applies its own retry-mode policy (in 4.2.4: {{maxRedeliverCount(16)}} with the default retry letter and dead letter topics). As without retry mode, the topics only apply when {{maxRedeliverCount}} is set. Without retry mode nothing changes. Upgrade guide (4.24) entry.
*Tests*: new {{CommonCreationStrategyImplTest}}, 6 tests, on the real Pulsar {{ConsumerBuilderImpl}} (a {{PulsarClient}} for {{pulsar://localhost:6650}}, which does not connect before a subscribe) and its {{ConsumerConfigurationData}}.
* {{retryModeUsesTheConfiguredDeadLetterTopic}} fails on main: {{the dead letter topic must be passed to the Pulsar client in retry mode ==> expected: <persistent://public/default/my-dlq> but was: <null>}};
* {{retryModeWithoutMaxRedeliverCountLeavesThePolicyToThePulsarClient}} and {{retryModeWithoutMaxRedeliverCountIgnoresTheTopicsAsWithoutRetryMode}} fail on main with the {{NullPointerException}};
* three controls (retry mode without topics, dead letter mode, no policy without maxRedeliverCount) pass on main and with the fix.
Unit tests of camel-pulsar with the fix: 40 run, 0 failures.
*How it was found*: checking option descriptions against the code (doc-claim mining), and the retry-mode defaulting read from the pulsar-client 4.2.4 jar ({{ConsumerBuilderImpl}}, {{ConsumerImpl}}).
*Affected*: main, camel-4.23.x, camel-4.22.x and camel-4.18.x (same code). Read, not run.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)