-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: chengyouling <spadgerlin888@163.com>
- Loading branch information
1 parent
a61202c
commit a8ff652
Showing
37 changed files
with
1,586 additions
and
95 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
sermant-plugins/sermant-mq-grayscale/mq-config-common/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>sermant-mq-grayscale</artifactId> | ||
<groupId>io.sermant</groupId> | ||
<version>1.0.0</version> | ||
</parent> | ||
|
||
<artifactId>mq-config-common</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.sermant</groupId> | ||
<artifactId>sermant-agentcore-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
47 changes: 47 additions & 0 deletions
47
sermant-plugins/sermant-mq-grayscale/mq-config-service/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>sermant-mq-grayscale</artifactId> | ||
<groupId>io.sermant</groupId> | ||
<version>1.0.0</version> | ||
</parent> | ||
|
||
<artifactId>mq-config-service</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<package.plugin.type>service</package.plugin.type> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.yaml</groupId> | ||
<artifactId>snakeyaml</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.sermant</groupId> | ||
<artifactId>sermant-agentcore-core</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.sermant</groupId> | ||
<artifactId>mq-config-common</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
50 changes: 50 additions & 0 deletions
50
...e/mq-config-service/src/main/java/io/sermant/mq/grayscale/listener/MqGrayConfigCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (C) 2024-2024 Sermant Authors. All rights reserved. | ||
* | ||
* Licensed 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 io.sermant.mq.grayscale.listener; | ||
|
||
import io.sermant.mq.grayscale.config.MqGrayscaleConfig; | ||
|
||
/** | ||
* grayscale config cache | ||
* | ||
* @author chengyouling | ||
* @since 2024-09-12 | ||
**/ | ||
public class MqGrayConfigCache { | ||
Check failure on line 27 in sermant-plugins/sermant-mq-grayscale/mq-config-service/src/main/java/io/sermant/mq/grayscale/listener/MqGrayConfigCache.java GitHub Actions / Checkstyle
|
||
private static MqGrayscaleConfig cacheConfig; | ||
|
||
/** | ||
* get cache mqGrayscaleConfig | ||
*/ | ||
public static MqGrayscaleConfig getCacheConfig() { | ||
Check failure on line 33 in sermant-plugins/sermant-mq-grayscale/mq-config-service/src/main/java/io/sermant/mq/grayscale/listener/MqGrayConfigCache.java GitHub Actions / Checkstyle
|
||
return cacheConfig; | ||
} | ||
|
||
/** | ||
* set cache mqGrayscaleConfig | ||
*/ | ||
public static void setCacheConfig(MqGrayscaleConfig config) { | ||
Check failure on line 40 in sermant-plugins/sermant-mq-grayscale/mq-config-service/src/main/java/io/sermant/mq/grayscale/listener/MqGrayConfigCache.java GitHub Actions / Checkstyle
|
||
cacheConfig = config; | ||
} | ||
|
||
/** | ||
* clear cache mqGrayscaleConfig | ||
*/ | ||
public static void clearCacheConfig() { | ||
cacheConfig = new MqGrayscaleConfig(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...fig-service/src/main/java/io/sermant/mq/grayscale/service/MqGrayDynamicConfigService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (C) 2024-2024 Sermant Authors. All rights reserved. | ||
* | ||
* Licensed 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 io.sermant.mq.grayscale.service; | ||
|
||
import io.sermant.core.common.LoggerFactory; | ||
import io.sermant.core.config.ConfigManager; | ||
import io.sermant.core.plugin.config.ServiceMeta; | ||
import io.sermant.core.plugin.service.PluginService; | ||
import io.sermant.core.plugin.subscribe.CommonGroupConfigSubscriber; | ||
import io.sermant.core.plugin.subscribe.ConfigSubscriber; | ||
import io.sermant.mq.grayscale.listener.MqGrayConfigListener; | ||
|
||
import java.util.logging.Logger; | ||
|
||
/** | ||
* grayscale dynamic config service | ||
* | ||
* @author chengyouling | ||
* @since 2024-05-27 | ||
**/ | ||
public class MqGrayDynamicConfigService implements PluginService { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(); | ||
|
||
@Override | ||
public void start() { | ||
ConfigSubscriber subscriber = new CommonGroupConfigSubscriber( | ||
ConfigManager.getConfig(ServiceMeta.class).getService(), new MqGrayConfigListener(), | ||
"mq-grayscale"); | ||
subscriber.subscribe(); | ||
LOGGER.info("Success to subscribe mq-grayscale config"); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...service/src/main/resources/META-INF/services/io.sermant.core.plugin.service.PluginService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# Copyright (C) 2024-2024 Sermant Authors. All rights reserved. | ||
# | ||
# Licensed 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. | ||
# | ||
|
||
io.sermant.mq.grayscale.service.MqGrayDynamicConfigService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.