Skip to content

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

Open
Dream95 wants to merge 1 commit into
apache:masterfrom
Dream95:fix_23941
Open

[fix][broker] Send ActiveConsumerChange for non-persistent Failover subscriptions#26482
Dream95 wants to merge 1 commit into
apache:masterfrom
Dream95:fix_23941

Conversation

@Dream95

@Dream95 Dream95 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #23491

Main Issue: #xyz

PIP: #xyz

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

…ubscriptions

Signed-off-by: Dream95 <zhou_8621@163.com>
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.

Use admin to create a nonpersistent topic whose name contains -partition-, the topic can be created successfully

1 participant