forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support to enable passthrough mirroring data from V1 format to V2 format (#70) Pass through mirroring as it is today, works when the log.message.format.version between source and destination cluster is the same (0.10.0 to 0.10.0, 2.0 to 2.0). When there is a mixed message format between source and destination, KMM throws errors. This patch makes passthrough mirroring work when the source is at 0.10.0 format and destination is at 2.0 format. This patch does not address the errors/issues when the source is at 2.0 format and destination is at 0.10.0 format. TICKET =
- Loading branch information
1 parent
456f47e
commit 6bfd49b
Showing
6 changed files
with
142 additions
and
5 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
clients/src/main/java/org/apache/kafka/clients/consumer/PassThroughConsumerRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.kafka.clients.consumer; | ||
|
||
import org.apache.kafka.common.header.Headers; | ||
import org.apache.kafka.common.record.TimestampType; | ||
|
||
/** | ||
* In case of passthrough, value contains the message batch while the key is null | ||
* @param <K> null | ||
* @param <V> batch of messages | ||
*/ | ||
public class PassThroughConsumerRecord<K, V> extends ConsumerRecord<K, V> { | ||
private final byte magic; | ||
|
||
public PassThroughConsumerRecord(String topic, int partition, long offset, K key, V value, byte magic) { | ||
super(topic, partition, offset, key, value); | ||
this.magic = magic; | ||
} | ||
|
||
public PassThroughConsumerRecord(String topic, int partition, long offset, long timestamp, | ||
TimestampType timestampType, long checksum, int serializedKeySize, int serializedValueSize, K key, V value, | ||
byte magic) { | ||
super(topic, partition, offset, timestamp, timestampType, checksum, serializedKeySize, serializedValueSize, key, | ||
value); | ||
this.magic = magic; | ||
} | ||
|
||
public PassThroughConsumerRecord(String topic, int partition, long offset, long timestamp, | ||
TimestampType timestampType, Long checksum, int serializedKeySize, int serializedValueSize, K key, V value, | ||
Headers headers, byte magic) { | ||
super(topic, partition, offset, timestamp, timestampType, checksum, serializedKeySize, serializedValueSize, key, | ||
value, headers); | ||
this.magic = magic; | ||
} | ||
|
||
public byte magic() { | ||
return magic; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters