Skip to content

ZeroQueueConsumer is not supported with RetryEnable#1391

Merged
BewareMyPower merged 2 commits into
apache:masterfrom
crossoverJie:fix-1319
Jul 23, 2025
Merged

ZeroQueueConsumer is not supported with RetryEnable#1391
BewareMyPower merged 2 commits into
apache:masterfrom
crossoverJie:fix-1319

Conversation

@crossoverJie

Copy link
Copy Markdown
Member

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #1319

Modifications

https://github.com/apache/pulsar/blob/89167308709cf72d3f2731bad1bb30384f80abb4/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java#L148-L149

We need to be consistent with the Java Client; ZeroQueueConsumer does not support use with RetryEnable.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

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

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable / docs / GoDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

@BewareMyPower

Copy link
Copy Markdown
Contributor

https://github.com/apache/pulsar/blob/89167308709cf72d3f2731bad1bb30384f80abb4/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java#L148-L149

        checkArgument(conf.getReceiverQueueSize() > 0,
            "Receiver queue size needs to be greater than 0 for Topics Consumer");

This assertion disallows the receiver queue size as 0 for a multi-topics consumer. It seems not related to this PR?

@crossoverJie

crossoverJie commented Jul 14, 2025

Copy link
Copy Markdown
Member Author

apache/pulsar@8916730/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java#L148-L149

        checkArgument(conf.getReceiverQueueSize() > 0,
            "Receiver queue size needs to be greater than 0 for Topics Consumer");

This assertion disallows the receiver queue size as 0 for a multi-topics consumer. It seems not related to this PR?

In the Java client, setting receiverQueueSize to 0 will create a ZeroQueueConsumer; additionally, if RetryEnable is enabled, a MultiTopicsConsumer will be created. therefore, it is necessary to check the size of receiverQueueSize in MultiTopicsConsumer.

In the Go client, if RetryEnable is enabled in ZeroQueueConsumer, a MultiTopicConsumer will also be created. In this case, ReceiverQueueSize being equal to 0 will result in message data not being received.

The only difference from the Java Client is that the validation conditions are moved forward to the consumer creation stage.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds validation to prevent the incompatible combination of RetryEnable and EnableZeroQueueConsumer options, maintaining consistency with the Java Pulsar client implementation.

  • Adds early validation in the consumer constructor to reject incompatible configuration
  • Includes test coverage to verify the validation works correctly

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pulsar/consumer_impl.go Adds validation logic to reject RetryEnable + EnableZeroQueueConsumer combination
pulsar/consumer_zero_queue_test.go Adds test case to verify the validation error is properly returned
Comments suppressed due to low confidence (1)

Comment thread pulsar/consumer_zero_queue_test.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@BewareMyPower BewareMyPower merged commit 7f7fb43 into apache:master Jul 23, 2025
7 checks 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.

EnableZeroQueueConsumer fails with RetryEnable true or a DLQ policy

3 participants