EliHarper opened a new issue #736:
URL: https://github.com/apache/pulsar-client-go/issues/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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to