Skip to content

Commit eb18e7b

Browse files
Chris Choschmalliso
authored andcommitted
DOCSP-18342: Source Connector Kafka topic config (#140)
* DOCSP-18342: Source Connector Kafka topic config
1 parent 8eb9bb9 commit eb18e7b

File tree

4 files changed

+116
-24
lines changed

4 files changed

+116
-24
lines changed

source/source-connector/configuration-properties.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ See the following categories for a list of related configuration properties:
3535
* - :ref:`MongoDB Connection Properties <source-configuration-mongodb-connection>`
3636
- Specify how to connect to your MongoDB cluster.
3737

38+
* - :ref:`Kafka Topic Properties <source-configuration-change-stream>`
39+
- Specify which topics to publish change stream data.
40+
3841
* - :ref:`Change Stream Properties <source-configuration-change-stream>`
3942
- Specify your change stream pipelines and cursor settings.
4043

@@ -46,9 +49,9 @@ See the following categories for a list of related configuration properties:
4649
:caption: Sink Connector Configuration Properties
4750

4851
MongoDB Connection </source-connector/configuration-properties/mongodb-connection>
49-
Change Stream Properties </source-connector/configuration-properties/change-stream>
52+
Kafka Topic </source-connector/configuration-properties/kafka-topic>
53+
Change Stream </source-connector/configuration-properties/change-stream>
5054

5155
..
5256
- Document/Data Format
53-
- Kafka Topic
5457
- Error Handling and Resume Options

source/source-connector/configuration-properties/change-stream.txt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -95,28 +95,6 @@ Settings
9595
| **Default**: ``""``
9696
| **Accepted Values**: A valid collation JSON document
9797

98-
* - | **copy.existing.pipeline**
99-
- | **Type:** string
100-
|
101-
| **Description:**
102-
| An array of :manual:`pipeline operations </core/aggregation-pipeline/>`
103-
to run when copying existing data. You can use this setting to
104-
improve the use of indexes by the copying manager to make the copying
105-
process more efficient.
106-
107-
.. example::
108-
109-
The following example shows how you can use the :manual:`$match </reference/operator/aggregation/match/>`
110-
aggregation operator to copy only documents that contain a
111-
``closed`` field with a value of ``false``.
112-
113-
.. code-block:: none
114-
115-
copy.existing.pipeline=[ { "$match": { "closed": "false" } } ]
116-
117-
| **Default**: ``[]``
118-
| **Accepted Values**: Valid aggregation pipeline stages
119-
12098
* - | **batch.size**
12199
- | **Type:** int
122100
|
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+

source/source-connector/usage-examples/topic-naming.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _source-usage-example-topic-naming:
2+
13
============
24
Topic Naming
35
============

0 commit comments

Comments
 (0)