Search in sources :

Example 31 with ConnectKeyValue

use of org.apache.rocketmq.connect.runtime.common.ConnectKeyValue in project rocketmq-externals by apache.

the class ConfigManagementServiceImpl method removeConnectorConfig.

@Override
public void removeConnectorConfig(String connectorName) {
    ConnectKeyValue config = connectorKeyValueStore.get(connectorName);
    config.put(RuntimeConfigDefine.UPDATE_TIMESTAMP, System.currentTimeMillis());
    config.put(RuntimeConfigDefine.CONFIG_DELETED, 1);
    List<ConnectKeyValue> taskConfigList = taskKeyValueStore.get(connectorName);
    taskConfigList.add(config);
    connectorKeyValueStore.put(connectorName, config);
    putTaskConfigs(connectorName, taskConfigList);
    log.info("[ISSUE #2027] After removal The configs are:\n" + getConnectorConfigs().toString());
    sendSynchronizeConfig();
    triggerListener();
}
Also used : ConnectKeyValue(org.apache.rocketmq.connect.runtime.common.ConnectKeyValue)

Example 32 with ConnectKeyValue

use of org.apache.rocketmq.connect.runtime.common.ConnectKeyValue in project rocketmq-externals by apache.

the class TransferUtils method toConnAndTaskConfigs.

public static ConnAndTaskConfigs toConnAndTaskConfigs(String json) {
    JSONObject jsonObject = JSON.parseObject(json, JSONObject.class);
    Map<String, String> connectorConfigs = (Map<String, String>) jsonObject.getObject("connector", Map.class);
    Map<String, String> taskConfigs = (Map<String, String>) jsonObject.getObject("task", Map.class);
    Map<String, ConnectKeyValue> transferedConnectorConfigs = new HashMap<>();
    for (String key : connectorConfigs.keySet()) {
        transferedConnectorConfigs.put(key, stringToKeyValue(connectorConfigs.get(key)));
    }
    Map<String, List<ConnectKeyValue>> transferedTasksConfigs = new HashMap<>();
    for (String key : taskConfigs.keySet()) {
        transferedTasksConfigs.put(key, stringToKeyValueList(taskConfigs.get(key)));
    }
    ConnAndTaskConfigs res = new ConnAndTaskConfigs();
    res.setConnectorConfigs(transferedConnectorConfigs);
    res.setTaskConfigs(transferedTasksConfigs);
    return res;
}
Also used : ConnectKeyValue(org.apache.rocketmq.connect.runtime.common.ConnectKeyValue) JSONObject(com.alibaba.fastjson.JSONObject) HashMap(java.util.HashMap) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap) ConnAndTaskConfigs(org.apache.rocketmq.connect.runtime.common.ConnAndTaskConfigs)

Example 33 with ConnectKeyValue

use of org.apache.rocketmq.connect.runtime.common.ConnectKeyValue in project rocketmq-externals by apache.

the class WorkerConnectorTest method testReconfigure.

@Test
public void testReconfigure() {
    ConnectKeyValue connectKeyValue = new ConnectKeyValue();
    connectKeyValue.put("test2", "value2");
    workerConnector.reconfigure(connectKeyValue);
    assertThat(workerConnector.getKeyValue().equals(connectKeyValue)).isEqualTo(true);
}
Also used : ConnectKeyValue(org.apache.rocketmq.connect.runtime.common.ConnectKeyValue) Test(org.junit.Test)

Aggregations

ConnectKeyValue (org.apache.rocketmq.connect.runtime.common.ConnectKeyValue)33 HashMap (java.util.HashMap)15 ArrayList (java.util.ArrayList)13 List (java.util.List)12 Test (org.junit.Test)12 Map (java.util.Map)9 ConnAndTaskConfigs (org.apache.rocketmq.connect.runtime.common.ConnAndTaskConfigs)8 Before (org.junit.Before)4 HashSet (java.util.HashSet)3 WorkerConnector (org.apache.rocketmq.connect.runtime.connectorwrapper.WorkerConnector)3 JSONObject (com.alibaba.fastjson.JSONObject)2 Connector (io.openmessaging.connector.api.Connector)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConnectConfig (org.apache.rocketmq.connect.runtime.config.ConnectConfig)2 DefaultConnectorContext (org.apache.rocketmq.connect.runtime.service.DefaultConnectorContext)2 PluginClassLoader (org.apache.rocketmq.connect.runtime.utils.PluginClassLoader)2 KeyValue (io.openmessaging.KeyValue)1 Task (io.openmessaging.connector.api.Task)1 Converter (io.openmessaging.connector.api.data.Converter)1 SinkTask (io.openmessaging.connector.api.sink.SinkTask)1