Package org.apache.kafka.connect.mirror
Class IdentityReplicationPolicy
java.lang.Object
org.apache.kafka.connect.mirror.DefaultReplicationPolicy
org.apache.kafka.connect.mirror.IdentityReplicationPolicy
- All Implemented Interfaces:
Configurable
,ReplicationPolicy
Alternative implementation of
ReplicationPolicy
that does not rename remote topics.
This is useful for migrating from legacy MirrorMaker, or for any use-case involving one-way replication.
N.B. MirrorMaker is not able to prevent cycles when using this replication policy, so take care that your replication topology is acyclic. If migrating from legacy MirrorMaker, this will likely already be the case.
-
Field Summary
Fields inherited from class org.apache.kafka.connect.mirror.DefaultReplicationPolicy
INTERNAL_TOPIC_SEPARATOR_ENABLED_CONFIG, INTERNAL_TOPIC_SEPARATOR_ENABLED_DEFAULT, SEPARATOR_CONFIG, SEPARATOR_DEFAULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Configure this class with the given key-value pairsformatRemoteTopic
(String sourceClusterAlias, String topic) UnlikeDefaultReplicationPolicy
, IdentityReplicationPolicy does not include the source cluster alias in the remote topic name.topicSource
(String topic) UnlikeDefaultReplicationPolicy
, IdentityReplicationPolicy cannot know the source of a remote topic based on its name alone.upstreamTopic
(String topic) Since any topic may be a remote topic, this just returns `topic`.Methods inherited from class org.apache.kafka.connect.mirror.DefaultReplicationPolicy
checkpointsTopic, isCheckpointsTopic, isMM2InternalTopic, offsetSyncsTopic
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.kafka.connect.mirror.ReplicationPolicy
heartbeatsTopic, isHeartbeatsTopic, isInternalTopic, originalTopic
-
Field Details
-
SOURCE_CLUSTER_ALIAS_CONFIG
- See Also:
-
-
Constructor Details
-
IdentityReplicationPolicy
public IdentityReplicationPolicy()
-
-
Method Details
-
configure
Description copied from interface:Configurable
Configure this class with the given key-value pairs- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classDefaultReplicationPolicy
-
formatRemoteTopic
UnlikeDefaultReplicationPolicy
, IdentityReplicationPolicy does not include the source cluster alias in the remote topic name. Instead, topic names are unchanged.In the special case of heartbeats, we defer to
DefaultReplicationPolicy.formatRemoteTopic(String, String)
.- Specified by:
formatRemoteTopic
in interfaceReplicationPolicy
- Overrides:
formatRemoteTopic
in classDefaultReplicationPolicy
-
topicSource
UnlikeDefaultReplicationPolicy
, IdentityReplicationPolicy cannot know the source of a remote topic based on its name alone. Ifsource.cluster.alias
is provided, this method will return that.In the special case of heartbeats, we defer to
DefaultReplicationPolicy.topicSource(String)
.- Specified by:
topicSource
in interfaceReplicationPolicy
- Overrides:
topicSource
in classDefaultReplicationPolicy
-
upstreamTopic
Since any topic may be a remote topic, this just returns `topic`.In the special case of heartbeats, we defer to
DefaultReplicationPolicy.upstreamTopic(String)
.- Specified by:
upstreamTopic
in interfaceReplicationPolicy
- Overrides:
upstreamTopic
in classDefaultReplicationPolicy
-