Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve][client] PIP-393: Support configuring NegativeAckPrecisionBitCnt while building consumer. #23804

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
support for config NegativeAckPrecisionBitCnt when create consumer.
  • Loading branch information
thetumbled committed Jan 3, 2025
commit 1bfcddfc05364fd813745a9d6130fd23db3156e1
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,19 @@ public interface ConsumerBuilder<T> extends Cloneable {
*/
ConsumerBuilder<T> negativeAckRedeliveryDelay(long redeliveryDelay, TimeUnit timeUnit);

/**
* Sets the redelivery time precision bit count. The lower bits of the redelivery time will be
* trimmed to reduce the memory occupation. The default value is 8, which means the redelivery time
* will be bucketed by 256ms, the redelivery time could be earlier(no later) than the expected time,
* but no more than 256ms. If set to k, the redelivery time will be bucketed by 2^k ms.
* If the value is 0, the redelivery time will be accurate to ms.
*
* @param negativeAckPrecisionBitCnt
* The redelivery time precision bit count.
* @return the consumer builder instance
*/
ConsumerBuilder<T> negativeAckPrecisionBitCnt(int negativeAckPrecisionBitCnt);
thetumbled marked this conversation as resolved.
Show resolved Hide resolved

/**
* Select the subscription type to be used when subscribing to a topic.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ public ConsumerBuilder<T> negativeAckRedeliveryDelay(long redeliveryDelay, TimeU
return this;
}

@Override
public ConsumerBuilder<T> negativeAckPrecisionBitCnt(int negativeAckPrecisionBitCnt) {
checkArgument(negativeAckPrecisionBitCnt>= 0, "negativeAckPrecisionBitCnt needs to be >= 0");
conf.setNegativeAckPrecisionBitCnt(negativeAckPrecisionBitCnt);
return this;
}

@Override
public ConsumerBuilder<T> subscriptionType(@NonNull SubscriptionType subscriptionType) {
conf.setSubscriptionType(subscriptionType);
Expand Down
Loading