Source:
public void run() { boolean startingUp = true; long pollInterval = 0; _thread = Thread.currentThread(); try { DatastreamSource source = _task.getDatastreamSource(); KafkaConnectionString srcConnString = KafkaConnectionString.valueOf(source.getConnectionString()); StringJoiner csv = new StringJoiner(","); srcConnString.getBrokers().forEach(broker -> csv.add(broker.toString())); String bootstrapValue = csv.toString(); _srcValue = srcConnString.toString(); DatastreamDestination destination = _task.getDatastreamDestination(); String dstConnString = destination.getConnectionString(); _producer = _task.getEventProducer(); _taskName = srcConnString + "-to-" + dstConnString; Properties props = new Properties(); props.put("bootstrap.servers", bootstrapValue); props.put("group.id", _taskName); props.put("enable.auto.commit", "false"); props.put("auto.offset.reset", "latest"); props.put("key.deserializer", ByteArrayDeserializer.class.getCanonicalName()); props.put("value.deserializer", ByteArrayDeserializer.class.getCanonicalName()); try (KafkaConsumer<byte[], byte[]> consumer = new KafkaConsumer<>(props)) { _lastCommittedOffsets = System.currentTimeMillis(); consumer.subscribe(Collections.singletonList(srcConnString.getTopicName())); ConsumerRecords<byte[], byte[]> records; while (!_shouldDie) { records = consumer.poll(pollInterval); if (startingUp) { pollInterval = _offsetCommitInterval / 2; startingUp = false; _startedLatch.countDown(); } if (records.count() == 0) { maybeCommitOffsets(consumer); continue; } long readTime = System.currentTimeMillis(); String strReadTime = String.valueOf(readTime); while (!_shouldDie) { boolean success = translateAndSendBatch(records, readTime, strReadTime); if (success) { break; } } _didWork = true; maybeCommitOffsets(consumer); } } } finally { _stoppedLatch.countDown(); LOG.info("{} stopped", _taskName); } }

Target:
public void run() { boolean startingUp = true; long pollInterval = 0; _thread = Thread.currentThread(); try { DatastreamSource source = _task.getDatastreamSource(); KafkaConnectionString srcConnString = KafkaConnectionString.valueOf(source.getConnectionString()); StringJoiner csv = new StringJoiner(","); srcConnString.getBrokers().forEach(broker -> csv.add(broker.toString())); String bootstrapValue = csv.toString(); _srcValue = srcConnString.toString(); DatastreamDestination destination = _task.getDatastreamDestination(); String dstConnString = destination.getConnectionString(); _producer = _task.getEventProducer(); _taskName = srcConnString + "-to-" + dstConnString; Properties props = new Properties(); props.put("bootstrap.servers", bootstrapValue); props.put("group.id", _taskName); props.put("enable.auto.commit", "false"); props.put("auto.offset.reset", "latest"); props.put("key.deserializer", ByteArrayDeserializer.class.getCanonicalName()); props.put("value.deserializer", ByteArrayDeserializer.class.getCanonicalName()); try (KafkaConsumer<byte[], byte[]> consumer = new KafkaConsumer<>(props)) { _lastCommittedOffsets = System.currentTimeMillis(); consumer.subscribe(Collections.singletonList(srcConnString.getTopicName())); ConsumerRecords<byte[], byte[]> records; while (!_shouldDie) { records = consumer.poll(pollInterval); if (startingUp) { pollInterval = _offsetCommitInterval / 2; startingUp = false; _startedLatch.countDown(); } if (records.count() == 0) { maybeCommitOffsets(consumer, false); continue; } long readTime = System.currentTimeMillis(); String strReadTime = String.valueOf(readTime); while (!_shouldDie) { boolean success = translateAndSendBatch(records, readTime, strReadTime); if (success) { break; } } _workSinceLastCommit = true; maybeCommitOffsets(consumer, false); } maybeCommitOffsets(consumer, true); } } finally { _stoppedLatch.countDown(); LOG.info("{} stopped", _taskName); } }