Package org.apache.kafka.connect.source
Class SourceConnector
java.lang.Object
org.apache.kafka.connect.connector.Connector
org.apache.kafka.connect.source.SourceConnector
- All Implemented Interfaces:
Versioned
SourceConnectors implement the connector interface to pull data from another system and send
it to Kafka.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncanDefineTransactionBoundaries
(Map<String, String> connectorConfig) Signals whether the connector implementation is capable of defining the transaction boundaries for a connector with the given configuration.protected SourceConnectorContext
context()
Returns the context object used to interact with the Kafka Connect runtime.exactlyOnceSupport
(Map<String, String> connectorConfig) Signals whether the connector supports exactly-once semantics with a proposed configuration.Methods inherited from class org.apache.kafka.connect.connector.Connector
config, initialize, initialize, reconfigure, start, stop, taskClass, taskConfigs, validate
-
Constructor Details
-
SourceConnector
public SourceConnector()
-
-
Method Details
-
context
Description copied from class:Connector
Returns the context object used to interact with the Kafka Connect runtime. -
exactlyOnceSupport
Signals whether the connector supports exactly-once semantics with a proposed configuration. Connector authors can assume that worker-level exactly-once support is enabled when this method is invoked.For backwards compatibility, the default implementation will return
null
, but connector authors are strongly encouraged to override this method to return a non-null value such asSUPPORTED
orUNSUPPORTED
.Similar to
validate
, this method may be called by the runtime before thestart
method is invoked when the connector will be run with exactly-once support.- Parameters:
connectorConfig
- the configuration that will be used for the connector.- Returns:
ExactlyOnceSupport.SUPPORTED
if the connector can provide exactly-once support with the given configuration, andExactlyOnceSupport.UNSUPPORTED
if it cannot. If this method is overridden by a connector, should not benull
, but ifnull
, it will be assumed that the connector cannot provide exactly-once semantics.- Since:
- 3.3
-
canDefineTransactionBoundaries
public ConnectorTransactionBoundaries canDefineTransactionBoundaries(Map<String, String> connectorConfig) Signals whether the connector implementation is capable of defining the transaction boundaries for a connector with the given configuration. This method is called beforeConnector.start(Map)
, only when the runtime supports exactly-once and the connector configuration includestransaction.boundary=connector
.This method need not be implemented if the connector implementation does not support defining transaction boundaries.
- Parameters:
connectorConfig
- the configuration that will be used for the connector- Returns:
ConnectorTransactionBoundaries.SUPPORTED
if the connector will define its own transaction boundaries, orConnectorTransactionBoundaries.UNSUPPORTED
otherwise; may never benull
. The default implementation returnsConnectorTransactionBoundaries.UNSUPPORTED
.- Since:
- 3.3
- See Also:
-