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

Properties

The properties retrieved from MASES.KNet.Connect.KNetConnector.StartInternal()

public IReadOnlyDictionary<string, string> Properties { get; }

Property Value

IReadOnlyDictionary<string, string>

TaskClassType

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

public abstract Type TaskClassType { get; }

Property Value

Type

Methods

AllocateTask(long)

Allocates a task object based on KNetTask

public object AllocateTask(long taskId)

Parameters

taskId long

The unique id generated from JAva side

Returns

object

The local .NET object

Config()

Not implemented

public ConfigDef Config()

Returns

ConfigDef

Exceptions

NotImplementedException

Invoked in Java before any initialization

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

Initialize(ConnectorContext)

Not implemented

public void Initialize(ConnectorContext ctx)

Parameters

ctx ConnectorContext

Exceptions

NotImplementedException

Invoked in Java before any initialization

Initialize(ConnectorContext, List<Map<String, String>>)

Not implemented

public void Initialize(ConnectorContext ctx, List<Map<String, String>> taskConfigs)

Parameters

ctx ConnectorContext
taskConfigs List<Map<String, String>>

Exceptions

NotImplementedException

Invoked in Java before any initialization

Reconfigure(Map<String, String>)

Not implemented

public void Reconfigure(Map<String, String> props)

Parameters

props Map<String, String>

Exceptions

NotImplementedException

Start(Map<String, String>)

Not implemented

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

Parameters

props Map<String, String>

Exceptions

NotImplementedException

Local version with a different signature

Start(IReadOnlyDictionary<string, string>)

Implement the method to execute the start action

public abstract void Start(IReadOnlyDictionary<string, string> props)

Parameters

props IReadOnlyDictionary<string, string>

The set of properties returned from Apache Kafka Connect framework: the IReadOnlyDictionary<TKey, TValue> contains the same info from configuration file.

Stop()

Implement the method to execute the stop action

public abstract void Stop()

TaskClass()

Not implemented

public Class TaskClass()

Returns

Class

Exceptions

NotImplementedException

Invoked in Java before any initialization

TaskConfigs(int)

Not implemented

public List<Map<String, String>> TaskConfigs(int maxTasks)

Parameters

maxTasks int

Returns

List<Map<String, String>>

Exceptions

NotImplementedException

Invoked using the other signature

TaskConfigs(int, int, Map<String, String>)

Direct implementation can be used instead of TaskConfigs(int, int, IDictionary<string, string>)

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, IDictionary<string, string>)

Invoked during allocation of tasks from Apache Kafka Connect

public abstract bool TaskConfigs(int currentTask, int maxTasks, IDictionary<string, string> config)

Parameters

currentTask int

The actual task index

maxTasks int

Max tasks as defined from Apache Kafka Connect framework

config IDictionary<string, string>

The IDictionary<TKey, TValue> to be filled in with properties for the task: the same will be received from Start(IReadOnlyDictionary<string, string>)

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.

Validate(Map<String, String>)

Not implemented

public Config Validate(Map<String, String> connectorConfigs)

Parameters

connectorConfigs Map<String, String>

Returns

Config

Exceptions

NotImplementedException

Invoked in Java before any initialization

Version()

Not implemented

public string Version()

Returns

string

Exceptions

NotImplementedException

Invoked in Java before any initialization