From 2b95b636f04cd6cd5e81a126375648e8e1e3db21 Mon Sep 17 00:00:00 2001 From: pandaapo <1052156701@qq.com> Date: Sun, 21 May 2023 16:02:10 +0800 Subject: [PATCH 1/3] Main modification: suppot config in yaml format. --- .../common/config/ConfigService.java | 14 +- .../eventmesh/common/config/FileLoad.java | 106 ------------- .../eventmesh/common/file/BaseFileLoad.java | 44 ++++++ .../eventmesh/common/file/FileLoad.java | 55 +++++++ .../common/file/PropertiesFileLoad.java | 53 +++++++ .../eventmesh/common/file/YamlFileLoad.java | 67 +++++++++ .../eventmesh/common/utils/FileUtils.java | 74 +++++++++ eventmesh-runtime/conf/eventmesh.properties | 6 +- eventmesh-runtime/conf/eventmesh.yml | 141 ++++++++++++++++++ .../src/test/resources/eventmesh.properties | 2 +- .../webhook/api/WebHookOperationConstant.java | 2 +- .../src/test/resources/eventmesh.properties | 2 +- 12 files changed, 452 insertions(+), 114 deletions(-) delete mode 100644 eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java create mode 100644 eventmesh-common/src/main/java/org/apache/eventmesh/common/file/BaseFileLoad.java create mode 100644 eventmesh-common/src/main/java/org/apache/eventmesh/common/file/FileLoad.java create mode 100644 eventmesh-common/src/main/java/org/apache/eventmesh/common/file/PropertiesFileLoad.java create mode 100644 eventmesh-common/src/main/java/org/apache/eventmesh/common/file/YamlFileLoad.java create mode 100644 eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/FileUtils.java create mode 100644 eventmesh-runtime/conf/eventmesh.yml diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java index 4b938b16c1..97f5bd9a38 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigService.java @@ -17,6 +17,10 @@ package org.apache.eventmesh.common.config; +import org.apache.eventmesh.common.Constants; +import org.apache.eventmesh.common.file.FileLoad; +import org.apache.eventmesh.common.utils.FileUtils; + import org.apache.commons.lang3.StringUtils; import java.io.File; @@ -137,11 +141,17 @@ public T getConfig(ConfigInfo configInfo) throws IOException { } else { File file = new File(filePath); if (!file.exists()) { - throw new RuntimeException("file is not exists"); + if (StringUtils.isBlank(filePath = FileUtils.tryToFindOtherPropFile(filePath, file))) { + throw new RuntimeException("file is not exists"); + } + // Update the default or old value's suffix of related field in ConfigService and ConfigInfo. + path = path.replace(FileUtils.getExtension(path), FileUtils.getExtension(filePath)); + configInfo.setPath(path); + this.rootPath = path; } } - String suffix = path.substring(path.lastIndexOf('.') + 1); + String suffix = path.substring(path.lastIndexOf(Constants.DOT) + 1); configInfo.setFilePath(filePath); configInfo.setResourceUrl(resourceUrl); object = FileLoad.getFileLoad(suffix).getConfig(configInfo); diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java deleted file mode 100644 index 80cbf72a57..0000000000 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/FileLoad.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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.common.config; - -import org.apache.eventmesh.common.Constants; -import org.apache.eventmesh.common.config.convert.Convert; - -import org.apache.commons.lang3.StringUtils; - -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Objects; -import java.util.Properties; - -import org.yaml.snakeyaml.Yaml; - -/** - * load config from file - */ -public interface FileLoad { - - PropertiesFileLoad PROPERTIES_FILE_LOAD = new PropertiesFileLoad(); - - YamlFileLoad YAML_FILE_LOAD = new YamlFileLoad(); - - static FileLoad getFileLoad(String fileType) { - if (Objects.equals("properties", fileType)) { - return PROPERTIES_FILE_LOAD; - } else if (Objects.equals("yaml", fileType)) { - return YAML_FILE_LOAD; - } - return PROPERTIES_FILE_LOAD; - } - - static PropertiesFileLoad getPropertiesFileLoad() { - return PROPERTIES_FILE_LOAD; - } - - static YamlFileLoad getYamlFileLoad() { - return YAML_FILE_LOAD; - } - - T getConfig(ConfigInfo configInfo) throws IOException; - - class PropertiesFileLoad implements FileLoad { - - private final Convert convert = new Convert(); - - @SuppressWarnings("unchecked") - public T getConfig(ConfigInfo configInfo) throws IOException { - final Properties properties = new Properties(); - if (StringUtils.isNotBlank(configInfo.getResourceUrl())) { - try (BufferedReader reader = new BufferedReader(new InputStreamReader( - Objects.requireNonNull(getClass().getResourceAsStream(configInfo.getResourceUrl())), Constants.DEFAULT_CHARSET))) { - properties.load(reader); - } - } else { - try (BufferedReader reader = new BufferedReader( - new InputStreamReader(Files.newInputStream(Paths.get(configInfo.getFilePath())), Constants.DEFAULT_CHARSET))) { - properties.load(reader); - } - } - - if (Objects.isNull(configInfo.getClazz())) { - return (T) properties; - } - - return (T) convert.doConvert(configInfo, properties); - } - - @SuppressWarnings("unchecked") - public T getConfig(Properties properties, ConfigInfo configInfo) { - return (T) convert.doConvert(configInfo, properties); - } - } - - class YamlFileLoad implements FileLoad { - - @SuppressWarnings("unchecked") - @Override - public T getConfig(ConfigInfo configInfo) throws IOException { - Yaml yaml = new Yaml(); - return (T) yaml.loadAs(new BufferedInputStream(new FileInputStream(configInfo.getFilePath())), configInfo.getClazz()); - } - } -} diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/BaseFileLoad.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/BaseFileLoad.java new file mode 100644 index 0000000000..bac9a699be --- /dev/null +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/BaseFileLoad.java @@ -0,0 +1,44 @@ +/* + * 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.common.file; + +import org.apache.eventmesh.common.config.ConfigInfo; +import org.apache.eventmesh.common.config.convert.Convert; + +import java.util.Objects; +import java.util.Properties; + +/** + * Base class for {@link PropertiesFileLoad}, {@link YamlFileLoad} + */ +public abstract class BaseFileLoad { + + protected final Convert convert = new Convert(); + + @SuppressWarnings("unchecked") + public T getConfig(Properties properties, ConfigInfo configInfo) { + return (T) convert.doConvert(configInfo, properties); + } + + protected T convertIfNeed(Properties properties, ConfigInfo configInfo) { + if (Objects.isNull(configInfo.getClazz())) { + return (T) properties; + } + return (T) convert.doConvert(configInfo, properties); + } +} diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/FileLoad.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/FileLoad.java new file mode 100644 index 0000000000..7aaf65e2d0 --- /dev/null +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/FileLoad.java @@ -0,0 +1,55 @@ +/* + * 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.common.file; + +import org.apache.eventmesh.common.config.ConfigInfo; + +import org.apache.commons.lang3.StringUtils; + +import java.io.IOException; +import java.util.Objects; + +/** + * load config from file + */ +public interface FileLoad { + + PropertiesFileLoad PROPERTIES_FILE_LOAD = new PropertiesFileLoad(); + + YamlFileLoad YAML_FILE_LOAD = new YamlFileLoad(); + + static FileLoad getFileLoad(String fileType) { + if (Objects.equals("properties", fileType)) { + return PROPERTIES_FILE_LOAD; + } else if (StringUtils.equalsAny(fileType, "yaml", "yml")) { + return YAML_FILE_LOAD; + } + return PROPERTIES_FILE_LOAD; + } + + static PropertiesFileLoad getPropertiesFileLoad() { + return PROPERTIES_FILE_LOAD; + } + + static YamlFileLoad getYamlFileLoad() { + return YAML_FILE_LOAD; + } + + T getConfig(ConfigInfo configInfo) throws IOException; + +} diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/PropertiesFileLoad.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/PropertiesFileLoad.java new file mode 100644 index 0000000000..0cce1dc7ab --- /dev/null +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/PropertiesFileLoad.java @@ -0,0 +1,53 @@ +/* + * 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.common.file; + +import org.apache.eventmesh.common.Constants; +import org.apache.eventmesh.common.config.ConfigInfo; + +import org.apache.commons.lang3.StringUtils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Objects; +import java.util.Properties; + +public class PropertiesFileLoad extends BaseFileLoad implements FileLoad { + + @SuppressWarnings("unchecked") + @Override + public T getConfig(ConfigInfo configInfo) throws IOException { + final Properties properties = new Properties(); + if (StringUtils.isNotBlank(configInfo.getResourceUrl())) { + try (BufferedReader reader = new BufferedReader(new InputStreamReader( + Objects.requireNonNull(getClass().getResourceAsStream(configInfo.getResourceUrl())), Constants.DEFAULT_CHARSET))) { + properties.load(reader); + } + } else { + try (BufferedReader reader = new BufferedReader( + new InputStreamReader(Files.newInputStream(Paths.get(configInfo.getFilePath())), Constants.DEFAULT_CHARSET))) { + properties.load(reader); + } + } + return convertIfNeed(properties, configInfo); + } + +} diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/YamlFileLoad.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/YamlFileLoad.java new file mode 100644 index 0000000000..08e1d2f1ff --- /dev/null +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/file/YamlFileLoad.java @@ -0,0 +1,67 @@ +/* + * 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.common.file; + +import org.apache.eventmesh.common.config.ConfigInfo; + +import org.apache.commons.lang3.StringUtils; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.yaml.snakeyaml.Yaml; + +public class YamlFileLoad extends BaseFileLoad implements FileLoad { + + @Override + public T getConfig(ConfigInfo configInfo) throws IOException { + Yaml yaml = new Yaml(); + Properties properties = new Properties(); + if (StringUtils.isNotBlank(configInfo.getResourceUrl())) { + try (InputStream in = getClass().getResourceAsStream(configInfo.getResourceUrl())) { + Object data = yaml.load(in); + flatten("", data, properties); + } + } else { + try (FileInputStream in = new FileInputStream(configInfo.getFilePath())) { + Object data = yaml.load(in); + flatten("", data, properties); + } + } + return convertIfNeed(properties, configInfo); + } + + // Flatten the multi level structure(xxx.yyy.zzz) of the YAML file into a flat properties format + private static void flatten(String prefix, Object data, Properties props) { + if (data instanceof Map) { + Map map = (Map) data; + map.forEach((key, value) -> flatten(prefix + key + ".", value, props)); + } else if (data instanceof List) { + List list = (List) data; + for (int i = 0; i < list.size(); i++) { + flatten(prefix + "[" + i + "].", list.get(i), props); + } + } else { + props.put(prefix.substring(0, prefix.length() - 1), data.toString()); + } + } +} diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/FileUtils.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/FileUtils.java new file mode 100644 index 0000000000..ccde848c92 --- /dev/null +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/FileUtils.java @@ -0,0 +1,74 @@ +/* + * 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.common.utils; + +import org.apache.eventmesh.common.Constants; + +import org.apache.commons.lang3.StringUtils; + +import java.io.File; + +public class FileUtils { + + /** + * Get the suffix of file name. + * For example, /.../foo.yml -> .yml + * + * @param filename + * @return + */ + public static String getExtension(final String filename) { + if (StringUtils.isBlank(filename)) { + return ""; + } + final int lastSeparator = filename.lastIndexOf(File.separator); + final int extensionPos = filename.lastIndexOf(Constants.DOT); + final int index = lastSeparator > extensionPos ? -1 : extensionPos; + if (index == -1) { + return ""; + } else { + return filename.substring(index); + } + } + + /** + * When a certain type of configuration file does not exist, try to find other types of configuration files. + * Like ".properties", ".yaml" or ".yml". + * Return the new file path if exists, otherwise return "". + * + * @param filePath + * @param file + * @return + */ + public static String tryToFindOtherPropFile(String filePath, File file) { + String[] fileSuffixes = {".properties", ".yaml", ".yml"}; + int i = 0; + while (i < fileSuffixes.length) { + String fileSuffix = filePath.substring(filePath.lastIndexOf(Constants.DOT)); + if (!StringUtils.equals(fileSuffix, fileSuffixes[i])) { + filePath = filePath.replace(fileSuffix, fileSuffixes[i]); + file = new File(filePath); + if (file.exists()) { + return filePath; + } + } + i++; + } + return ""; + } +} diff --git a/eventmesh-runtime/conf/eventmesh.properties b/eventmesh-runtime/conf/eventmesh.properties index 4473c5cbd2..5b46867174 100644 --- a/eventmesh-runtime/conf/eventmesh.properties +++ b/eventmesh-runtime/conf/eventmesh.properties @@ -61,7 +61,7 @@ eventMesh.server.admin.http.port=10106 eventMesh.server.registry.registerIntervalInMills=10000 eventMesh.server.registry.fetchRegistryAddrIntervalInMills=20000 #auto-ack -#eventMesh.server.defibus.client.comsumeTimeoutInMin=5 +#eventMesh.server.defibus.client.consumeTimeoutInMin=5 #sleep interval between closing client of different group in server graceful shutdown eventMesh.server.gracefulShutdown.sleepIntervalInMills=1000 @@ -102,8 +102,8 @@ eventMesh.trace.plugin=zipkin eventMesh.webHook.admin.start=true # Webhook event configuration storage mode. Currently, only file and Nacos are supported eventMesh.webHook.operationMode=file -# The file storage path of the file storage mode. If #{eventmeshhome} is written, it is in the eventmesh root directory -eventMesh.webHook.fileMode.filePath= #{eventMeshHome}/webhook +# The file storage path of the file storage mode. If ${eventmeshhome} is written, it is in the eventmesh root directory +eventMesh.webHook.fileMode.filePath= ${eventMeshHome}/webhook # Nacos storage mode, and the configuration naming rule is eventmesh webHook. nacosMode. {nacos native configuration key} please see the specific configuration [nacos github api](https://github.com/alibaba/nacos/blob/develop/api/src/main/java/com/alibaba/nacos/api/SystemPropertyKeyConst.java) ## Address of Nacos eventMesh.webHook.nacosMode.serverAddr=127.0.0.1:8848 diff --git a/eventmesh-runtime/conf/eventmesh.yml b/eventmesh-runtime/conf/eventmesh.yml new file mode 100644 index 0000000000..73b3166ee7 --- /dev/null +++ b/eventmesh-runtime/conf/eventmesh.yml @@ -0,0 +1,141 @@ +# +# 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. +# + +eventMesh: + server: + ############################### eventMesh-runtime ENV ################################# + idc: DEFAULT + env: PRD + provide: + protocols: HTTP,TCP,GRPC + cluster: COMMON + name: EVENTMESH-runtime + http: + port: 10105 + # flow control, include the global level and session level + msgReqnumPerSecond: 15000 + grpc: + port: 10205 + ########################## eventMesh tcp configuration ############################ + tcp: + enabled: true + port: 10002 + readerIdleSeconds: 120 + writerIdleSeconds: 120 + allIdleSeconds: 120 + clientMaxNum: 10000 + # client isolation time if the message send failure + pushFailIsolateTimeInMills: 30000 + # rebalance internal + RebalanceIntervalInMills: 30000 + # flow control, include the global level and session level + msgReqnumPerSecond: 15000 + taskHandleExecutorPoolSize: 8 + session: + # session expire time about client + expiredInMills: 60000 + # flow control, include the global level and session level + upstreamBufferSize: 20 + # for single event publish, maximum size allowed per event + maxEventSize: 1000 + # for batch event publish, maximum number of events allowed in one batch + maxEventBatchSize: 10 + global: + # thread number about global scheduler + scheduler: 5 + # retry + retry: + async: + pushRetryTimes: 3 + pushRetryDelayInMills: 500 + sync: + pushRetryTimes: 3 + pushRetryDelayInMills: 500 + pushRetryQueueSize: 10000 + # admin + admin: + http: + port: 10106 + # registry + registry: + registerIntervalInMills: 10000 + fetchRegistryAddrIntervalInMills: 20000 +# # auto-ack +# defibus: +# client: +# consumeTimeoutInMin: 5 + # sleep interval between closing client of different group in server graceful shutdown + gracefulShutdown: + sleepIntervalInMills: 1000 + rebalanceRedirect: + sleepIntervalInMills: 200 + # ip address blacklist + blacklist: + ipv4: 0.0.0.0/8,127.0.0.0/8,169.254.0.0/16,255.255.255.255/32 + ipv6: ::/128,::1/128,ff00::/8 + security: + enabled: false + trace: + enabled: false + sysid: 0000 + # connector plugin + connector: + plugin: + type: standalone + # storage plugin + storage: + plugin: + type: standalone + # security plugin + security: + plugin: + type: security + validation: + type: + token: false + publickey: '' + # registry plugin + registry: + plugin: + enabled: false + type: nacos + server-addr: 127.0.0.1:8848 + username: nacos + password: nacos + # metrics plugin, if you have multiple plugin, you can use ',' to split + metrics: + plugin: prometheus + # trace plugin + trace: + plugin: zipkin + # webhook + webHook: + admin: + # Start webhook admin service + start: true + # Webhook event configuration storage mode. Currently, only file and Nacos are supported + operationMode: file + fileMode: + # The file storage path of the file storage mode. If ${eventmeshhome} is written, it is in the eventmesh root directory + filePath: ${eventMeshHome}/webhook + # Nacos storage mode, and the configuration naming rule is eventmesh webHook. nacosMode. {nacos native configuration key} please see the specific configuration [nacos github api](https://github.com/alibaba/nacos/blob/develop/api/src/main/java/com/alibaba/nacos/api/SystemPropertyKeyConst.java) + ## Address of Nacos + nacosMode: + serverAddr: 127.0.0.1:8848 + # Webhook eventcloud sending mode. And eventmesh connector. plugin. The type configuration is the same + producer: + storage: standalone diff --git a/eventmesh-webhook/eventmesh-webhook-admin/src/test/resources/eventmesh.properties b/eventmesh-webhook/eventmesh-webhook-admin/src/test/resources/eventmesh.properties index cbf4371d87..d53e350d37 100644 --- a/eventmesh-webhook/eventmesh-webhook-admin/src/test/resources/eventmesh.properties +++ b/eventmesh-webhook/eventmesh-webhook-admin/src/test/resources/eventmesh.properties @@ -19,7 +19,7 @@ eventMesh.webHook.admin.start=true # Webhook event configuration storage mode. Currently, only file and Nacos are supported eventMesh.webHook.operationMode=file -# The file storage path of the file storage mode. If #{eventmeshhome} is written, it is in the eventmesh root directory +# The file storage path of the file storage mode. If ${eventmeshhome} is written, it is in the eventmesh root directory eventMesh.webHook.fileMode.filePath=. # Nacos storage mode, and the configuration naming rule is eventmesh webHook. nacosMode. {nacos native configuration key} please see the specific configuration [nacos github api](https://github.com/alibaba/nacos/blob/develop/api/src/main/java/com/alibaba/nacos/api/SystemPropertyKeyConst.java) ## Address of Nacos diff --git a/eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/WebHookOperationConstant.java b/eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/WebHookOperationConstant.java index d4386ded28..c84fb9fe2a 100644 --- a/eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/WebHookOperationConstant.java +++ b/eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/WebHookOperationConstant.java @@ -41,7 +41,7 @@ public class WebHookOperationConstant { public static final String OPERATION_MODE_NACOS = "nacos"; - public static final String EVENTMESH_HOME = "#{eventMeshHome}"; + public static final String EVENTMESH_HOME = "${eventMeshHome}"; public static String getFilePath(String filePath) { if (filePath.startsWith(EVENTMESH_HOME)) { diff --git a/eventmesh-webhook/eventmesh-webhook-receive/src/test/resources/eventmesh.properties b/eventmesh-webhook/eventmesh-webhook-receive/src/test/resources/eventmesh.properties index 90e359d581..ca514159a1 100644 --- a/eventmesh-webhook/eventmesh-webhook-receive/src/test/resources/eventmesh.properties +++ b/eventmesh-webhook/eventmesh-webhook-receive/src/test/resources/eventmesh.properties @@ -21,7 +21,7 @@ eventMesh.server.idc=DEFAULT eventMesh.webHook.admin.start=true # Webhook event configuration storage mode. Currently, only file and Nacos are supported eventMesh.webHook.operationMode=nacos -# The file storage path of the file storage mode. If #{eventmeshhome} is written, it is in the eventmesh root directory +# The file storage path of the file storage mode. If ${eventmeshhome} is written, it is in the eventmesh root directory eventMesh.webHook.fileMode.filePath=. # Nacos storage mode, and the configuration naming rule is eventmesh webHook. nacosMode. {nacos native configuration key} please see the specific configuration [nacos github api](https://github.com/alibaba/nacos/blob/develop/api/src/main/java/com/alibaba/nacos/api/SystemPropertyKeyConst.java) ## Address of Nacos From 290bb93741675a525aaf97b9ce33a5c0bb85e29d Mon Sep 17 00:00:00 2001 From: pandaapo <1052156701@qq.com> Date: Thu, 25 May 2023 17:10:23 +0800 Subject: [PATCH 2/3] Fix javadoc error in java 11. --- .../main/java/org/apache/eventmesh/common/utils/FileUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/FileUtils.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/FileUtils.java index ccde848c92..6a9a5a5371 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/FileUtils.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/FileUtils.java @@ -27,7 +27,7 @@ public class FileUtils { /** * Get the suffix of file name. - * For example, /.../foo.yml -> .yml + * For example, "/.../foo.yml" will return ".yml" * * @param filename * @return From 83fb56e0ded1a96073ef8f2e16ec9aec396a5eb1 Mon Sep 17 00:00:00 2001 From: pandaapo <1052156701@qq.com> Date: Sat, 8 Jul 2023 00:14:32 +0800 Subject: [PATCH 3/3] Modify comment. --- eventmesh-runtime/conf/eventmesh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eventmesh-runtime/conf/eventmesh.yml b/eventmesh-runtime/conf/eventmesh.yml index 73b3166ee7..d93e10bede 100644 --- a/eventmesh-runtime/conf/eventmesh.yml +++ b/eventmesh-runtime/conf/eventmesh.yml @@ -136,6 +136,6 @@ eventMesh: ## Address of Nacos nacosMode: serverAddr: 127.0.0.1:8848 - # Webhook eventcloud sending mode. And eventmesh connector. plugin. The type configuration is the same + # Webhook CloudEvent sending mode. This property is the same as the eventMesh.storage.plugin.type configuration. producer: storage: standalone