Table of Contents

Class KNetSinkConnector<TSinkConnector, TTask>

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

An implementation of KNetConnector<TConnector> for sink connectors

public abstract class KNetSinkConnector<TSinkConnector, TTask> : KNetConnector<TSinkConnector>, IKNetSinkConnector, IKNetConnector, IKNetCommon, IKNetConnectLogging, IConnector, IVersion where TSinkConnector : KNetSinkConnector<TSinkConnector, TTask> where TTask : KNetSinkTask<TTask>

Type Parameters

TSinkConnector

The connector class inherited from KNetSinkConnector<TSinkConnector, TTask>

TTask

The task class inherited from KNetSinkTask<TTask>

Inheritance
KNetConnector<TSinkConnector>
KNetSinkConnector<TSinkConnector, TTask>
Implements
Derived
Inherited Members

Properties

Context

public SinkConnectorContext Context { get; }

Property Value

SinkConnectorContext

ReflectedRemoteObjectClassName

Set the ReflectedRemoteObjectClassName of the connector to a fixed value

protected override sealed string ReflectedRemoteObjectClassName { get; }

Property Value

string

TaskClassType

Set the TaskClassType of the connector to the value defined from TTask

public override sealed Type TaskClassType { get; }

Property Value

Type

Methods

AlterOffsets(Map<String, String>, Map<TopicPartition, Long>)

Invoked when users request to manually alter/reset the offsets for this connector via the Connect worker's REST API. Connectors that manage offsets externally can propagate offset changes to their external system in this method. Connectors may also validate these offsets to ensure that the source partitions and source offsets are in a format that is recognizable to them. Connectors that neither manage offsets externally nor require custom offset validation need not implement this method beyond simply returning true.

public virtual bool AlterOffsets(Map<String, String> connectorConfig, Map<TopicPartition, Long> offsets)

Parameters

connectorConfig Map<String, String>

The configuration of the connector

offsets Map<TopicPartition, Long>

map from source partition to source offset, containing the offsets that the user has requested to alter/reset. For any source partitions whose offsets are being reset instead of altered, their corresponding source offset value in the map will be null. This map may be empty, but never null. An empty offsets map could indicate that the offsets were reset previously or that no offsets have been committed yet.

Returns

bool

whether this method has been overridden by the connector; the default implementation returns false, and all other implementations (that do not unconditionally throw exceptions) should return true

Remarks

User requests to alter/reset offsets will be handled by the Connect runtime and will be reflected in the offsets for this connector's consumer group. Note that altering/resetting offsets is expected to be an idempotent operation and this method should be able to handle being called more than once with the same arguments (which could occur if a user retries the request due to a failure in altering the consumer group offsets, for example). Similar to validate, this method may be called by the runtime before the Start(IReadOnlyDictionary<string, string>) method is invoked.