Class KNetConnector
The generic class which is the base of both source or sink connectors
public abstract class KNetConnector : KNetCommon, IKNetConnector, IKNetCommon, IKNetConnectLogging, IConnector, IVersion
- Inheritance
-
KNetConnector
- Implements
- Derived
- Inherited Members
Fields
taskDictionary
The set of allocated KNetTask with their associated identifiers
protected ConcurrentDictionary<long, KNetTask> taskDictionary
Field Value
Properties
ConnectorName
The unique name of the connector
public abstract string ConnectorName { get; }
Property Value
TaskClassType
public abstract Type TaskClassType { get; }
Property Value
Methods
Context<T>()
An helper function to read context data from Java side
protected T Context<T>()
Returns
- T
The
T
Type Parameters
TThe expected return Type
Exceptions
Start(Map<String, object>)
Not implemented
public virtual void Start(Map<String, object> props)
Parameters
Exceptions
- NotImplementedException
Local version with a different signature
Start(IKNetConfigurationFromMap)
Implement the method to execute the start action
public abstract void Start(IKNetConfigurationFromMap configuration)
Parameters
configurationIKNetConfigurationFromMapThe IKNetConfigurationFromMap to access the properties returned from Apache Kafka Connect framework: the Properties contains the same info from configuration file.
Stop()
Implement the method to execute the stop action
public abstract void Stop()
TaskConfigs(int, int, Map<String, String>)
Direct implementation can be used instead of TaskConfigs(int, int, IKNetTaskConfiguration)
public virtual bool TaskConfigs(int currentTask, int maxTasks, Map<String, String> props)
Parameters
Returns
TaskConfigs(int, int, IKNetTaskConfiguration)
Invoked during allocation of tasks from Apache Kafka Connect
public abstract bool TaskConfigs(int currentTask, int maxTasks, IKNetTaskConfiguration config)
Parameters
currentTaskintThe actual task index
maxTasksintMax tasks as defined from Apache Kafka Connect framework
configIKNetTaskConfigurationThe IKNetTaskConfiguration to be filled in with properties for the task: the same will be received from Start(IKNetConfigurationFromMap)
Returns
Remarks
If the connector needs a single task and maxTasks is higher than 1, returning true immediately only one configuration is returned to Apache Kafka Connect framework.
In other word it is possible to stop the configuration requests at any time; only the first one is reported in any case since at least one shall be available.
To configure all maxTasks return always false.