Table of Contents

Class KNetConnector

Namespace
MASES.KNet.Connect
Assembly
MASES.KNet.dll

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

ConcurrentDictionary<long, KNetTask>

Properties

ConnectorName

The unique name of the connector

public abstract string ConnectorName { get; }

Property Value

string

TaskClassType

The Type of task to be allocated, it shall inherits from KNetTask

public abstract Type TaskClassType { get; }

Property Value

Type

Methods

Context<T>()

An helper function to read context data from Java side

protected T Context<T>()

Returns

T

The T

Type Parameters

T

The expected return Type

Exceptions

InvalidOperationException

Start(Map<String, object>)

Not implemented

public virtual void Start(Map<String, object> props)

Parameters

props Map<String, object>

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

configuration IKNetConfigurationFromMap

The 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

currentTask int
maxTasks int
props Map<String, String>

Returns

bool

TaskConfigs(int, int, IKNetTaskConfiguration)

Invoked during allocation of tasks from Apache Kafka Connect

public abstract bool TaskConfigs(int currentTask, int maxTasks, IKNetTaskConfiguration config)

Parameters

currentTask int

The actual task index

maxTasks int

Max tasks as defined from Apache Kafka Connect framework

config IKNetTaskConfiguration

The IKNetTaskConfiguration to be filled in with properties for the task: the same will be received from Start(IKNetConfigurationFromMap)

Returns

bool

true to avoid any further invocation of the method, otherwise false.

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.