Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
751981f0
Commit
751981f0
authored
Feb 15, 2020
by
李秋伟
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 'feature_protocol'
Master See merge request mall/arch/matrix!54
parents
93b3963a
ff75eceb
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
288 additions
and
52 deletions
+288
-52
pom.xml
common-core/pom.xml
+1
-1
pom.xml
common-util/pom.xml
+1
-1
pom.xml
config-starter/pom.xml
+1
-1
pom.xml
elasticsearch-starter/pom.xml
+1
-1
pom.xml
logger-starter/pom.xml
+1
-1
pom.xml
matrix-datasource/matrix-datasource-core/pom.xml
+1
-1
pom.xml
matrix-datasource/matrix-datasource-druid/pom.xml
+1
-1
pom.xml
matrix-datasource/pom.xml
+2
-2
pom.xml
matrix-mq/matrix-rocketmq-core/pom.xml
+1
-1
pom.xml
matrix-mq/matrix-rocketmq-starter/pom.xml
+1
-1
pom.xml
matrix-mq/pom.xml
+1
-1
pom.xml
matrix-mybatis/matrix-mybatis-core/pom.xml
+1
-1
pom.xml
matrix-mybatis/matrix-mybatis-starter/pom.xml
+1
-1
pom.xml
matrix-mybatis/pom.xml
+4
-4
pom.xml
matrix-protocol/matrix-protocol-core/pom.xml
+1
-1
pom.xml
matrix-protocol/matrix-protocol-dubbo-core/pom.xml
+1
-1
pom.xml
matrix-protocol/matrix-protocol-dubbo-starter/pom.xml
+1
-1
pom.xml
matrix-protocol/matrix-protocol-web-core/pom.xml
+1
-1
pom.xml
matrix-protocol/matrix-protocol-web-starter/pom.xml
+1
-1
pom.xml
matrix-protocol/pom.xml
+6
-6
pom.xml
mongodb-starter/pom.xml
+1
-1
pom.xml
monitor-starter/pom.xml
+1
-1
pom.xml
openfeign-starter/pom.xml
+1
-1
pom.xml
pom.xml
+25
-19
pom.xml
redis-starter/pom.xml
+1
-1
pom.xml
rocketmq-starter/pom.xml
+31
-0
MatrixListenerContainerConfiguration.java
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/config/MatrixListenerContainerConfiguration.java
+44
-0
MatrixRocketMQAutoConfiguration.java
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/config/MatrixRocketMQAutoConfiguration.java
+60
-0
MatrixConsumeHook.java
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/hook/MatrixConsumeHook.java
+32
-0
MatrixProducerHook.java
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/hook/MatrixProducerHook.java
+33
-0
MartixProducer.java
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/producer/MartixProducer.java
+26
-0
spring.factories
rocketmq-starter/src/main/resources/META-INF/spring.factories
+4
-0
No files found.
common-core/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
common-util/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
config-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
elasticsearch-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
logger-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-datasource/matrix-datasource-core/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-datasource
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-datasource/matrix-datasource-druid/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-datasource
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-datasource/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
@@ -21,7 +21,7 @@
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-datasource-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
...
...
matrix-mq/matrix-rocketmq-core/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-mq
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-mq/matrix-rocketmq-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-mq
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-mq/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-mybatis/matrix-mybatis-core/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-mybatis
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-mybatis/matrix-mybatis-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-mybatis
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-mybatis/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
@@ -25,17 +25,17 @@
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-mybatis-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-datasource-druid
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-mybatis-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
...
...
matrix-protocol/matrix-protocol-core/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-protocol
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-protocol/matrix-protocol-dubbo-core/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-protocol
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-protocol/matrix-protocol-dubbo-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-protocol
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-protocol/matrix-protocol-web-core/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-protocol
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-protocol/matrix-protocol-web-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix-protocol
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
matrix-protocol/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
@@ -29,27 +29,27 @@
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-web-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-dubbo-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-web-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-dubbo-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<!-- Aapche Dubbo -->
...
...
mongodb-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
monitor-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
openfeign-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
pom.xml
View file @
751981f0
...
...
@@ -6,7 +6,7 @@
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
<packaging>
pom
</packaging>
...
...
@@ -24,6 +24,7 @@
<module>
config-starter
</module>
<module>
matrix-protocol
</module>
<module>
matrix-datasource
</module>
<module>
rocketmq-starter
</module>
</modules>
...
...
@@ -52,92 +53,97 @@
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
logger-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
monitor-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
common-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
config-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
common-util
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
redis-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-datasource-druid
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-mybatis-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
mongodb-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
elasticsearch-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-rocketmq-core
</artifactId>
<version>
1.2.10.RELEASE
</version>
<version>
1.2.11.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
rocketmq-starter
</artifactId>
<version>
1.2.11.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-rocketmq-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
openfeign-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-dubbo-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-dubbo-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-web-core
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-protocol-web-starter
</artifactId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</dependency>
<dependency>
...
...
redis-starter/pom.xml
View file @
751981f0
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.1
0
.RELEASE
</version>
<version>
1.2.1
1
.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
rocketmq-starter/pom.xml
0 → 100644
View file @
751981f0
<?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"
>
<parent>
<artifactId>
matrix
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.2.11.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
rocketmq-starter
</artifactId>
<dependencies>
<dependency>
<groupId>
org.apache.rocketmq
</groupId>
<artifactId>
rocketmq-spring-boot-starter
</artifactId>
<version>
2.0.3
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>
maven-source-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/config/MatrixListenerContainerConfiguration.java
0 → 100644
View file @
751981f0
package
com
.
secoo
.
mall
.
rocketmq
.
config
;
import
com.secoo.mall.rocketmq.hook.MatrixConsumeHook
;
import
org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* @author qianglu
*/
@Configuration
public
class
MatrixListenerContainerConfiguration
implements
BeanPostProcessor
{
private
final
static
Logger
log
=
LoggerFactory
.
getLogger
(
MatrixListenerContainerConfiguration
.
class
);
@Value
(
"${matrix.rocketmq.consumer.delayLevel:0}"
)
private
int
delayLevel
;
@Bean
MatrixConsumeHook
matrixConsumeHook
()
{
return
new
MatrixConsumeHook
();
}
@Override
public
Object
postProcessAfterInitialization
(
Object
bean
,
String
beanName
)
throws
BeansException
{
if
(
bean
instanceof
DefaultRocketMQListenerContainer
)
{
DefaultRocketMQListenerContainer
container
=
(
DefaultRocketMQListenerContainer
)
bean
;
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"MatrixListenerContainerConfiguration config setDelayLevelWhenNextConsume value:{}"
,
delayLevel
);
}
container
.
setDelayLevelWhenNextConsume
(
delayLevel
);
container
.
getConsumer
().
getDefaultMQPushConsumerImpl
().
registerConsumeMessageHook
(
matrixConsumeHook
());
}
return
bean
;
}
}
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/config/MatrixRocketMQAutoConfiguration.java
0 → 100644
View file @
751981f0
package
com
.
secoo
.
mall
.
rocketmq
.
config
;
import
com.secoo.mall.rocketmq.hook.MatrixProducerHook
;
import
com.secoo.mall.rocketmq.producer.MartixProducer
;
import
org.apache.rocketmq.acl.common.AclClientRPCHook
;
import
org.apache.rocketmq.acl.common.SessionCredentials
;
import
org.apache.rocketmq.client.AccessChannel
;
import
org.apache.rocketmq.client.producer.DefaultMQProducer
;
import
org.apache.rocketmq.spring.autoconfigure.RocketMQProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StringUtils
;
/**
* @author qianglu
*/
@Configuration
@Import
(
MatrixListenerContainerConfiguration
.
class
)
public
class
MatrixRocketMQAutoConfiguration
{
@Bean
public
DefaultMQProducer
defaultMQProducer
(
RocketMQProperties
rocketMQProperties
)
{
RocketMQProperties
.
Producer
producerConfig
=
rocketMQProperties
.
getProducer
();
String
nameServer
=
rocketMQProperties
.
getNameServer
();
String
groupName
=
producerConfig
.
getGroup
();
Assert
.
hasText
(
nameServer
,
"[rocketmq.name-server] must not be null"
);
Assert
.
hasText
(
groupName
,
"[rocketmq.producer.group] must not be null"
);
String
accessChannel
=
rocketMQProperties
.
getAccessChannel
();
MartixProducer
producer
;
String
ak
=
rocketMQProperties
.
getProducer
().
getAccessKey
();
String
sk
=
rocketMQProperties
.
getProducer
().
getSecretKey
();
MatrixProducerHook
matrixProducerHook
=
new
MatrixProducerHook
();
if
(!
StringUtils
.
isEmpty
(
ak
)
&&
!
StringUtils
.
isEmpty
(
sk
))
{
producer
=
new
MartixProducer
(
groupName
,
new
AclClientRPCHook
(
new
SessionCredentials
(
ak
,
sk
)),
rocketMQProperties
.
getProducer
().
isEnableMsgTrace
(),
rocketMQProperties
.
getProducer
().
getCustomizedTraceTopic
(),
matrixProducerHook
);
producer
.
setVipChannelEnabled
(
false
);
}
else
{
producer
=
new
MartixProducer
(
groupName
,
rocketMQProperties
.
getProducer
().
isEnableMsgTrace
(),
rocketMQProperties
.
getProducer
().
getCustomizedTraceTopic
(),
matrixProducerHook
);
}
producer
.
setNamesrvAddr
(
nameServer
);
if
(!
StringUtils
.
isEmpty
(
accessChannel
))
{
producer
.
setAccessChannel
(
AccessChannel
.
valueOf
(
accessChannel
));
}
producer
.
setSendMsgTimeout
(
producerConfig
.
getSendMessageTimeout
());
producer
.
setRetryTimesWhenSendFailed
(
producerConfig
.
getRetryTimesWhenSendFailed
());
producer
.
setRetryTimesWhenSendAsyncFailed
(
producerConfig
.
getRetryTimesWhenSendAsyncFailed
());
producer
.
setMaxMessageSize
(
producerConfig
.
getMaxMessageSize
());
producer
.
setCompressMsgBodyOverHowmuch
(
producerConfig
.
getCompressMessageBodyThreshold
());
producer
.
setRetryAnotherBrokerWhenNotStoreOK
(
producerConfig
.
isRetryNextServer
());
return
producer
;
}
}
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/hook/MatrixConsumeHook.java
0 → 100644
View file @
751981f0
package
com
.
secoo
.
mall
.
rocketmq
.
hook
;
import
org.apache.rocketmq.client.hook.ConsumeMessageContext
;
import
org.apache.rocketmq.client.hook.ConsumeMessageHook
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author qianglu
*/
public
class
MatrixConsumeHook
implements
ConsumeMessageHook
{
private
final
static
Logger
log
=
LoggerFactory
.
getLogger
(
MatrixConsumeHook
.
class
);
@Override
public
String
hookName
()
{
return
"MatrixConsumeHook"
;
}
@Override
public
void
consumeMessageBefore
(
ConsumeMessageContext
context
)
{
}
@Override
public
void
consumeMessageAfter
(
ConsumeMessageContext
context
)
{
try
{
log
.
info
(
"consumeMessageAfter,Succ:{} Topic:{},TraceContext:{},ConsumerGroup:{}"
,
context
.
isSuccess
(),
context
.
getMq
().
getTopic
(),
context
.
getMqTraceContext
(),
context
.
getConsumerGroup
());
}
catch
(
Exception
e
)
{
//防灾冗余
}
}
}
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/hook/MatrixProducerHook.java
0 → 100644
View file @
751981f0
package
com
.
secoo
.
mall
.
rocketmq
.
hook
;
import
org.apache.rocketmq.client.hook.SendMessageContext
;
import
org.apache.rocketmq.client.hook.SendMessageHook
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
* @author qianglu
*/
public
class
MatrixProducerHook
implements
SendMessageHook
{
private
final
static
Logger
log
=
LoggerFactory
.
getLogger
(
MatrixProducerHook
.
class
);
@Override
public
String
hookName
()
{
return
"MatrixProducerHook"
;
}
@Override
public
void
sendMessageBefore
(
SendMessageContext
context
)
{
}
@Override
public
void
sendMessageAfter
(
SendMessageContext
context
)
{
try
{
log
.
info
(
"sendMessageAfter,TraceContext:{},Mode:{},Topic:{},Targs:{},ProducerGroup:{},BrokerAddr:{},Namespace:{},Exception:{}"
,
context
.
getMqTraceContext
(),
context
.
getCommunicationMode
().
name
(),
context
.
getMessage
().
getTopic
(),
context
.
getMessage
().
getTags
(),
context
.
getProducerGroup
(),
context
.
getBrokerAddr
(),
context
.
getNamespace
(),
context
.
getException
()
==
null
?
null
:
context
.
getException
().
getMessage
());
}
catch
(
Exception
e
)
{
//防灾冗余}
}
}
}
\ No newline at end of file
rocketmq-starter/src/main/java/com/secoo/mall/rocketmq/producer/MartixProducer.java
0 → 100644
View file @
751981f0
package
com
.
secoo
.
mall
.
rocketmq
.
producer
;
import
org.apache.rocketmq.client.hook.SendMessageHook
;
import
org.apache.rocketmq.client.producer.DefaultMQProducer
;
import
org.apache.rocketmq.remoting.RPCHook
;
/**
* @author qianglu
*/
public
class
MartixProducer
extends
DefaultMQProducer
{
public
MartixProducer
(
final
String
producerGroup
,
RPCHook
rpcHook
,
boolean
enableMsgTrace
,
final
String
customizedTraceTopic
,
SendMessageHook
messageHook
)
{
super
(
producerGroup
,
rpcHook
,
enableMsgTrace
,
customizedTraceTopic
);
this
.
defaultMQProducerImpl
.
registerSendMessageHook
(
messageHook
);
}
public
MartixProducer
(
final
String
producerGroup
,
boolean
enableMsgTrace
,
final
String
customizedTraceTopic
,
SendMessageHook
messageHook
)
{
super
(
producerGroup
,
enableMsgTrace
,
customizedTraceTopic
);
this
.
defaultMQProducerImpl
.
registerSendMessageHook
(
messageHook
);
}
}
rocketmq-starter/src/main/resources/META-INF/spring.factories
0 → 100755
View file @
751981f0
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.secoo.mall.rocketmq.config.MatrixRocketMQAutoConfiguration
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment