Docs Menu

Kafka Topic Properties

On this page

  • Overview
  • Settings

Use the following configuration settings to specify which Kafka topics the source connector should publish data to.

For a list of source connector configuration settings organized by category, see the guide on Source Connector Configuration Properties.

Name
Description
topic.prefix
Type: string

Description:
The prefix to prepend to database and collection names to generate the name of the Kafka topic on which to publish the data.
Tip
See also:
Default: ""
Accepted Values: A string composed of ASCII alphanumeric characters including ".", "-", and "_"
topic.suffix
Type: string

Description:
The suffix to append to database and collection names to generate the name of the Kafka topic on which to publish the data.
Default: ""
Accepted Values: A string composed of ASCII alphanumeric characters including ".", "-", and "_"
topic.namespace.map
Type: string

Description:
Specifies a JSON mapping between change stream document namespaces and topic names.
Example

The following mappings instruct the connector to do the following:

  • Publish change stream documents originating from the myDb.myColl MongoDB collection to the topicTwo Kafka topic.
  • Publish all other change stream documents originating from the myDb MongoDB database to the topicOne Kafka topic.
topic.namespace.map={"myDb": "topicOne", "myDb.myColl\": "topicTwo"}
You can use the "*" wildcard character to match change stream document namespaces.
Example

The following mapping instructs the connector to publish all change stream document namespaces to the topicThree topic:

topic.namespace.map={"*": "topicThree"}
Default: ""
Accepted Values: A valid JSON object
topic.mapper
Type: string

Description:
The Java class that defines your custom topic mapping logic.

Default: com.mongodb.kafka.connect.source.topic.mapping.DefaultTopicMapper
Accepted Values: Valid full class name of an implementation of the TopicMapper class.

On this page

Give Feedback
MongoDB logo
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.