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

[Issue 1223] Support ZeroQueueConsumer #1225

Merged
merged 7 commits into from
Jun 26, 2024

Conversation

crossoverJie
Copy link
Member

Fixes #1223

Motivation

Support ZeroQueueConsumer, refer to Java ZeroQueueConsumerImpl

Modifications

  • The consumer add a new optional parameter EnableZeroQueueConsumer
  • Add a new zeroQueueConsumer

Verifying this change

  • Make sure that the change passes the CI checks.

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: (yes)
  • The schema: (no)
  • The default values of configurations: (yes)
  • The wire protocol: (no)

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? (GoDocs)
  • 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

@crossoverJie
Copy link
Member Author

@RobertIndie PTAL, thanks.

pulsar/consumer_impl.go Show resolved Hide resolved
Comment on lines 76 to 107
opts := &partitionConsumerOpts{
topic: zc.topic,
consumerName: zc.consumerName,
subscription: zc.options.SubscriptionName,
subscriptionType: zc.options.Type,
subscriptionInitPos: zc.options.SubscriptionInitialPosition,
partitionIdx: 0,
receiverQueueSize: zc.options.ReceiverQueueSize,
nackRedeliveryDelay: nackRedeliveryDelay,
nackBackoffPolicy: zc.options.NackBackoffPolicy,
metadata: zc.options.Properties,
subProperties: zc.options.SubscriptionProperties,
replicateSubscriptionState: zc.options.ReplicateSubscriptionState,
startMessageID: zc.options.startMessageID,
startMessageIDInclusive: zc.options.StartMessageIDInclusive,
subscriptionMode: zc.options.SubscriptionMode,
readCompacted: zc.options.ReadCompacted,
interceptors: zc.options.Interceptors,
maxReconnectToBroker: zc.options.MaxReconnectToBroker,
backoffPolicy: zc.options.BackoffPolicy,
keySharedPolicy: zc.options.KeySharedPolicy,
schema: zc.options.Schema,
decryption: zc.options.Decryption,
ackWithResponse: zc.options.AckWithResponse,
maxPendingChunkedMessage: zc.options.MaxPendingChunkedMessage,
expireTimeOfIncompleteChunk: zc.options.ExpireTimeOfIncompleteChunk,
autoAckIncompleteChunk: zc.options.AutoAckIncompleteChunk,
consumerEventListener: zc.options.EventListener,
enableBatchIndexAck: zc.options.EnableBatchIndexAcknowledgment,
ackGroupingOptions: zc.options.AckGroupingOptions,
autoReceiverQueueSize: zc.options.EnableAutoScaledReceiverQueueSize,
}
Copy link
Member

Choose a reason for hiding this comment

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

Could we abstract this logic so that we can reuse the code?

opts := &partitionConsumerOpts{
topic: pt,
consumerName: c.consumerName,
subscription: c.options.SubscriptionName,
subscriptionType: c.options.Type,
subscriptionInitPos: c.options.SubscriptionInitialPosition,
partitionIdx: idx,
receiverQueueSize: receiverQueueSize,
nackRedeliveryDelay: nackRedeliveryDelay,
nackBackoffPolicy: c.options.NackBackoffPolicy,
metadata: metadata,
subProperties: subProperties,
replicateSubscriptionState: c.options.ReplicateSubscriptionState,
startMessageID: c.options.startMessageID,
startMessageIDInclusive: c.options.StartMessageIDInclusive,
subscriptionMode: c.options.SubscriptionMode,
readCompacted: c.options.ReadCompacted,
interceptors: c.options.Interceptors,
maxReconnectToBroker: c.options.MaxReconnectToBroker,
backoffPolicy: c.options.BackoffPolicy,
keySharedPolicy: c.options.KeySharedPolicy,
schema: c.options.Schema,
decryption: c.options.Decryption,
ackWithResponse: c.options.AckWithResponse,
maxPendingChunkedMessage: c.options.MaxPendingChunkedMessage,
expireTimeOfIncompleteChunk: c.options.ExpireTimeOfIncompleteChunk,
autoAckIncompleteChunk: c.options.AutoAckIncompleteChunk,
consumerEventListener: c.options.EventListener,
enableBatchIndexAck: c.options.EnableBatchIndexAcknowledgment,
ackGroupingOptions: c.options.AckGroupingOptions,
autoReceiverQueueSize: c.options.EnableAutoScaledReceiverQueueSize,

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, done.

pulsar/consumer_zero_queue.go Outdated Show resolved Hide resolved
pulsar/consumer_zero_queue_test.go Show resolved Hide resolved
@crossoverJie crossoverJie requested a review from RobertIndie June 14, 2024 01:56
@crossoverJie crossoverJie self-assigned this Jun 24, 2024
@RobertIndie RobertIndie merged commit aa090be into apache:master Jun 26, 2024
8 checks passed
@RobertIndie RobertIndie added this to the v0.13.0 milestone Jun 27, 2024
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.

[Question]Zero value of ReceiverQueueSize
2 participants