You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "zzxxiansheng (via GitHub)" <gi...@apache.org> on 2024/03/06 17:33:09 UTC
[PR] #51 config basic function and config ,runtime,store,cluster sql [eventmesh-dashboard]
zzxxiansheng opened a new pull request, #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516435014
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.storage;
+
+import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+
+/**
+ * store table operation
+ */
+@Mapper
+public interface StoreMapper {
+
+ @Insert("insert into store (cluster_id, store_id, store_type, host, runtime_id, topic_list, diff_type"
+ + ", port, jmx_port, start_timestamp, rack, status, endpoint_map ) VALUES ("
+ + "#{clusterId},#{storeId},#{storeType},#{host},#{runtimeId},#{topicList},#{diffType},#{port},#{jmxPort}"
+ + ",#{startTimestamp},#{rack},#{status},#{endpointMap})")
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ void addStorage(StoreEntity storeEntity);
+
+ @Update("update store set is_delete=1 where cluster_id=#{clusterId} and store_id=#{storeId}")
+ void deleteStoreByUnique(StoreEntity storeEntity);
+
+ @Select("select * from store where cluster_id=#{clusterId} and is_delete=0")
+ List<StoreEntity> selectStoreByCluster(StoreEntity storeEntity);
Review Comment:
Ok, I'll correct it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516771861
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java:
##########
@@ -17,9 +17,14 @@
package org.apache.eventmesh.dashboard.console.service.connector;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+
+import java.util.List;
+
/**
* Service providing data of connectors.
*/
Review Comment:
Because `data` is a quite broad concept, it'll be better to be precise about the scope of the concept in the naming.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517096722
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.yaml.snakeyaml.Yaml;
+
+@Service
+public class ConfigServiceImpl implements ConfigService {
+
+
+ @Autowired
+ ConfigMapper configMapper;
+
+ @Override
+ public String mapToYaml(Map<String, String> stringMap) {
+ Yaml yaml = new Yaml();
+ return yaml.dumpAsMap(stringMap);
+ }
+
+ @Override
+ public String mapToProperties(Map<String, String> stringMap) {
+ Properties properties = new Properties();
+ stringMap.forEach((key, value) -> {
+ properties.setProperty(key, value);
+ });
+ return properties.toString().replace(",", ",\n");
+ }
+
+ @Override
+ public Integer addConfig(ConfigEntity configEntity) {
+ return configMapper.addConfig(configEntity);
+ }
+
+ @Override
+ public Integer deleteConfig(ConfigEntity configEntity) {
+ return configMapper.deleteConfig(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity) {
+ return configMapper.selectByInstanceId(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity) {
+ return configMapper.selectDefaultConfig(configEntity);
+ }
+
+ @Override
+ public void updateConfig(ConfigEntity configEntity) {
+ configMapper.updateConfig(configEntity);
+ }
Review Comment:
I think my previous operation record function can be better implemented for this, the operation record can have every update or add the configured propertise or yaml format string, the user can copy the above content, paste it into the configuration yaml or propertise panel, we can convert these to input box format. It's going to be more flexible and efficient, don't you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516427560
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java:
##########
@@ -17,9 +17,14 @@
package org.apache.eventmesh.dashboard.console.service.connector;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+
+import java.util.List;
+
/**
* Service providing data of connectors.
*/
Review Comment:
I think just connectorEntity . Although it is a note written by Rao
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516431509
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.store.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity;
+import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper;
+import org.apache.eventmesh.dashboard.console.service.store.StoreService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class StoreServiceImpl implements StoreService {
+
+ @Autowired
+ private StoreMapper storeMapper;
+
+ @Override
+ public void addStorage(StoreEntity storeEntity) {
+ storeMapper.addStorage(storeEntity);
+ }
Review Comment:
I don't seem to understand what you mean, maybe you can be more specific, or more plain, thank you.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516771861
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java:
##########
@@ -17,9 +17,14 @@
package org.apache.eventmesh.dashboard.console.service.connector;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+
+import java.util.List;
+
/**
* Service providing data of connectors.
*/
Review Comment:
Because `data` is a quite broad concept, it'll be better to be precise about the scope of the concept in the naming and javadoc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516764315
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
> RPC a specific connector instance
which means initiating a web request from dashboard to service instance.
I have not been able to gain an understanding of the function of this class through its code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517610922
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/TopicConfigService.java:
##########
@@ -22,6 +22,9 @@
import java.util.List;
import org.springframework.stereotype.Service;
+/**
+ * TODO Pending interfaces
+ */
@Service
Review Comment:
Well, missing a new line before javadoc here. Anyway😂
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517233280
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
this class just want to get a Series of Config message from a instance.I don't know the specific implementation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517423414
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
This class should be placed in `service` module. Or you may leave a javadoc and do it latter.
Also, EventMesh doesn't support to "get" configs from a running connector instance. Only Runtime instance supports this feature.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517436017
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
> This class should be placed in module. Or you may leave a javadoc and do it latter.service
ok,I choose leave a javadoc,are the other classes in the same category as it?
> Also, EventMesh doesn't support to "get" configs from a running connector instance. Only Runtime instance supports this feature.
ok,I know.Let's keep it for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517574100
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
Let's keep these classes for now and leave javadocs to record their usage and migration plan.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516424588
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SynchronousConnectorConfigTask.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.synchronous;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigController;
+import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SynchronousConnectorConfigTask {
+
+ @Autowired
+ private ConnectorDataService connectorDataService;
+
+ @Autowired
+ private ConnectorConfigController connectorConfigController;
+ @Autowired
+ private ConfigService configService;
+
+ public void synchronousConnectorConfig(Long clusterId) {
+ List<ConnectorEntity> connectorEntities = connectorDataService.selectConnectorByCluster(clusterId);
+ for (ConnectorEntity connectorEntity : connectorEntities) {
+
+ ConcurrentHashMap<String, String> connectorConfigMapFromInstance = this.configListToMap(
+ connectorConfigController.getConnectorConfigFromInstance(clusterId, connectorEntity.getId()));
+
+ ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, connectorEntity.getId());
+
+ ConcurrentHashMap<String, String> connectorConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
+
+ ConcurrentHashMap<String, String> updateConfigMap = new ConcurrentHashMap<>();
+
+ connectorConfigMapFromInstance.entrySet().forEach(n -> {
+ if (connectorConfigMapFromDb.remove(n.getKey(), n.getValue())) {
+ connectorConfigMapFromInstance.remove(n.getKey());
+ }
+ if (connectorConfigMapFromDb.get(n.getKey()) != null) {
+ updateConfigMap.put(n.getKey(), connectorConfigMapFromDb.get(n.getKey()));
+ connectorConfigMapFromInstance.remove(n.getKey());
+ connectorConfigMapFromDb.remove(n.getKey());
+ }
+ });
+ //add connectorConfigMapFromDb
+
+ //update updateConfigMap
+
+ //delete connectorConfigMapFromInstance
+ }
+ }
+
+ public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
+ ConcurrentHashMap<String, String> connectorConfigMap = new ConcurrentHashMap<>();
+ configEntityList.forEach(n -> {
+ connectorConfigMap.put(n.getConfigName(), n.getConfigValue());
+ }
+ );
+ return connectorConfigMap;
+ }
+
Review Comment:
ok,I will decorated it with private
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516379745
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.store.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity;
+import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper;
+import org.apache.eventmesh.dashboard.console.service.store.StoreService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class StoreServiceImpl implements StoreService {
+
+ @Autowired
+ private StoreMapper storeMapper;
+
+ @Override
+ public void addStorage(StoreEntity storeEntity) {
+ storeMapper.addStorage(storeEntity);
+ }
Review Comment:
Event Store is a specific concept and it should be unified here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516774915
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.store.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity;
+import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper;
+import org.apache.eventmesh.dashboard.console.service.store.StoreService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class StoreServiceImpl implements StoreService {
+
+ @Autowired
+ private StoreMapper storeMapper;
+
+ @Override
+ public void addStorage(StoreEntity storeEntity) {
+ storeMapper.addStorage(storeEntity);
+ }
Review Comment:
which means to unify `Storage` to `Store`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia merged PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517423414
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
This class should be placed in `service` module. Or you may leave a javadoc and do it latter.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517404952
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.yaml.snakeyaml.Yaml;
+
+@Service
+public class ConfigServiceImpl implements ConfigService {
+
+
+ @Autowired
+ ConfigMapper configMapper;
+
+ @Override
+ public String mapToYaml(Map<String, String> stringMap) {
+ Yaml yaml = new Yaml();
+ return yaml.dumpAsMap(stringMap);
+ }
+
+ @Override
+ public String mapToProperties(Map<String, String> stringMap) {
+ Properties properties = new Properties();
+ stringMap.forEach((key, value) -> {
+ properties.setProperty(key, value);
+ });
+ return properties.toString().replace(",", ",\n");
+ }
+
+ @Override
+ public Integer addConfig(ConfigEntity configEntity) {
+ return configMapper.addConfig(configEntity);
+ }
+
+ @Override
+ public Integer deleteConfig(ConfigEntity configEntity) {
+ return configMapper.deleteConfig(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity) {
+ return configMapper.selectByInstanceId(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity) {
+ return configMapper.selectDefaultConfig(configEntity);
+ }
+
+ @Override
+ public void updateConfig(ConfigEntity configEntity) {
+ configMapper.updateConfig(configEntity);
+ }
Review Comment:
alright
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516407875
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SynchronousConnectorConfigTask.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.synchronous;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigController;
+import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SynchronousConnectorConfigTask {
+
+ @Autowired
Review Comment:
ok ,your are right,The task is to synchronize the database configuration to the instance, and I'll rename the class。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516639592
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SynchronousConnectorConfigTask.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.synchronous;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigController;
+import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SynchronousConnectorConfigTask {
+
+ @Autowired
+ private ConnectorDataService connectorDataService;
+
+ @Autowired
+ private ConnectorConfigController connectorConfigController;
+ @Autowired
+ private ConfigService configService;
+
+ public void synchronousConnectorConfig(Long clusterId) {
+ List<ConnectorEntity> connectorEntities = connectorDataService.selectConnectorByCluster(clusterId);
+ for (ConnectorEntity connectorEntity : connectorEntities) {
+
+ ConcurrentHashMap<String, String> connectorConfigMapFromInstance = this.configListToMap(
+ connectorConfigController.getConnectorConfigFromInstance(clusterId, connectorEntity.getId()));
+
+ ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, connectorEntity.getId());
+
+ ConcurrentHashMap<String, String> connectorConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
+
+ ConcurrentHashMap<String, String> updateConfigMap = new ConcurrentHashMap<>();
+
+ connectorConfigMapFromInstance.entrySet().forEach(n -> {
+ if (connectorConfigMapFromDb.remove(n.getKey(), n.getValue())) {
+ connectorConfigMapFromInstance.remove(n.getKey());
+ }
+ if (connectorConfigMapFromDb.get(n.getKey()) != null) {
+ updateConfigMap.put(n.getKey(), connectorConfigMapFromDb.get(n.getKey()));
+ connectorConfigMapFromInstance.remove(n.getKey());
+ connectorConfigMapFromDb.remove(n.getKey());
+ }
+ });
+ //add connectorConfigMapFromDb
+
+ //update updateConfigMap
+
+ //delete connectorConfigMapFromInstance
+ }
+ }
+
+ public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
+ ConcurrentHashMap<String, String> connectorConfigMap = new ConcurrentHashMap<>();
+ configEntityList.forEach(n -> {
+ connectorConfigMap.put(n.getConfigName(), n.getConfigValue());
+ }
+ );
+ return connectorConfigMap;
+ }
+
Review Comment:
No, it's not a tooling method. It is derived from the need to echo the configuration of a string in the form of yaml or propertise and is a functional method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517421593
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/connection/ConnectionMapper.java:
##########
@@ -35,6 +35,9 @@
@Mapper
public interface ConnectionMapper {
+ @Select("select COUNT(*) from connection where cluster_id=#{clusterId}")
Review Comment:
Upper case SQL
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1517436017
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
> This class should be placed in module. Or you may leave a javadoc and do it latter.service
ok,I choose leave a javadoc,are the other classes in the same category as it?
> Also, EventMesh doesn't support to "get" configs from a running connector instance. Only Runtime instance supports this feature.
ok,I know.Let's keep it for now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516759825
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.yaml.snakeyaml.Yaml;
+
+@Service
+public class ConfigServiceImpl implements ConfigService {
+
+
+ @Autowired
+ ConfigMapper configMapper;
+
+ @Override
+ public String mapToYaml(Map<String, String> stringMap) {
+ Yaml yaml = new Yaml();
+ return yaml.dumpAsMap(stringMap);
+ }
+
+ @Override
+ public String mapToProperties(Map<String, String> stringMap) {
+ Properties properties = new Properties();
+ stringMap.forEach((key, value) -> {
+ properties.setProperty(key, value);
+ });
+ return properties.toString().replace(",", ",\n");
+ }
+
+ @Override
+ public Integer addConfig(ConfigEntity configEntity) {
+ return configMapper.addConfig(configEntity);
+ }
+
+ @Override
+ public Integer deleteConfig(ConfigEntity configEntity) {
+ return configMapper.deleteConfig(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity) {
+ return configMapper.selectByInstanceId(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity) {
+ return configMapper.selectDefaultConfig(configEntity);
+ }
+
+ @Override
+ public void updateConfig(ConfigEntity configEntity) {
+ configMapper.updateConfig(configEntity);
+ }
Review Comment:
When configuration is edited, the new configs should be applied to a new service instance. However, if the new service instance failed to startup, then users will lose their old configs.
Add a new config record and mark the old config record as `deleted` will be easier to collect config logs. What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516345052
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/storage/StoreMapper.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.mapper.storage;
+
+import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Options;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.List;
+
+/**
+ * store table operation
+ */
+@Mapper
+public interface StoreMapper {
+
+ @Insert("insert into store (cluster_id, store_id, store_type, host, runtime_id, topic_list, diff_type"
+ + ", port, jmx_port, start_timestamp, rack, status, endpoint_map ) VALUES ("
+ + "#{clusterId},#{storeId},#{storeType},#{host},#{runtimeId},#{topicList},#{diffType},#{port},#{jmxPort}"
+ + ",#{startTimestamp},#{rack},#{status},#{endpointMap})")
+ @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
+ void addStorage(StoreEntity storeEntity);
+
+ @Update("update store set is_delete=1 where cluster_id=#{clusterId} and store_id=#{storeId}")
+ void deleteStoreByUnique(StoreEntity storeEntity);
+
+ @Select("select * from store where cluster_id=#{clusterId} and is_delete=0")
+ List<StoreEntity> selectStoreByCluster(StoreEntity storeEntity);
Review Comment:
Better unify with @Lambert-Rao's code and use upper case letters for operaions like `SELECT FROM` in SQL.
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/connector/ConnectorDataService.java:
##########
@@ -17,9 +17,14 @@
package org.apache.eventmesh.dashboard.console.service.connector;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+
+import java.util.List;
+
/**
* Service providing data of connectors.
*/
Review Comment:
Could you please specify what type of data is processed in this service?
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.yaml.snakeyaml.Yaml;
+
+@Service
+public class ConfigServiceImpl implements ConfigService {
+
+
+ @Autowired
+ ConfigMapper configMapper;
+
+ @Override
+ public String mapToYaml(Map<String, String> stringMap) {
+ Yaml yaml = new Yaml();
+ return yaml.dumpAsMap(stringMap);
+ }
+
+ @Override
+ public String mapToProperties(Map<String, String> stringMap) {
+ Properties properties = new Properties();
+ stringMap.forEach((key, value) -> {
+ properties.setProperty(key, value);
+ });
+ return properties.toString().replace(",", ",\n");
+ }
+
+ @Override
+ public Integer addConfig(ConfigEntity configEntity) {
+ return configMapper.addConfig(configEntity);
+ }
+
+ @Override
+ public Integer deleteConfig(ConfigEntity configEntity) {
+ return configMapper.deleteConfig(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity) {
+ return configMapper.selectByInstanceId(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity) {
+ return configMapper.selectDefaultConfig(configEntity);
+ }
+
+ @Override
+ public void updateConfig(ConfigEntity configEntity) {
+ configMapper.updateConfig(configEntity);
+ }
Review Comment:
When will we update a config instead of creating a new one?
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
Do you want to RPC a specific connector instance for its configuration in this class?
A `Controller` class annotated with `@Service` seems incongruous.
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SynchronousConnectorConfigTask.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.synchronous;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigController;
+import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SynchronousConnectorConfigTask {
+
+ @Autowired
Review Comment:
If this task emphasizes the process of transferring data from one end to the other, then `Sync...Task` is better. Otherwise, it conveys the idea that operations will be performed serially.
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/store/Impl/StoreServiceImpl.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.store.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.storage.StoreEntity;
+import org.apache.eventmesh.dashboard.console.mapper.storage.StoreMapper;
+import org.apache.eventmesh.dashboard.console.service.store.StoreService;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class StoreServiceImpl implements StoreService {
+
+ @Autowired
+ private StoreMapper storeMapper;
+
+ @Override
+ public void addStorage(StoreEntity storeEntity) {
+ storeMapper.addStorage(storeEntity);
+ }
Review Comment:
Event Store is a specific conception and it should be unified here.
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SynchronousConnectorConfigTask.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.synchronous;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigController;
+import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SynchronousConnectorConfigTask {
+
+ @Autowired
+ private ConnectorDataService connectorDataService;
+
+ @Autowired
+ private ConnectorConfigController connectorConfigController;
+ @Autowired
+ private ConfigService configService;
+
+ public void synchronousConnectorConfig(Long clusterId) {
+ List<ConnectorEntity> connectorEntities = connectorDataService.selectConnectorByCluster(clusterId);
+ for (ConnectorEntity connectorEntity : connectorEntities) {
+
+ ConcurrentHashMap<String, String> connectorConfigMapFromInstance = this.configListToMap(
+ connectorConfigController.getConnectorConfigFromInstance(clusterId, connectorEntity.getId()));
+
+ ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, connectorEntity.getId());
+
+ ConcurrentHashMap<String, String> connectorConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
+
+ ConcurrentHashMap<String, String> updateConfigMap = new ConcurrentHashMap<>();
+
+ connectorConfigMapFromInstance.entrySet().forEach(n -> {
+ if (connectorConfigMapFromDb.remove(n.getKey(), n.getValue())) {
+ connectorConfigMapFromInstance.remove(n.getKey());
+ }
+ if (connectorConfigMapFromDb.get(n.getKey()) != null) {
+ updateConfigMap.put(n.getKey(), connectorConfigMapFromDb.get(n.getKey()));
+ connectorConfigMapFromInstance.remove(n.getKey());
+ connectorConfigMapFromDb.remove(n.getKey());
+ }
+ });
+ //add connectorConfigMapFromDb
+
+ //update updateConfigMap
+
+ //delete connectorConfigMapFromInstance
+ }
+ }
+
+ public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
+ ConcurrentHashMap<String, String> connectorConfigMap = new ConcurrentHashMap<>();
+ configEntityList.forEach(n -> {
+ connectorConfigMap.put(n.getConfigName(), n.getConfigValue());
+ }
+ );
+ return connectorConfigMap;
+ }
+
Review Comment:
Utility methods should be decorated with `private` namespace or moved to util class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516414756
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/Impl/ConfigServiceImpl.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.Impl;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.mapper.config.ConfigMapper;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.yaml.snakeyaml.Yaml;
+
+@Service
+public class ConfigServiceImpl implements ConfigService {
+
+
+ @Autowired
+ ConfigMapper configMapper;
+
+ @Override
+ public String mapToYaml(Map<String, String> stringMap) {
+ Yaml yaml = new Yaml();
+ return yaml.dumpAsMap(stringMap);
+ }
+
+ @Override
+ public String mapToProperties(Map<String, String> stringMap) {
+ Properties properties = new Properties();
+ stringMap.forEach((key, value) -> {
+ properties.setProperty(key, value);
+ });
+ return properties.toString().replace(",", ",\n");
+ }
+
+ @Override
+ public Integer addConfig(ConfigEntity configEntity) {
+ return configMapper.addConfig(configEntity);
+ }
+
+ @Override
+ public Integer deleteConfig(ConfigEntity configEntity) {
+ return configMapper.deleteConfig(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectByInstanceId(ConfigEntity configEntity) {
+ return configMapper.selectByInstanceId(configEntity);
+ }
+
+ @Override
+ public List<ConfigEntity> selectDefaultConfig(ConfigEntity configEntity) {
+ return configMapper.selectDefaultConfig(configEntity);
+ }
+
+ @Override
+ public void updateConfig(ConfigEntity configEntity) {
+ configMapper.updateConfig(configEntity);
+ }
Review Comment:
When a user dynamically modifies the configuration, this is a modification to the database。If you are satisfied with this answer, it means that I understand your question correctly。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516422804
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/instanceoperation/ConnectorConfigController.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.instanceoperation;
+
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConnectorConfigController {
+
+ public List<ConfigEntity> getConnectorConfigFromInstance(Long clusterId, Long id) {
+ return null;
+ }
+}
Review Comment:
For the first question, I don't seem to understand what RPC is, it's just a rather vague interface. For the second question, I think it would be more appropriate to change the controller to service, and if there is a conflict with other classes, operation is fine
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "zzxxiansheng (via GitHub)" <gi...@apache.org>.
zzxxiansheng commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516424588
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SynchronousConnectorConfigTask.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.synchronous;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigController;
+import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SynchronousConnectorConfigTask {
+
+ @Autowired
+ private ConnectorDataService connectorDataService;
+
+ @Autowired
+ private ConnectorConfigController connectorConfigController;
+ @Autowired
+ private ConfigService configService;
+
+ public void synchronousConnectorConfig(Long clusterId) {
+ List<ConnectorEntity> connectorEntities = connectorDataService.selectConnectorByCluster(clusterId);
+ for (ConnectorEntity connectorEntity : connectorEntities) {
+
+ ConcurrentHashMap<String, String> connectorConfigMapFromInstance = this.configListToMap(
+ connectorConfigController.getConnectorConfigFromInstance(clusterId, connectorEntity.getId()));
+
+ ConfigEntity configEntity = this.getConfigEntityBelongInstance(clusterId, connectorEntity.getId());
+
+ ConcurrentHashMap<String, String> connectorConfigMapFromDb = this.configListToMap(configService.selectByInstanceId(configEntity));
+
+ ConcurrentHashMap<String, String> updateConfigMap = new ConcurrentHashMap<>();
+
+ connectorConfigMapFromInstance.entrySet().forEach(n -> {
+ if (connectorConfigMapFromDb.remove(n.getKey(), n.getValue())) {
+ connectorConfigMapFromInstance.remove(n.getKey());
+ }
+ if (connectorConfigMapFromDb.get(n.getKey()) != null) {
+ updateConfigMap.put(n.getKey(), connectorConfigMapFromDb.get(n.getKey()));
+ connectorConfigMapFromInstance.remove(n.getKey());
+ connectorConfigMapFromDb.remove(n.getKey());
+ }
+ });
+ //add connectorConfigMapFromDb
+
+ //update updateConfigMap
+
+ //delete connectorConfigMapFromInstance
+ }
+ }
+
+ public ConcurrentHashMap<String, String> configListToMap(List<ConfigEntity> configEntityList) {
+ ConcurrentHashMap<String, String> connectorConfigMap = new ConcurrentHashMap<>();
+ configEntityList.forEach(n -> {
+ connectorConfigMap.put(n.getConfigName(), n.getConfigValue());
+ }
+ );
+ return connectorConfigMap;
+ }
+
Review Comment:
ok,I will decorated it with private
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #51] Config Mgmt basic function and config,runtime,store,cluster SQL [eventmesh-dashboard]
Posted by "Pil0tXia (via GitHub)" <gi...@apache.org>.
Pil0tXia commented on code in PR #52:
URL: https://github.com/apache/eventmesh-dashboard/pull/52#discussion_r1516767359
##########
eventmesh-dashboard-console/src/main/java/org/apache/eventmesh/dashboard/console/service/config/synchronous/SynchronousConnectorConfigTask.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.eventmesh.dashboard.console.service.config.synchronous;
+
+import org.apache.eventmesh.dashboard.console.entity.config.ConfigEntity;
+import org.apache.eventmesh.dashboard.console.entity.connector.ConnectorEntity;
+import org.apache.eventmesh.dashboard.console.service.config.ConfigService;
+import org.apache.eventmesh.dashboard.console.service.config.instanceoperation.ConnectorConfigController;
+import org.apache.eventmesh.dashboard.console.service.connector.ConnectorDataService;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SynchronousConnectorConfigTask {
+
+ @Autowired
Review Comment:
In https://github.com/apache/eventmesh-dashboard/pull/52/commits/886c7541b760434ff2e534aa07a467149f49a164, `DB to Instance` can be explained in javadoc. I mean the renaming of `Synchronous` to `Sync`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org