zhouyangang edited a comment on issue #5840: Subscription mode Key_Shared not working as expected URL: https://github.com/apache/pulsar/issues/5840#issuecomment-568909235 i have met this problem also.... finally, i find when use Key_Shared subscription mode, the producer must set like this: ` private Producer<Integer> createProducer(String topic, boolean enableBatch) throws PulsarClientException { Producer<Integer> producer = null; if (enableBatch) { producer = pulsarClient.newProducer(Schema.INT32) .topic(topic) .enableBatching(true) .batcherBuilder(BatcherBuilder.KEY_BASED) .create(); } else { producer = pulsarClient.newProducer(Schema.INT32) .topic(topic) .enableBatching(false) .create(); } return producer; }` because producer enable batching by default, so you must set batcherBuilder(BatcherBuilder.KEY_BASED) when use Key_Shared mode.
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
