-
Notifications
You must be signed in to change notification settings - Fork 157
Closed
Labels
Description
Parallel Consumer wrapper does not work with MockConsumer. It keeps on skipping messages with error message "Record in buffer for a partition no longer assigned. Dropping."
mockconsumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST);
HashMap<TopicPartition, Long> startOffsets = new HashMap<>();
TopicPartition tp = new TopicPartition(topic, 0);
startOffsets.put(tp, 0L);
mockconsumer.updateBeginningOffsets(startOffsets);
mockconsumer.schedulePollTask(() -> {
mockconsumer.subscribe(Arrays.asList(new String[] {topic}));
/* Tried this one as well
mockconsumer.subscribe(Arrays.asList(new String[] {topic}), (ParallelEoSStreamProcessor)eosStreamProcessor);
*/
mockconsumer.rebalance(Collections.singletonList(new TopicPartition(topic, 0)) );
});
... doesn't work without scheduled task also
mockconsumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST);
HashMap<TopicPartition, Long> startOffsets = new HashMap<>();
TopicPartition tp = new TopicPartition(topic, 0);
startOffsets.put(tp, 0L);
mockconsumer.updateBeginningOffsets(startOffsets);
mockconsumer.subscribe(Arrays.asList(new String[] {topic}));
/* Tried this one as well
mockconsumer.subscribe(Arrays.asList(new String[] {topic}), (ParallelEoSStreamProcessor)eosStreamProcessor);
*/
mockconsumer.rebalance(Collections.singletonList(new TopicPartition(topic, 0)) );
Above code works fine without ParallelStreamProcessor
and done polling directly on consumer.