|
| 1 | +====================== |
| 2 | +Kafka Topic Properties |
| 3 | +====================== |
| 4 | + |
| 5 | +.. default-domain:: mongodb |
| 6 | + |
| 7 | +.. contents:: On this page |
| 8 | + :local: |
| 9 | + :backlinks: none |
| 10 | + :depth: 2 |
| 11 | + :class: singlecol |
| 12 | + |
| 13 | +Overview |
| 14 | +-------- |
| 15 | + |
| 16 | +Use the following configuration settings to specify which Kafka topics the |
| 17 | +source connector should publish data to. |
| 18 | + |
| 19 | +.. include:: /includes/source-config-link.rst |
| 20 | + |
| 21 | +Settings |
| 22 | +-------- |
| 23 | + |
| 24 | +.. list-table:: |
| 25 | + :header-rows: 1 |
| 26 | + :widths: 35 65 |
| 27 | + |
| 28 | + * - Name |
| 29 | + - Description |
| 30 | + |
| 31 | + * - | **topic.prefix** |
| 32 | + - | **Type:** string |
| 33 | + | |
| 34 | + | **Description:** |
| 35 | + | The prefix to prepend to database and collection names to |
| 36 | + generate the name of the Kafka topic on which to publish the data. |
| 37 | + |
| 38 | + .. seealso:: |
| 39 | + |
| 40 | + :ref:`Topic Naming Prefix Usage Example <source-usage-example-topic-naming>` |
| 41 | + |
| 42 | + | **Default**: "" |
| 43 | + | **Accepted Values**: A string composed of ASCII alphanumeric |
| 44 | + characters including ".", "-", and "_" |
| 45 | + |
| 46 | + * - | **topic.suffix** |
| 47 | + - | **Type:** string |
| 48 | + | |
| 49 | + | **Description:** |
| 50 | + | The suffix to append to database and collection names to |
| 51 | + generate the name of the Kafka topic on which to publish the data. |
| 52 | + |
| 53 | + .. seealso:: |
| 54 | + |
| 55 | + :ref:`Topic Naming Suffix Usage Example <source-usage-example-topic-naming>` |
| 56 | + |
| 57 | + | **Default**: "" |
| 58 | + | **Accepted Values**: A string composed of ASCII alphanumeric |
| 59 | + characters including ".", "-", and "_" |
| 60 | + |
| 61 | + * - | **topic.namespace.map** |
| 62 | + - | **Type:** string |
| 63 | + | |
| 64 | + | **Description:** |
| 65 | + | Specifies a JSON mapping between change stream document namespaces |
| 66 | + and topic names. |
| 67 | + |
| 68 | + .. example:: |
| 69 | + |
| 70 | + The following mappings instruct the connector to do the following: |
| 71 | + |
| 72 | + - Publish change stream documents originating from the |
| 73 | + ``myDb.myColl`` MongoDB collection to the ``topicTwo`` Kafka topic. |
| 74 | + - Publish all other change stream documents originating from the |
| 75 | + ``myDb`` MongoDB database to the ``topicOne`` Kafka topic. |
| 76 | + |
| 77 | + .. code-block:: properties |
| 78 | + :copyable: false |
| 79 | + |
| 80 | + topic.namespace.map={"myDb": "topicOne", "myDb.myColl\": "topicTwo"} |
| 81 | + |
| 82 | + | You can use the "*" wildcard character to match change stream |
| 83 | + document namespaces. |
| 84 | + |
| 85 | + .. example:: |
| 86 | + |
| 87 | + The following mapping instructs the connector to publish all change |
| 88 | + stream document namespaces to the ``topicThree`` topic: |
| 89 | + |
| 90 | + .. code-block:: properties |
| 91 | + :copyable: false |
| 92 | + |
| 93 | + topic.namespace.map={"*": "topicThree"} |
| 94 | + |
| 95 | + | **Default**: "" |
| 96 | + | **Accepted Values**: A valid JSON object |
| 97 | + |
| 98 | + * - | **topic.mapper** |
| 99 | + - | **Type:** string |
| 100 | + | |
| 101 | + | **Description:** |
| 102 | + | The Java class that defines your custom topic mapping logic. |
| 103 | + | |
| 104 | + | **Default**: ``com.mongodb.kafka.connect.source.topic.mapping.DefaultTopicMapper`` |
| 105 | + | **Accepted Values**: Valid full class name of an implementation |
| 106 | + of the `TopicMapper <https://github.com/mongodb/mongo-kafka/blob/master/src/main/java/com/mongodb/kafka/connect/source/topic/mapping/TopicMapper.java>`__ |
| 107 | + class. |
| 108 | + |
| 109 | + |
0 commit comments