Source:
protected DatastreamProducerRecord translate(ConsumerRecord<?, ?> fromKafka, Instant readTime) { long eventsSourceTimestamp = fromKafka.timestampType() == TimestampType.LOG_APPEND_TIME ? fromKafka.timestamp() : readTime.toEpochMilli(); HashMap<String, String> metadata = new HashMap<>(); metadata.put(KAFKA_ORIGIN_CLUSTER, _mirrorMakerSource.getBrokerListString()); String topic = fromKafka.topic(); metadata.put(KAFKA_ORIGIN_TOPIC, topic); int partition = fromKafka.partition(); String partitionStr = String.valueOf(partition); metadata.put(KAFKA_ORIGIN_PARTITION, partitionStr); long offset = fromKafka.offset(); String offsetStr = String.valueOf(offset); metadata.put(KAFKA_ORIGIN_OFFSET, offsetStr); metadata.put(BrooklinEnvelopeMetadataConstants.EVENT_TIMESTAMP, String.valueOf(eventsSourceTimestamp)); if (Boolean.TRUE.toString() .equals(_datastream.getMetadata().get(KafkaDatastreamMetadataConstants.USE_PASSTHROUGH_COMPRESSION))) { PassThroughConsumerRecord<?, ?> passThroughConsumerRecord = (PassThroughConsumerRecord<?, ?>) fromKafka; metadata.put(KafkaPassthroughRecordMagicConverter.PASS_THROUGH_MAGIC_VALUE, KafkaPassthroughRecordMagicConverter.convertMagicToString(passThroughConsumerRecord.magic())); } BrooklinEnvelope envelope = new BrooklinEnvelope(fromKafka.key(), fromKafka.value(), null, metadata); DatastreamProducerRecordBuilder builder = new DatastreamProducerRecordBuilder(); builder.addEvent(envelope); builder.setEventsSourceTimestamp(eventsSourceTimestamp); builder.setSourceCheckpoint(new KafkaMirrorMakerCheckpoint(topic, partition, offset).toString()); builder.setDestination(_datastreamTask.getDatastreamDestination() .getConnectionString() .replace(KafkaMirrorMakerConnector.MM_TOPIC_PLACEHOLDER, StringUtils.isBlank(_destinationTopicPrefix) ? topic : _destinationTopicPrefix + topic)); if (_isIdentityMirroringEnabled) { builder.setPartition(partition); } return builder.build(); }

Target:
protected DatastreamProducerRecord translate(ConsumerRecord<?, ?> fromKafka, Instant readTime) { long eventsSourceTimestamp = fromKafka.timestampType() == TimestampType.LOG_APPEND_TIME ? fromKafka.timestamp() : readTime.toEpochMilli(); HashMap<String, String> metadata = new HashMap<>(); metadata.put(KAFKA_ORIGIN_CLUSTER, _mirrorMakerSource.getBrokerListString()); String topic = fromKafka.topic(); metadata.put(KAFKA_ORIGIN_TOPIC, topic); int partition = fromKafka.partition(); String partitionStr = String.valueOf(partition); metadata.put(KAFKA_ORIGIN_PARTITION, partitionStr); long offset = fromKafka.offset(); String offsetStr = String.valueOf(offset); metadata.put(KAFKA_ORIGIN_OFFSET, offsetStr); metadata.put(BrooklinEnvelopeMetadataConstants.EVENT_TIMESTAMP, String.valueOf(eventsSourceTimestamp)); if (_isPassthroughEnabled) { PassThroughConsumerRecord<?, ?> passThroughConsumerRecord = (PassThroughConsumerRecord<?, ?>) fromKafka; metadata.put(KafkaPassthroughRecordMagicConverter.PASS_THROUGH_MAGIC_VALUE, KafkaPassthroughRecordMagicConverter.convertMagicToString(passThroughConsumerRecord.magic())); } BrooklinEnvelope envelope = new BrooklinEnvelope(fromKafka.key(), fromKafka.value(), null, metadata); DatastreamProducerRecordBuilder builder = new DatastreamProducerRecordBuilder(); builder.addEvent(envelope); builder.setEventsSourceTimestamp(eventsSourceTimestamp); builder.setSourceCheckpoint(new KafkaMirrorMakerCheckpoint(topic, partition, offset).toString()); builder.setDestination(_datastreamTask.getDatastreamDestination() .getConnectionString() .replace(KafkaMirrorMakerConnector.MM_TOPIC_PLACEHOLDER, StringUtils.isBlank(_destinationTopicPrefix) ? topic : _destinationTopicPrefix + topic)); if (_isIdentityMirroringEnabled) { builder.setPartition(partition); } return builder.build(); }