public class MongoDbConnector
extends org.apache.kafka.connect.source.SourceConnector
tasks that replicate the context of one or more
MongoDB replica sets.
If necessary, a configuration property can be used to disable the
logic used to discover the primary node, an in this case the connector will use the first host address specified in the
configuration as the primary node. Obviously this may cause problems when the replica set elects a different node as the
primary, since the connector will continue to read the oplog using the same node that may no longer be the primary.
allocate tasks, it will attempt to allocate a separate task for each replica set. However, if the
maximum number of tasks exceeds the number of replica sets, then some tasks may replicate multiple replica sets. Note that
each task will use a separate thread to replicate each of its assigned replica sets.
<logicalName>.<databaseName>.<collectionName>", where <logicalName> is set via the
"mongodb.name" configuration property.
This connector is configured with the set of properties described in MongoDbConnectorConfig.
| Modifier and Type | Field and Description |
|---|---|
private Configuration |
config |
private ConnectionContext |
connectionContext |
private org.slf4j.Logger |
logger |
private ReplicaSetMonitorThread |
monitorThread |
private ExecutorService |
replicaSetMonitorExecutor |
private MongoDbTaskContext |
taskContext |
| Constructor and Description |
|---|
MongoDbConnector() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.kafka.common.config.ConfigDef |
config() |
protected void |
replicaSetsChanged(ReplicaSets replicaSets) |
void |
start(Map<String,String> props) |
void |
stop() |
Class<? extends org.apache.kafka.connect.connector.Task> |
taskClass() |
List<Map<String,String>> |
taskConfigs(int maxTasks) |
org.apache.kafka.common.config.Config |
validate(Map<String,String> connectorConfigs) |
String |
version() |
private final org.slf4j.Logger logger
private Configuration config
private ReplicaSetMonitorThread monitorThread
private MongoDbTaskContext taskContext
private ConnectionContext connectionContext
private ExecutorService replicaSetMonitorExecutor
public String version()
public Class<? extends org.apache.kafka.connect.connector.Task> taskClass()
taskClass in class org.apache.kafka.connect.connector.Connectorpublic void start(Map<String,String> props)
start in class org.apache.kafka.connect.connector.Connectorprotected void replicaSetsChanged(ReplicaSets replicaSets)
public List<Map<String,String>> taskConfigs(int maxTasks)
taskConfigs in class org.apache.kafka.connect.connector.Connectorpublic void stop()
stop in class org.apache.kafka.connect.connector.Connectorpublic org.apache.kafka.common.config.ConfigDef config()
config in class org.apache.kafka.connect.connector.ConnectorCopyright © 2019 JBoss by Red Hat. All rights reserved.