Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Jeepay
Commits
564613d5
Commit
564613d5
authored
Dec 16, 2021
by
dingzhiwei
Browse files
优化阿里云rocketMQ
parent
8a2c815d
Changes
7
Hide whitespace changes
Inline
Side-by-side
conf/devCommons/config/application.yml
View file @
564613d5
...
...
@@ -76,12 +76,12 @@ spring:
# producer:
# group: JEEPAY-GROUP
## 阿里云rocketmq配置 ( 注意:aliyun-rocketmq配置项请放置到根目录, 不是spring的二级配置! )
## 阿里云rocketmq配置 ( 注意:aliyun-rocketmq配置项请放置到根目录, 不是spring的二级配置!
需要阿里云开通rocketMQ产品,创建Group和Topic
)
#aliyun-rocketmq:
# namesrvAddr:
127.0.0.1:9876
# accessKey:
accessKey
# secretKey:
secretKey
#
p
ro
ducerId: JEEPAY-GROUP
# namesrvAddr:
xxx
# accessKey:
xxx
# secretKey:
xxx
#
g
ro
upId: GID_JEEPAY_T
#日志配置参数。
# 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。
...
...
@@ -98,7 +98,7 @@ isys:
allow-cors
:
true
#是否内存缓存配置信息: true表示开启如支付网关地址/商户应用配置/服务商配置等, 开启后需检查MQ的广播模式是否正常; false表示直接查询DB.
cache-config
:
fals
e
cache-config
:
tru
e
oss
:
file-root-path
:
/home/jeepay/upload
#存储根路径 ( 无需以‘/’结尾 )
...
...
conf/manager/application.yml
View file @
564613d5
...
...
@@ -86,14 +86,12 @@ spring:
# producer:
# group: JEEPAY-GROUP
## 阿里云rocketmq配置 ( 注意:aliyun-rocketmq配置项请放置到根目录, 不是spring的二级配置! )
## 阿里云rocketmq配置 ( 注意:aliyun-rocketmq配置项请放置到根目录, 不是spring的二级配置!
需要阿里云开通rocketMQ产品,创建Group和Topic
)
#aliyun-rocketmq:
# namesrvAddr: 127.0.0.1:9876
# accessKey: accessKey
# secretKey: secretKey
# consumerId: JEEPAY-GROUP-MGR
# broadcastConsumerId: JEEPAY-GROUP-MGR-BROADCAST # 广播模式消费者ID
# producerId: JEEPAY-GROUP
# namesrvAddr: xxx
# accessKey: xxx
# secretKey: xxx
# groupId: GID_JEEPAY_T
#日志配置参数。
# 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。
...
...
conf/merchant/application.yml
View file @
564613d5
...
...
@@ -86,14 +86,12 @@ spring:
# producer:
# group: JEEPAY-GROUP
## 阿里云rocketmq配置 ( 注意:aliyun-rocketmq配置项请放置到根目录, 不是spring的二级配置! )
## 阿里云rocketmq配置 ( 注意:aliyun-rocketmq配置项请放置到根目录, 不是spring的二级配置!
需要阿里云开通rocketMQ产品,创建Group和Topic
)
#aliyun-rocketmq:
# namesrvAddr: 127.0.0.1:9876
# accessKey: accessKey
# secretKey: secretKey
# consumerId: JEEPAY-GROUP-MCH
# broadcastConsumerId: JEEPAY-GROUP-MCH-BROADCAST # 广播模式消费者ID
# producerId: JEEPAY-GROUP
# namesrvAddr: xxx
# accessKey: xxx
# secretKey: xxx
# groupId: GID_JEEPAY_T
#日志配置参数。
# 当存在logback-spring.xml文件时: 该配置将引进到logback配置, springboot配置不生效。
...
...
conf/payment/application.yml
View file @
564613d5
...
...
@@ -86,14 +86,12 @@ spring:
# producer:
# group: JEEPAY-GROUP
## 阿里云rocketmq配置 ( 注意:aliyun-rocketmq配置项请放置到根目录, 不是spring的二级配置! )
## 阿里云rocketmq配置 ( 注意:aliyun-rocketmq配置项请放置到根目录, 不是spring的二级配置!
需要阿里云开通rocketMQ产品,创建Group和Topic
)
#aliyun-rocketmq:
# namesrvAddr: 127.0.0.1:9876
# accessKey: accessKey
# secretKey: secretKey
# consumerId: JEEPAY-GROUP-PAY
# broadcastConsumerId: JEEPAY-GROUP-PAY-BROADCAST # 广播模式消费者ID
# producerId: JEEPAY-GROUP
# namesrvAddr: xxx
# accessKey: xxx
# secretKey: xxx
# groupId: GID_JEEPAY_T
#日志配置参数。
...
...
jeepay-components/jeepay-components-mq/pom.xml
View file @
564613d5
...
...
@@ -51,7 +51,6 @@
<!-- <scope>provided</scope>-->
</dependency>
<!-- RabbitMQ -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/aliyunrocketmq/AbstractAliYunRocketMQReceiver.java
View file @
564613d5
...
...
@@ -48,7 +48,7 @@ public abstract class AbstractAliYunRocketMQReceiver implements IMQMsgReceiver,
public
Action
consume
(
Message
message
,
ConsumeContext
context
)
{
try
{
receiveMsg
(
new
String
(
message
.
getBody
()));
log
.
info
(
"【{}】MQ消息消费成功topic:{}, messageId:{}"
,
getConsumerName
(),
message
.
getTopic
(),
message
.
getMsgID
());
log
.
debug
(
"【{}】MQ消息消费成功topic:{}, messageId:{}"
,
getConsumerName
(),
message
.
getTopic
(),
message
.
getMsgID
());
return
Action
.
CommitMessage
;
}
catch
(
Exception
e
)
{
log
.
error
(
"【{}】MQ消息消费失败topic:{}, messageId:{}"
,
getConsumerName
(),
message
.
getTopic
(),
message
.
getMsgID
(),
e
);
...
...
jeepay-components/jeepay-components-mq/src/main/java/com/jeequan/jeepay/components/mq/vender/aliyunrocketmq/AliYunRocketMQFactory.java
View file @
564613d5
...
...
@@ -22,17 +22,13 @@ public class AliYunRocketMQFactory {
private
String
accessKey
;
@Value
(
"${aliyun-rocketmq.secretKey}"
)
private
String
secretKey
;
@Value
(
"${aliyun-rocketmq.consumerId}"
)
private
String
consumerId
;
@Value
(
"${aliyun-rocketmq.broadcastConsumerId}"
)
private
String
broadcastConsumerId
;
@Value
(
"${aliyun-rocketmq.producerId}"
)
private
String
producerId
;
@Value
(
"${aliyun-rocketmq.groupId}"
)
private
String
groupId
;
@Bean
(
name
=
"producerClient"
)
public
Producer
producerClient
()
{
Properties
properties
=
new
Properties
();
properties
.
put
(
PropertyKeyConst
.
ProducerId
,
p
ro
ducer
Id
);
properties
.
put
(
PropertyKeyConst
.
GROUP_ID
,
g
ro
up
Id
);
properties
.
put
(
PropertyKeyConst
.
AccessKey
,
accessKey
);
properties
.
put
(
PropertyKeyConst
.
SecretKey
,
secretKey
);
// 判断是否为空(生产环境走k8s集群环境变量自动注入,不获取本地配置文件的值)
...
...
@@ -45,7 +41,7 @@ public class AliYunRocketMQFactory {
@Bean
(
name
=
"consumerClient"
)
public
Consumer
consumerClient
()
{
Properties
properties
=
new
Properties
();
properties
.
put
(
PropertyKeyConst
.
ConsumerId
,
consumer
Id
);
properties
.
put
(
PropertyKeyConst
.
GROUP_ID
,
group
Id
);
properties
.
put
(
PropertyKeyConst
.
AccessKey
,
accessKey
);
properties
.
put
(
PropertyKeyConst
.
SecretKey
,
secretKey
);
// 判断是否为空(生产环境走k8s集群环境变量自动注入,不获取本地配置文件的值)
...
...
@@ -58,7 +54,7 @@ public class AliYunRocketMQFactory {
@Bean
(
name
=
"broadcastConsumerClient"
)
public
Consumer
broadcastConsumerClient
()
{
Properties
properties
=
new
Properties
();
properties
.
put
(
PropertyKeyConst
.
ConsumerId
,
b
ro
adcastConsumer
Id
);
properties
.
put
(
PropertyKeyConst
.
GROUP_ID
,
g
ro
up
Id
);
properties
.
put
(
PropertyKeyConst
.
AccessKey
,
accessKey
);
properties
.
put
(
PropertyKeyConst
.
SecretKey
,
secretKey
);
// 广播订阅方式设置
...
...
Write
Preview
Supports
Markdown
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