C0urante commented on a change in pull request #11773:
URL: https://github.com/apache/kafka/pull/11773#discussion_r819945019
##########
File path:
connect/api/src/main/java/org/apache/kafka/connect/source/SourceTask.java
##########
@@ -16,17 +16,63 @@
*/
package org.apache.kafka.connect.source;
-import org.apache.kafka.connect.connector.Task;
import org.apache.kafka.clients.producer.RecordMetadata;
+import org.apache.kafka.connect.connector.Task;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
/**
* SourceTask is a Task that pulls records from another system for storage in
Kafka.
*/
public abstract class SourceTask implements Task {
+ /**
+ * The configuration key that determines how source tasks will define
transaction boundaries
+ * when exactly-once support is enabled.
+ */
+ public static final String TRANSACTION_BOUNDARY_CONFIG =
"transaction.boundary";
Review comment:
I wanted to define the `TransactionBoundary` enum somewhere public
(i.e., accessible by connector authors) so that they could use it for things
like the `SourceConnector::exactlyOnceSupport` method in cases where connectors
need to be able to define their own transaction boundaries in order to provide
exactly-once support. Seems more ergonomic to be able to do something like
`TransactionBoundary.fromProperty(props.get(TRANSACTION_BOUNDARY_CONFIG))` in
that case.
Given that, it seemed like a toss-up between `SourceConnector` and
`SourceTask`. The former felt a little more intuitive (tasks probably have less
reason to need to know about their transaction boundary style beyond the return
value of `SourceTaskContext::transactionContext`), but the latter lines up
better with the precedent set by the topics-related properties for sink
connectors, which are [defined in the `SinkTask`
class](https://github.com/apache/kafka/blob/3be978464ca01c29241954516b4d952f69d4e16d/connect/api/src/main/java/org/apache/kafka/connect/sink/SinkTask.java#L56-L70).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]