-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1599 from chengyouling/develop-mq-gray
add rocketMq message gray plugin
- Loading branch information
Showing
16 changed files
with
1,401 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Configuration of MQ message grayscale | ||
grayscale.mq.config: | ||
# Whether to enable message grayscale. The default value is false | ||
enabled: false | ||
# Gray group information definition, each group contains consumerGroupTag、serviceMeta、trafficTag info. | ||
grayscale: | ||
# Gray consumer group tag. example, base group is basic_group, then gray group is basic_group_${consumerGroupTag} | ||
- consumerGroupTag: gray | ||
serviceMeta: | ||
# ServiceMeta match tag, if service_meta_parameters set x_lane_tag:gray, then current consumer is gray node. | ||
# If using service_meta_version for match info, config key must is 'version', as version:1.0.1 | ||
x_lane_tag: gray | ||
version: 1.0.1 | ||
trafficTag: | ||
# Traffic match info, this config effective with sermant-tag-transmission plugin, if request header has | ||
# x_lane_canary=gray and tag.transmission.config.matchRule.exact: ['x_lane_canary'], then will set as gray message | ||
x_lane_canary: gray | ||
# The relationship between serviceMeta and trafficTag is as follows: | ||
# If service_meta_parameters set x_lane_tag:gray when service started, then will match as gray instance. | ||
# 1、As producer, produce message will put 'x_lane_canary: gray' in message property as gray message. | ||
# 2、As consumer, only consume with 'x_lane_canary: gray' property messages. | ||
# Base group information definition | ||
base: | ||
# Base group consume message mode, contains BASE/AUTO, default 'AUTO' | ||
# BASE mode consumer will consume message that out of excludeGroupTags corresponding consumer group | ||
# AUTO mode consumer will consume message that out of excludeGroupTags corresponding consumer group and other | ||
# Running gray consumer group | ||
consumeMode: AUTO | ||
# Interval for checking gray consumer group information in auto consumer type | ||
autoCheckDelayTime: 15 | ||
# Tag of the gray consumer group to be excluded, corresponding value is above consumerGroupTag value | ||
# Auto/base consume mode all effective | ||
excludeGroupTags: ["gray"] |
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,60 @@ | ||
<?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-plugins</artifactId> | ||
<groupId>io.sermant</groupId> | ||
<version>1.0.0</version> | ||
</parent> | ||
|
||
<artifactId>sermant-mq-grayscale</artifactId> | ||
<name>sermant-mq-grayscale</name> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<sermant.basedir>${pom.basedir}/../../..</sermant.basedir> | ||
<package.plugin.name>mq-grayscale</package.plugin.name> | ||
<rocketmq-client.version>5.0.0</rocketmq-client.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.rocketmq</groupId> | ||
<artifactId>rocketmq-client</artifactId> | ||
<version>${rocketmq-client.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.rocketmq</groupId> | ||
<artifactId>rocketmq-common</artifactId> | ||
<version>${rocketmq-client.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<profiles> | ||
<profile> | ||
<id>agent</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<modules> | ||
<module>sermant-mq-grayscale-plugin</module> | ||
</modules> | ||
</profile> | ||
<profile> | ||
<id>test</id> | ||
<modules> | ||
<module>sermant-mq-grayscale-plugin</module> | ||
</modules> | ||
</profile> | ||
<profile> | ||
<id>release</id> | ||
<modules> | ||
<module>sermant-mq-grayscale-plugin</module> | ||
</modules> | ||
</profile> | ||
</profiles> | ||
</project> |
73 changes: 73 additions & 0 deletions
73
sermant-plugins/sermant-mq-grayscale/sermant-mq-grayscale-plugin/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,73 @@ | ||
<?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>sermant-mq-grayscale-plugin</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<config.skip.flag>false</config.skip.flag> | ||
<package.plugin.type>plugin</package.plugin.type> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.alibaba</groupId> | ||
<artifactId>fastjson</artifactId> | ||
</dependency> | ||
<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>org.apache.rocketmq</groupId> | ||
<artifactId>rocketmq-client</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.rocketmq</groupId> | ||
<artifactId>rocketmq-common</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-inline</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>8</source> | ||
<target>8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
63 changes: 63 additions & 0 deletions
63
...sermant-mq-grayscale-plugin/src/main/java/io/sermant/mq/grayscale/config/BaseMessage.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,63 @@ | ||
/* | ||
* 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.config; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* base consume mode entity | ||
* | ||
* @author chengyouling | ||
* @since 2024-05-27 | ||
**/ | ||
public class BaseMessage { | ||
/** | ||
* default value | ||
*/ | ||
private static final long DEFAULT = 15L; | ||
|
||
private ConsumeModeEnum consumeMode = ConsumeModeEnum.AUTO; | ||
|
||
private long autoCheckDelayTime = DEFAULT; | ||
|
||
private List<String> excludeGroupTags = new ArrayList<>(); | ||
|
||
public ConsumeModeEnum getConsumeMode() { | ||
return consumeMode; | ||
} | ||
|
||
public void setConsumeMode(ConsumeModeEnum consumeMode) { | ||
this.consumeMode = consumeMode; | ||
} | ||
|
||
public long getAutoCheckDelayTime() { | ||
return autoCheckDelayTime; | ||
} | ||
|
||
public void setAutoCheckDelayTime(long autoCheckDelayTime) { | ||
this.autoCheckDelayTime = autoCheckDelayTime; | ||
} | ||
|
||
public List<String> getExcludeGroupTags() { | ||
return excludeGroupTags; | ||
} | ||
|
||
public void setExcludeGroupTags(List<String> excludeGroupTags) { | ||
this.excludeGroupTags = excludeGroupTags; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...ant-mq-grayscale-plugin/src/main/java/io/sermant/mq/grayscale/config/ConsumeModeEnum.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,35 @@ | ||
/* | ||
* 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.config; | ||
|
||
/** | ||
* consume mode entity | ||
* | ||
* @author chengyouling | ||
* @since 2024-05-27 | ||
**/ | ||
public enum ConsumeModeEnum { | ||
/** | ||
* auto consume mode | ||
*/ | ||
AUTO, | ||
|
||
/** | ||
* base consume mode | ||
*/ | ||
BASE | ||
} |
Oops, something went wrong.