Search in sources :

Example 11 with ConnAndTaskConfigs

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

the class ConfigManagementServiceImpl method sendOnlineConfig.

private void sendOnlineConfig() {
    ConnAndTaskConfigs configs = new ConnAndTaskConfigs();
    configs.setConnectorConfigs(connectorKeyValueStore.getKVMap());
    configs.setTaskConfigs(taskKeyValueStore.getKVMap());
    dataSynchronizer.send(ConfigChangeEnum.ONLINE_KEY.name(), configs);
}
Also used : ConnAndTaskConfigs(org.apache.rocketmq.connect.runtime.common.ConnAndTaskConfigs)

Example 12 with ConnAndTaskConfigs

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

the class ConfigManagementServiceImpl method sendSynchronizeConfig.

private void sendSynchronizeConfig() {
    ConnAndTaskConfigs configs = new ConnAndTaskConfigs();
    configs.setConnectorConfigs(connectorKeyValueStore.getKVMap());
    configs.setTaskConfigs(taskKeyValueStore.getKVMap());
    dataSynchronizer.send(ConfigChangeEnum.CONFIG_CHANG_KEY.name(), configs);
}
Also used : ConnAndTaskConfigs(org.apache.rocketmq.connect.runtime.common.ConnAndTaskConfigs)

Example 13 with ConnAndTaskConfigs

use of org.apache.rocketmq.connect.runtime.common.ConnAndTaskConfigs 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)

Aggregations

ConnAndTaskConfigs (org.apache.rocketmq.connect.runtime.common.ConnAndTaskConfigs)13 List (java.util.List)8 ConnectKeyValue (org.apache.rocketmq.connect.runtime.common.ConnectKeyValue)8 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 Map (java.util.Map)5 Test (org.junit.Test)3 JSONObject (com.alibaba.fastjson.JSONObject)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Field (java.lang.reflect.Field)2 Method (java.lang.reflect.Method)2 SendCallback (org.apache.rocketmq.client.producer.SendCallback)2 Message (org.apache.rocketmq.common.message.Message)2 ConnectConfig (org.apache.rocketmq.connect.runtime.config.ConnectConfig)2 BrokerBasedLog (org.apache.rocketmq.connect.runtime.utils.datasync.BrokerBasedLog)2 DataSynchronizerCallback (org.apache.rocketmq.connect.runtime.utils.datasync.DataSynchronizerCallback)2 Before (org.junit.Before)2 Mockito.doAnswer (org.mockito.Mockito.doAnswer)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 Answer (org.mockito.stubbing.Answer)2