Skip to content

[fix][broker] Send ActiveConsumerChange for non-persistent Failover subscriptions - #26482

Merged
lhotari merged 1 commit into
apache:masterfrom
Dream95:fix_23941
Sep 12, 2026
Merged

lhotari merged 1 commit into
apache:masterfrom
Dream95:fix_23941

Conversation

@Dream95

@Dream95 Dream95 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #23941

Motivation

Non-persistent Failover subscriptions did not send ActiveConsumerChange when the active consumer changed. PersistentDispatcherSingleActiveConsumer calls notifyActiveConsumerChanged() from scheduleReadOnActiveConsumer(); in the non-persistent path that method was a no-op.

Clients using ConsumerEventListener on non-persistent Failover topics therefore never got becameActive / becameInactive on failover.

Modifications

In NonPersistentDispatcherSingleActiveConsumer.scheduleReadOnActiveConsumer(), call notifyActiveConsumerChanged(getActiveConsumer()). Non-persistent topics have no cursor, so there is no rewind/read step like on persistent topics.
Extend NonPersistentDispatcherFailoverConsumerTest for add/remove failover, priority-based active selection, and adding a consumer to a closed dispatcher.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

NonPersistentDispatcherFailoverConsumerTest.testActiveConsumerChangeNotifications
NonPersistentDispatcherFailoverConsumerTest.testHigherPriorityConsumerBecomesActive
NonPersistentDispatcherFailoverConsumerTest.testAddConsumerWhenClosed

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

@Dream95

Dream95 commented Sep 12, 2026

Copy link
Copy Markdown
Contributor Author

/pulsarbot rerun-failure-checks

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for working on this fix. The dispatcher now reports active-consumer changes for non-persistent Failover subscriptions, and the focused tests cover selection, failover, priority, inactive removal, and closed-dispatcher behavior.

@lhotari lhotari added this to the 5.0.0-M2 milestone Sep 12, 2026
@lhotari
lhotari merged commit 8158339 into apache:master Sep 12, 2026
44 of 45 checks passed
lhotari pushed a commit that referenced this pull request Sep 14, 2026
…ubscriptions (#26482)

Signed-off-by: Dream95 <[email protected]>
(cherry picked from commit 8158339)
lhotari pushed a commit that referenced this pull request Sep 14, 2026
…ubscriptions (#26482)

Signed-off-by: Dream95 <[email protected]>
(cherry picked from commit 8158339)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Non-persistent failover topics are not notified on active consumer changes

2 participants