public class DefaultReplicationPolicy extends Object implements ReplicationPolicy, org.apache.kafka.common.Configurable
ReplicationPolicy
which prepends the source cluster alias to
remote topic names.
For example, if the source cluster alias is "us-west", topics created in the target cluster will be named
us-west.<TOPIC>. The separator is customizable by setting SEPARATOR_CONFIG
and defaults to a period.Modifier and Type | Field and Description |
---|---|
static String |
INTERNAL_TOPIC_SEPARATOR_ENABLED_CONFIG |
static Boolean |
INTERNAL_TOPIC_SEPARATOR_ENABLED_DEFAULT |
static String |
SEPARATOR_CONFIG |
static String |
SEPARATOR_DEFAULT |
Constructor and Description |
---|
DefaultReplicationPolicy() |
Modifier and Type | Method and Description |
---|---|
String |
checkpointsTopic(String clusterAlias)
Returns the name of the checkpoints topic for given cluster alias.
|
void |
configure(Map<String,?> props) |
String |
formatRemoteTopic(String sourceClusterAlias,
String topic)
Returns the remote topic name for the given topic and source cluster alias.
|
boolean |
isCheckpointsTopic(String topic)
Returns true if the topic is a checkpoints topic.
|
boolean |
isMM2InternalTopic(String topic)
Returns true if the topic is one of MirrorMaker internal topics.
|
String |
offsetSyncsTopic(String clusterAlias)
Returns the name of the offset-syncs topic for given cluster alias.
|
String |
topicSource(String topic)
Returns the source cluster alias of given topic.
|
String |
upstreamTopic(String topic)
Return the name of the given topic on the source cluster.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
heartbeatsTopic, isHeartbeatsTopic, isInternalTopic, originalTopic
public static final String SEPARATOR_CONFIG
public static final String SEPARATOR_DEFAULT
public static final String INTERNAL_TOPIC_SEPARATOR_ENABLED_CONFIG
public static final Boolean INTERNAL_TOPIC_SEPARATOR_ENABLED_DEFAULT
public void configure(Map<String,?> props)
configure
in interface org.apache.kafka.common.Configurable
public String formatRemoteTopic(String sourceClusterAlias, String topic)
ReplicationPolicy
formatRemoteTopic
in interface ReplicationPolicy
public String topicSource(String topic)
ReplicationPolicy
topicSource
in interface ReplicationPolicy
public String upstreamTopic(String topic)
ReplicationPolicy
Topics may be replicated multiple hops, so the immediately upstream topic may itself be a remote topic.
Returns null if the given topic is not a remote topic.
upstreamTopic
in interface ReplicationPolicy
public String offsetSyncsTopic(String clusterAlias)
ReplicationPolicy
offsetSyncsTopic
in interface ReplicationPolicy
public String checkpointsTopic(String clusterAlias)
ReplicationPolicy
checkpointsTopic
in interface ReplicationPolicy
public boolean isCheckpointsTopic(String topic)
ReplicationPolicy
isCheckpointsTopic
in interface ReplicationPolicy
public boolean isMM2InternalTopic(String topic)
ReplicationPolicy
isMM2InternalTopic
in interface ReplicationPolicy