apache / apache/rocketmq-externals

[rocketmq-connect-runtime : removeConnectorConfig not triggering listeners]

Open
#562 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
4.6k
Forks
3k
Avg merge
2h 33m
Merged PRs (30d)
1

Description

I noticed in removeConnectorConfig(),

```
@Override
public void removeConnectorConfig(String connectorName) {

ConnectKeyValue config = new ConnectKeyValue();
config.put(RuntimeConfigDefine.UPDATE_TIMESATMP, System.currentTimeMillis());
config.put(RuntimeConfigDefine.CONFIG_DELETED, 1);
Map connectorConfig = new HashMap<>();
connectorConfig.put(connectorName, config);

List taskConfigList = new ArrayList<>();
taskConfigList.add(config);

connectorKeyValueStore.put(connectorName, config);
putTaskConfigs(connectorName, taskConfigList);
sendSynchronizeConfig();
// TODO why not trigger listener ?
}
```

However in the recomputeTaskConfigs() called by putConnectorConfig(), after writing to the KeyValueStore, it would trigger the listeners (which is the RebalanceService and a new doRebalance would be executed on config update).

```
public void recomputeTaskConfigs(String connectorName, Connector connector, Long currentTimestamp) {
// TODO taskConfigs could be incorrect
List taskConfigs = connector.taskConfigs();
List converterdConfigs = new ArrayList<>();
for (KeyValue keyValue : taskConfigs) {
ConnectKeyValue newKeyValue = new ConnectKeyValue();
for (String key : keyValue.keySet()) {
newKeyValue.put(key, keyValue.getString(key));
}
newKeyValue.put(RuntimeConfigDefine.TASK_CLASS, connector.taskClass().getName());
newKeyValue.put(RuntimeConfigDefine.UPDATE_TIMESATMP, currentTimestamp);
converterdConfigs.add(newKeyValue);
}
putTaskConfigs(connectorName, converterdConfigs);
sendSynchronizeConfig();
triggerListener();
}
```
Wondering what is the design consideration not triggering the listener when removing the connectors.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.