Source:
public void testOneWayReplicationWithAutorOffsetSync1() throws InterruptedException { Consumer<byte[], byte[]> consumer1 = primary.kafka().createConsumerAndSubscribeTo(Collections.singletonMap( "group.id", "consumer-group-1"), "test-topic-1"); consumer1.poll(Duration.ofMillis(500)); consumer1.commitSync(); consumer1.close(); mm2Props.put("sync.group.offsets.enabled", "true"); mm2Props.put("sync.group.offsets.interval.seconds", "1"); mm2Props.put("backup->primary.enabled", "false"); mm2Config = new MirrorMakerConfig(mm2Props); waitUntilMirrorMakerIsRunning(backup, mm2Config, "primary", "backup"); time.sleep(5000); Consumer<byte[], byte[]> consumer = backup.kafka().createConsumerAndSubscribeTo( Collections.singletonMap("group.id", "consumer-group-1"), "primary.test-topic-1"); ConsumerRecords records = consumer.poll(Duration.ofMillis(500)); assertTrue("consumer record size is not zero", records.count() == 0); primary.kafka().createTopic("test-topic-2", NUM_PARTITIONS); backup.kafka().createTopic("primary.test-topic-2", 1); for (int i = 0; i < NUM_RECORDS_PRODUCED; i++) { primary.kafka().produce("test-topic-2", i % NUM_PARTITIONS, "key", "message-1-" + i); } consumer1 = primary.kafka().createConsumerAndSubscribeTo(Collections.singletonMap( "group.id", "consumer-group-1"), "test-topic-2"); consumer1.poll(Duration.ofMillis(500)); consumer1.commitSync(); consumer1.close(); time.sleep(5000); consumer = backup.kafka().createConsumerAndSubscribeTo(Collections.singletonMap( "group.id", "consumer-group-1"), "primary.test-topic-1", "primary.test-topic-2"); records = consumer.poll(Duration.ofMillis(500)); assertTrue("consumer record size is not zero", records.count() == 0); consumer.close(); }

Target:
public void testOneWayReplicationWithAutorOffsetSync1() throws InterruptedException { Consumer<byte[], byte[]> consumer1 = primary.kafka().createConsumerAndSubscribeTo(Collections.singletonMap( "group.id", "consumer-group-1"), "test-topic-1"); consumer1.poll(Duration.ofMillis(500)); consumer1.commitSync(); consumer1.close(); mm2Props.put("sync.group.offsets.enabled", "true"); mm2Props.put("sync.group.offsets.interval.seconds", "1"); mm2Props.put("backup->primary.enabled", "false"); mm2Config = new MirrorMakerConfig(mm2Props); waitUntilMirrorMakerIsRunning(backup, mm2Config, "primary", "backup"); time.sleep(5000); Consumer<byte[], byte[]> consumer = backup.kafka().createConsumerAndSubscribeTo( Collections.singletonMap("group.id", "consumer-group-1"), "primary.test-topic-1"); ConsumerRecords records = consumer.poll(Duration.ofMillis(500)); assertEquals("consumer record size is not zero", 0, records.count()); primary.kafka().createTopic("test-topic-2", NUM_PARTITIONS); backup.kafka().createTopic("primary.test-topic-2", 1); for (int i = 0; i < NUM_RECORDS_PRODUCED; i++) { primary.kafka().produce("test-topic-2", i % NUM_PARTITIONS, "key", "message-1-" + i); } consumer1 = primary.kafka().createConsumerAndSubscribeTo(Collections.singletonMap( "group.id", "consumer-group-1"), "test-topic-2"); consumer1.poll(Duration.ofMillis(500)); consumer1.commitSync(); consumer1.close(); time.sleep(5000); consumer = backup.kafka().createConsumerAndSubscribeTo(Collections.singletonMap( "group.id", "consumer-group-1"), "primary.test-topic-1", "primary.test-topic-2"); records = consumer.poll(Duration.ofMillis(500)); assertEquals("consumer record size is not zero", 0, records.count()); consumer.close(); }