Source:
protected void sendDatastreamProducerRecord(DatastreamProducerRecord datastreamProducerRecord, TopicPartition srcTopicPartition, int numBytes, SendCallback sendCallback) { if (_isFlushlessModeEnabled) { KafkaMirrorMakerCheckpoint sourceCheckpoint = new KafkaMirrorMakerCheckpoint(datastreamProducerRecord.getCheckpoint()); String topic = sourceCheckpoint.getTopic(); int partition = sourceCheckpoint.getPartition(); _flushlessProducer.send(datastreamProducerRecord, topic, partition, sourceCheckpoint.getOffset(), ((metadata, exception) -> { if (exception != null) { _logger.warn( String.format("Detected exception being throw from flushless send callback for source " + "topic-partition: %s with metadata: %s, exception: ", srcTopicPartition, metadata), exception); synchronized (_sendFailureTopicPartitionExceptionMap) { _sendFailureTopicPartitionExceptionMap.put(srcTopicPartition, exception); } } else { _consumerMetrics.updateBytesProcessedRate(numBytes); } if (sendCallback != null) { sendCallback.onCompletion(metadata, exception); } })); if (_flowControlEnabled) { TopicPartition tp = new TopicPartition(topic, partition); long inFlightMessageCount = _flushlessProducer.getInFlightCount(topic, partition); if (inFlightMessageCount > _maxInFlightMessagesThreshold) { LOG.warn( "In-flight message count of for topic partition exceeded maxInFlightMessagesThreshold of {}. Will pause partition.", inFlightMessageCount, tp, _maxInFlightMessagesThreshold); _autoPausedSourcePartitions.put(tp, new PausedSourcePartitionMetadata( () -> _flushlessProducer.getInFlightCount(topic, partition) <= _minInFlightMessagesThreshold, PausedSourcePartitionMetadata.Reason.EXCEEDED_MAX_IN_FLIGHT_MSG_THRESHOLD)); _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); _flowControlTriggerCount++; } } } else { super.sendDatastreamProducerRecord(datastreamProducerRecord, srcTopicPartition, numBytes, sendCallback); } }

Target:
protected void sendDatastreamProducerRecord(DatastreamProducerRecord datastreamProducerRecord, TopicPartition srcTopicPartition, int numBytes, SendCallback sendCallback) { if (_isFlushlessModeEnabled) { KafkaMirrorMakerCheckpoint sourceCheckpoint = new KafkaMirrorMakerCheckpoint(datastreamProducerRecord.getCheckpoint()); String topic = sourceCheckpoint.getTopic(); int partition = sourceCheckpoint.getPartition(); _flushlessProducer.send(datastreamProducerRecord, topic, partition, sourceCheckpoint.getOffset(), ((metadata, exception) -> { if (exception != null) { _logger.warn( String.format("Detected exception being throw from flushless send callback for source " + "topic-partition: %s with metadata: %s, exception: ", srcTopicPartition, metadata), exception); updateSendFailureTopicPartitionExceptionMap(srcTopicPartition, exception); } else { _consumerMetrics.updateBytesProcessedRate(numBytes); } if (sendCallback != null) { sendCallback.onCompletion(metadata, exception); } })); if (_flowControlEnabled) { TopicPartition tp = new TopicPartition(topic, partition); long inFlightMessageCount = _flushlessProducer.getInFlightCount(topic, partition); if (inFlightMessageCount > _maxInFlightMessagesThreshold) { LOG.warn( "In-flight message count of for topic partition exceeded maxInFlightMessagesThreshold of {}. Will pause partition.", inFlightMessageCount, tp, _maxInFlightMessagesThreshold); _autoPausedSourcePartitions.put(tp, new PausedSourcePartitionMetadata( () -> _flushlessProducer.getInFlightCount(topic, partition) <= _minInFlightMessagesThreshold, PausedSourcePartitionMetadata.Reason.EXCEEDED_MAX_IN_FLIGHT_MSG_THRESHOLD)); _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); _flowControlTriggerCount++; } } } else { super.sendDatastreamProducerRecord(datastreamProducerRecord, srcTopicPartition, numBytes, sendCallback); } }