Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
station
YeeAmosFireAutoSysRoot
Commits
96b22d7e
Commit
96b22d7e
authored
May 24, 2022
by
maoying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加rocket启动配置
parent
7a7dcec2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
7 deletions
+73
-7
RocketMQService.java
...ejoin/amos/fas/business/service/impl/RocketMQService.java
+9
-0
MQProducerConfigure.java
...java/com/yeejoin/amos/fas/config/MQProducerConfigure.java
+7
-3
RedisConfig.java
...rc/main/java/com/yeejoin/amos/fas/config/RedisConfig.java
+1
-1
application-dev.properties
...utoSysStart/src/main/resources/application-dev.properties
+6
-3
application-docker.properties
...SysStart/src/main/resources/application-docker.properties
+25
-0
application-test.properties
...toSysStart/src/main/resources/application-test.properties
+25
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RocketMQService.java
View file @
96b22d7e
...
...
@@ -6,6 +6,7 @@ import org.apache.rocketmq.common.message.Message;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -15,11 +16,16 @@ import com.yeejoin.amos.fas.business.service.intfc.IRocketMQService;
public
class
RocketMQService
implements
IRocketMQService
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
RocketMQService
.
class
);
@Autowired
DefaultMQProducer
defaultMQProducer
;
@Value
(
"${rocketmq.producer.sysIsUsed}"
)
private
String
sysIsUsed
;
public
void
sendMsg
(
String
topic
,
String
tag
,
Object
msg
){
try
{
if
(
"on"
.
equalsIgnoreCase
(
sysIsUsed
)){
log
.
info
(
"rocketMQtopic===="
+
topic
);
log
.
info
(
"rocketMQmsg===="
+
JSON
.
toJSONString
(
msg
).
toString
());
...
...
@@ -27,6 +33,9 @@ public class RocketMQService implements IRocketMQService {
SendResult
sendResult
=
defaultMQProducer
.
send
(
sendMsg
);
log
.
info
(
"rocketMQsendResult===="
+
JSON
.
toJSONString
(
sendResult
).
toString
());
}
else
{
log
.
info
(
"rocketMQsendResult====rocketmq.producer.sysIsUsed is not on"
);
}
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
log
.
error
(
e
.
getMessage
(),
e
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/
business/feign
/MQProducerConfigure.java
→
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/
config
/MQProducerConfigure.java
View file @
96b22d7e
package
com
.
yeejoin
.
amos
.
fas
.
business
.
feign
;
package
com
.
yeejoin
.
amos
.
fas
.
config
;
import
lombok.Getter
;
...
...
@@ -14,8 +14,6 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
/**
* @author: lockie
* @Date: 2020/4/21 10:28
* @Description: mq生产者配置
*/
@Getter
...
...
@@ -35,6 +33,9 @@ public class MQProducerConfigure {
// 失败重试次数
private
Integer
retryTimesWhenSendFailed
;
// 是否启用rocketmq
private
String
sysIsUsed
;
/**
* mq 生成者配置
* @return
...
...
@@ -43,6 +44,7 @@ public class MQProducerConfigure {
@Bean
@ConditionalOnProperty
(
prefix
=
"rocketmq.producer"
,
value
=
"isOnOff"
,
havingValue
=
"on"
)
public
DefaultMQProducer
defaultProducer
()
throws
MQClientException
{
if
(
"on"
.
equalsIgnoreCase
(
sysIsUsed
)){
LOGGER
.
info
(
"defaultProducer 正在创建---------------------------------------"
);
DefaultMQProducer
producer
=
new
DefaultMQProducer
(
groupName
);
producer
.
setNamesrvAddr
(
namesrvAddr
);
...
...
@@ -54,4 +56,6 @@ public class MQProducerConfigure {
LOGGER
.
info
(
"rocketmq producer server 开启成功----------------------------------"
);
return
producer
;
}
return
new
DefaultMQProducer
(
groupName
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/config/Config.java
→
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/config/
Redis
Config.java
View file @
96b22d7e
...
...
@@ -27,7 +27,7 @@ import java.util.concurrent.ThreadPoolExecutor;
@Configuration
@EnableCaching
public
class
Config
{
public
class
Redis
Config
{
@Value
(
"${spring.redis.host}"
)
private
String
host
;
...
...
YeeAmosFireAutoSysStart/src/main/resources/application-dev.properties
View file @
96b22d7e
...
...
@@ -50,6 +50,11 @@ emqx.broker=tcp://172.16.11.201:1883
emqx.user-name
=
admin
emqx.password
=
public
#文件服务器地址
file.downLoad.url
=
http://172.16.11.201:9000/
# 是否使用rocketmq on/off
rocketmq.producer.sysIsUsed
=
off
#rocketmq生产者配置
# 是否开启自动配置
rocketmq.producer.isOnOff
=
on
...
...
@@ -67,10 +72,8 @@ rocketmq.producer.retryTimesWhenSendFailed=2
rocket-plan-topic
=
topic_fire_emergency_plan
rocket-equip-alarm-topic
=
topic_fire_equip_alarm
#文件服务器地址
file.downLoad.url
=
http://172.16.11.201:9000/
#规则ip配置,用于多网卡及docker镜像启动时添加
rule.definition.local-ip
=
172.16.11.201
#
rule.definition.local-ip=172.16.11.201
#3Dtype 分为web和ue
integrated3Dtype
=
web
YeeAmosFireAutoSysStart/src/main/resources/application-docker.properties
View file @
96b22d7e
...
...
@@ -52,3 +52,28 @@ emqx.password=public
#文件服务器地址
file.downLoad.url
=
http://39.98.246.31:8888/
# 是否使用rocketmq on/off
rocketmq.producer.sysIsUsed
=
off
#rocketmq生产者配置
# 是否开启自动配置
rocketmq.producer.isOnOff
=
on
# 发送同一类消息设置为同一个group,保证唯一默认不需要设置,rocketmq会使用ip@pid(pid代表jvm名字)作为唯一标识
rocketmq.producer.groupName
=
${spring.application.name}
# mq的nameserver地址
rocketmq.producer.namesrvAddr
=
172.16.3.51:9876
# 消息最大长度 默认 1024 * 4 (4M)
rocketmq.producer.maxMessageSize
=
4096
# 发送消息超时时间,默认 3000
rocketmq.producer.sendMsgTimeOut
=
30000
# 发送消息失败重试次数,默认2
rocketmq.producer.retryTimesWhenSendFailed
=
2
rocket-plan-topic
=
topic_fire_emergency_plan
rocket-equip-alarm-topic
=
topic_fire_equip_alarm
#规则ip配置,用于多网卡及docker镜像启动时添加
#rule.definition.local-ip=172.16.11.201
#3Dtype 分为web和ue
integrated3Dtype
=
web
YeeAmosFireAutoSysStart/src/main/resources/application-test.properties
View file @
96b22d7e
...
...
@@ -52,3 +52,28 @@ emqx.password=public
#文件服务器地址
file.downLoad.url
=
http://39.98.246.31:8888/
# 是否使用rocketmq on/off
rocketmq.producer.sysIsUsed
=
off
#rocketmq生产者配置
# 是否开启自动配置
rocketmq.producer.isOnOff
=
on
# 发送同一类消息设置为同一个group,保证唯一默认不需要设置,rocketmq会使用ip@pid(pid代表jvm名字)作为唯一标识
rocketmq.producer.groupName
=
${spring.application.name}
# mq的nameserver地址
rocketmq.producer.namesrvAddr
=
172.16.3.51:9876
# 消息最大长度 默认 1024 * 4 (4M)
rocketmq.producer.maxMessageSize
=
4096
# 发送消息超时时间,默认 3000
rocketmq.producer.sendMsgTimeOut
=
30000
# 发送消息失败重试次数,默认2
rocketmq.producer.retryTimesWhenSendFailed
=
2
rocket-plan-topic
=
topic_fire_emergency_plan
rocket-equip-alarm-topic
=
topic_fire_equip_alarm
#规则ip配置,用于多网卡及docker镜像启动时添加
#rule.definition.local-ip=172.16.11.201
#3Dtype 分为web和ue
integrated3Dtype
=
web
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