From 6a8ead842fc7ad948125c4ed3f52e7add082d82b Mon Sep 17 00:00:00 2001
From: MASES Public Developers Team
<94312179+masesdevelopers@users.noreply.github.com>
Date: Mon, 21 Nov 2022 03:39:45 +0100
Subject: [PATCH] Remove dependencies from knet connect sdk of jnet types (Map,
Collection, etc) (#127)
* #92: upgrade to JNet 1.4.15
* #125: upgrade API to remove usage of Java types like Map, Collection and so on
* #125: test upgrade
---
.../BridgedClasses/Connect/KNetConnector.cs | 47 ++++++++++++++-----
.../BridgedClasses/Connect/KNetSinkTask.cs | 7 ++-
.../Connect/KNetSourceConnector.cs | 9 ++--
.../BridgedClasses/Connect/KNetSourceTask.cs | 6 ++-
.../BridgedClasses/Connect/KNetTask.cs | 29 +++++++++---
src/net/KNet/KNet.csproj | 2 +-
.../knetConnectSink/KNetConnectSink.cs | 24 +++++-----
.../knetConnectSource/KNetConnectSource.cs | 33 +++++--------
tests/KNetConnectTest/KNetConnectSink.cs | 9 ++--
tests/KNetConnectTest/KNetConnectSource.cs | 22 +++------
10 files changed, 105 insertions(+), 83 deletions(-)
diff --git a/src/net/KNet/ClientSide/BridgedClasses/Connect/KNetConnector.cs b/src/net/KNet/ClientSide/BridgedClasses/Connect/KNetConnector.cs
index 00a5cbe3d9..1ff0c84670 100644
--- a/src/net/KNet/ClientSide/BridgedClasses/Connect/KNetConnector.cs
+++ b/src/net/KNet/ClientSide/BridgedClasses/Connect/KNetConnector.cs
@@ -19,10 +19,12 @@
using Java.Lang;
using Java.Util;
using MASES.JCOBridge.C2JBridge.JVMInterop;
+using MASES.JNet.Extensions;
using MASES.KNet.Common.Config;
using MASES.KNet.Connect.Connector;
using System;
using System.Collections.Concurrent;
+using System.Collections.Generic;
namespace MASES.KNet.Connect
{
@@ -31,6 +33,10 @@ namespace MASES.KNet.Connect
///
public interface IKNetConnector : IConnector
{
+ ///
+ /// The properties retrieved from
+ ///
+ IReadOnlyDictionary Properties { get; }
///
/// Allocates a task object based on
///
@@ -46,11 +52,16 @@ public interface IKNetConnector : IConnector
///
Type TaskClassType { get; }
///
+ /// Implement the method to execute the start action
+ ///
+ /// The set of properties returned from Apache Kafka Connect framework: the contains the same info from configuration file.
+ void Start(IReadOnlyDictionary props);
+ ///
/// Invoked during allocation of tasks from Apache Kafka Connect
///
/// The actual index
- /// The to be filled in with properties for the task: the same will be received from
- void TaskConfigs(int index, Map config);
+ /// The to be filled in with properties for the task: the same will be received from
+ void TaskConfigs(int index, IDictionary config);
}
///
/// The generic class which is the base of both source or sink connectors
@@ -125,6 +136,9 @@ protected T Context()
return ExecuteOnConnector("getContext");
}
+ ///
+ public IReadOnlyDictionary Properties { get; private set; }
+
///
public object AllocateTask(long taskId)
{
@@ -146,20 +160,21 @@ public object AllocateTask(long taskId)
public void Initialize(ConnectorContext ctx) => throw new NotImplementedException("Invoked in Java before any initialization.");
- public void Initialize(ConnectorContext ctx, List