You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/23 16:26:18 UTC

[GitHub] [pulsar-client-go] EliHarper opened a new issue #736: Difficulties with KeyShared Consumers

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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-client-go] EliHarper closed issue #736: Difficulties with KeyShared Consumers: AutoSplit Causing Duplicates

Posted by GitBox <gi...@apache.org>.
EliHarper closed issue #736:
URL: https://github.com/apache/pulsar-client-go/issues/736


   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-client-go] EliHarper commented on issue #736: Difficulties with KeyShared Consumers: AutoSplit Causing Duplicates

Posted by GitBox <gi...@apache.org>.
EliHarper commented on issue #736:
URL: https://github.com/apache/pulsar-client-go/issues/736#issuecomment-1049208093


   I believe I have found my mistake - the subscriptions were not named consistently. My apologies, and thanks again.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org