Migrate from Kafka Connect MongoDB
Use this guide to migrate your Kafka deployments from the community-created Kafka Connect MongoDB sink connector to the official MongoDB Kafka connector.
The following sections list the changes you must make to your Kafka Connect sink connector configuration settings and custom classes to transition to the MongoDB Kafka sink connector.
Update Configuration Settings
Make the following changes to the configuration settings of your Kafka Connect deployment before using them with your MongoDB Kafka connector deployment:
Replace values that include the package
at.grahsl.kafka.connect.mongodb
with the packagecom.mongodb.kafka.connect
.Replace your
connector.class
setting with the MongoDB Kafka sink connector class.connector.class=com.mongodb.kafka.connect.MongoSinkConnector Remove the
mongodb.
prefix from your Kafka Connect property names. For example, changemongodb.connection.uri
toconnection.uri
.Remove the
document.id.strategies
setting if it exists. If the value of this setting reference custom strategies, move them to thedocument.id.strategy
setting. Read the Update Custom Classes section to discover what changes you must make to your custom classes.Replace any property names you use to specify per-topic or collection overrides that contain the
mongodb.collection
prefix with the equivalent key in sink connector Kafka topic configuration topic properties.
Update Custom Classes
If you use any custom classes in your Kafka Connect sink connector deployment, make the following changes to them before adding them to your MongoDB Kafka connector deployment:
Replace imports that include
at.grahsl.kafka.connect.mongodb
withcom.mongodb.kafka.connect
.Replace references to the
MongoDbSinkConnector
class with theMongoSinkConnector
class.Update custom sink connector strategy classes to implement the
com.mongodb.kafka.connect.sink.processor.id.strategy.IdStrategy
interface.Update references to the
MongoDbSinkConnectorConfig
class. In the MongoDB Kafka connector, the logic from that class is split into the following classes:
Update Post Processor Subclasses
If you have classes that subclass a post processor in your Kafka Connect
connector deployment, update methods that override ones in the Kafka Connect
PostProcessor
class to match the method signatures of the MongoDB Kafka
connector PostProcessor class.