Skip to content

Update Pulsar client from 4.1.2 to 4.2.4 - #234

Merged
onobc merged 2 commits into
apache:mainfrom
lhotari:lh-pulsar-4.2.4
Aug 4, 2026
Merged

Update Pulsar client from 4.1.2 to 4.2.4#234
onobc merged 2 commits into
apache:mainfrom
lhotari:lh-pulsar-4.2.4

Conversation

@lhotari

@lhotari lhotari commented Aug 3, 2026

Copy link
Copy Markdown
Member

This commit updates the following dependency version:

  • Pulsar from 4.1.2 to 4.2.4

Test fix required by the upgrade

Two tests in AdaptedReactiveMessageConsumerTests (keySharedPolicy and topicsPattern) started failing with didn't match expected consumer conf.

Pulsar 4.2 added the DecryptFailListener feature and changed how cryptoFailureAction is defaulted:

  • 4.1.xConsumerConfigurationData.cryptoFailureAction was initialized to ConsumerCryptoFailureAction.FAIL at field declaration.
  • 4.2.x — the field now defaults to null. ConsumerBuilderImpl.subscribeAsync rejects setting both decryptFailListener and cryptoFailureAction, and applies FAIL to the conf just before subscribing only when neither is set.

These tests stub subscribeAsync(eq(expectedConsumerConf), ...) with a ConsumerConfigurationData built by hand, falling back to a future that fails with didn't match expected consumer conf. The expected conf held null for cryptoFailureAction while the conf actually passed by the builder held FAIL, so the stub no longer matched. consumerProperties was unaffected because it sets DISCARD explicitly on both sides.

The fix sets the expected default explicitly in the two tests.

No production change

AdaptedReactiveMessageConsumer.configureConsumerBuilder correctly leaves cryptoFailureAction unset when the spec does not specify it, which lets Pulsar apply its own default. Hardcoding FAIL in the adapter would preserve current behavior but would permanently block decryptFailListener should it ever be exposed through ReactiveMessageConsumerSpec.

Verification

./gradlew check passes: 149 tests, 0 failures, 0 errors.

Pulsar 4.2 added the `DecryptFailListener` feature and changed how
`cryptoFailureAction` is defaulted. `ConsumerConfigurationData` no longer
initializes the field to `ConsumerCryptoFailureAction.FAIL`; it now defaults to
`null`, and `ConsumerBuilderImpl.subscribeAsync` applies `FAIL` at subscribe
time only when neither `cryptoFailureAction` nor `decryptFailListener` is set.

`AdaptedReactiveMessageConsumerTests` stubs `subscribeAsync` with an expected
`ConsumerConfigurationData` built by hand, so the expected conf held `null`
while the conf passed by the builder held `FAIL`. The stub no longer matched
and the tests failed with "didn't match expected consumer conf".

Set the expected default explicitly in `keySharedPolicy` and `topicsPattern`.
No production change is needed: the adapter correctly leaves
`cryptoFailureAction` unset when the spec does not specify it, which lets
Pulsar apply its own default and keeps `decryptFailListener` usable.

Signed-off-by: Lari Hotari <lhotari@users.noreply.github.com>
@onobc
onobc merged commit 4309642 into apache:main Aug 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants