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-736: Difficulties with KeyShared Consumers: AutoSplit Causing Duplicates #264

Open
sijie opened this issue Feb 23, 2022 · 0 comments

Comments

@sijie
Copy link
Member

sijie commented Feb 23, 2022

Original Issue: apache#736


When creating KeyShared Consumers, I have found that all messages published to their topic are consumed by each consumer, resulting in duplicates of each message published to their topic.

I was unable to find Go client documentation that covered Consumer configurations with a KeyShared type. I believe I would like to use the KeySharedPolicyModeAutoSplit, since it seems to cover most use cases.

Please let me know if there is any additional configuration needed to get past this issue - here is my consumer creation code:

properties := make(map[string]string)
jsonSchemaWithProperties := pulsar.NewJSONSchema(schema, properties)

consumer, err := client.Subscribe(pulsar.ConsumerOptions{ Topic: topic, SubscriptionName: subscriptionName, Schema: jsonSchemaWithProperties, Type: pulsar.KeyShared, KeySharedPolicy: &pulsar.KeySharedPolicy{ Mode: pulsar.KeySharedPolicyModeAutoSplit, }, })

And the producer that publishes to the topic:

properties := make(map[string]string)
jsonSchemaWithProperties := pulsar.NewJSONSchema(schema, properties)

producer, err := client.CreateProducer(pulsar.ProducerOptions{ Topic: topic, Schema: jsonSchemaWithProperties, HashingScheme: pulsar.Murmur3_32Hash, BatcherBuilderType: pulsar.KeyBasedBatchBuilder, })

Thank you in advance for any guidance and feedback you're able to provide.

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

No branches or pull requests

1 participant