|
1 | 1 | .. _source-configuration-error-handling:
|
2 | 2 |
|
3 |
| -==================================== |
4 |
| -Error Handling and Resume Properties |
5 |
| -==================================== |
| 3 | +======================================================== |
| 4 | +Error Handling and Resuming from Interruption Properties |
| 5 | +======================================================== |
6 | 6 |
|
7 | 7 | .. default-domain:: mongodb
|
8 | 8 |
|
@@ -133,7 +133,70 @@ Settings
|
133 | 133 | heartbeat messages. You must provide a positive value in the
|
134 | 134 | ``heartbeat.interval.ms`` setting to enable this feature.
|
135 | 135 | |
|
136 |
| - | **Default**: ``__mongodb_heartbeats`` |
| 136 | + | **Default**: ``{+default-heartbeat-topic+}`` |
137 | 137 | | **Accepted Values**: A valid Kafka topic name
|
138 | 138 |
|
139 | 139 | .. _source-configuration-error-handling-table-end:
|
| 140 | + |
| 141 | +.. _source-configuration-error-handling-smt: |
| 142 | + |
| 143 | +Heartbeats with Single Message Transforms |
| 144 | +----------------------------------------- |
| 145 | + |
| 146 | +If you enable heartbeats and specify **Single Message Transforms (SMTs)** in your |
| 147 | +{+kc+} deployment, you must exclude your heartbeat messages from |
| 148 | +your SMTs. SMTs are a feature of {+kc+} that enables you to specify transformations on |
| 149 | +the messages that pass through your {+source-connector+} without having to deploy a |
| 150 | +stream processing application. |
| 151 | + |
| 152 | +To exclude heartbeat messages from your SMTs, you must create and apply a |
| 153 | +**predicate** to your SMTs. Predicates are a feature of SMTs that |
| 154 | +enables you to check if a message matches a conditional statement before |
| 155 | +applying a transformation. |
| 156 | + |
| 157 | +The following configuration defines the ``IsHeartbeat`` predicate which matches |
| 158 | +heartbeat messages sent to the default heartbeat topic: |
| 159 | + |
| 160 | +.. code-block:: properties |
| 161 | + |
| 162 | + predicates=IsHeartbeat |
| 163 | + predicates.IsHeartbeat.type=org.apache.kafka.connect.transforms.predicates.TopicNameMatches |
| 164 | + predicates.IsHeartbeat.pattern={+default-heartbeat-topic+} |
| 165 | + |
| 166 | +The following configuration uses the preceding predicate to exclude heartbeat |
| 167 | +messages from an ``ExtractField`` transformation: |
| 168 | + |
| 169 | +.. code-block:: properties |
| 170 | + |
| 171 | + transforms=Extract |
| 172 | + transforms.Extract.type=org.apache.kafka.connect.transforms.ExtractField$Key |
| 173 | + transforms.Extract.field=<the field to extract from your {+ak+} key> |
| 174 | + transforms.Extract.predicate=IsHeartbeat |
| 175 | + transforms.Extract.negate=true |
| 176 | + |
| 177 | + # apply the default key schema as the extract transformation requires a struct object |
| 178 | + output.format.key=schema |
| 179 | + |
| 180 | +If you do not exclude your heartbeat messages from the preceding transformation, |
| 181 | +your connector raises the following error once it processes a heartbeat message: |
| 182 | + |
| 183 | +.. code-block:: none |
| 184 | + |
| 185 | + ERROR WorkerSourceTask{id=mongo-source-0} Task threw an uncaught and unrecoverable exception. Task is being killed ... |
| 186 | + ... |
| 187 | + Only Struct objects supported for [field extraction], found: java.lang.String |
| 188 | + |
| 189 | +To learn more about SMTs, see |
| 190 | +`How to Use Single Message Transforms in Kafka Connect <https://www.confluent.io/blog/kafka-connect-single-message-transformation-tutorial-with-examples/>`__ |
| 191 | +from Confluent. |
| 192 | + |
| 193 | +To learn more about predicates, see |
| 194 | +`Filter (Apache Kafka) <https://docs.confluent.io/platform/current/connect/transforms/filter-ak.html#predicates>`__ |
| 195 | +from Confluent. |
| 196 | + |
| 197 | +To learn more about the ``ExtractField`` transformation, see |
| 198 | +`ExtractField <https://docs.confluent.io/platform/current/connect/transforms/extractfield.html>`__ |
| 199 | +from Confluent. |
| 200 | + |
| 201 | +To learn more about the default key schema, see the |
| 202 | +:ref:`<kafka-source-apply-schemas-default-schema>` page. |
0 commit comments