Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
0f6d5671
Commit
0f6d5671
authored
Sep 18, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改MQ请求尸体,防止出错
parent
8e32744e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
MqService.java
...q/src/main/java/com/yanzuoguang/mq/service/MqService.java
+13
-3
MqServiceImpl.java
...n/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
+13
-0
No files found.
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/MqService.java
View file @
0f6d5671
...
@@ -3,13 +3,13 @@ package com.yanzuoguang.mq.service;
...
@@ -3,13 +3,13 @@ package com.yanzuoguang.mq.service;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Channel
;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
com.yanzuoguang.mq.vo.QueueVo
;
import
com.yanzuoguang.mq.vo.QueueVo
;
import
com.yanzuoguang.mq.vo.req.RegisterServerTokenReqVo
;
import
com.yanzuoguang.mq.vo.req.ServerMessageReqVo
;
import
com.yanzuoguang.mq.vo.req.ServerMessageReqVo
;
import
com.yanzuoguang.mq.vo.req.ServerQueueReqVo
;
import
com.yanzuoguang.mq.vo.req.ServerQueueReqVo
;
import
com.yanzuoguang.mq.vo.req.RegisterServerTokenReqVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.core.ChannelAwareMessageListener
;
import
org.springframework.amqp.rabbit.core.ChannelAwareMessageListener
;
import
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
;
/**
/**
* 消息队列服务
* 消息队列服务
...
@@ -74,12 +74,22 @@ public interface MqService {
...
@@ -74,12 +74,22 @@ public interface MqService {
/**
/**
* 建立当前服务器的队列
* 建立当前服务器的队列
*
*
* @param req
请求数据
* @param req 请求数据
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"建立当前服务器的队列"
)
@ApiOperation
(
value
=
"建立当前服务器的队列"
)
String
createServerQueue
(
ServerQueueReqVo
req
);
String
createServerQueue
(
ServerQueueReqVo
req
);
/**
* 动态注册消费者回调队列
*
* @param queueName 队列名称
* @param messageListener 消费者
* @return
*/
@ApiOperation
(
value
=
"动态注册消费者回调队列"
)
SimpleMessageListenerContainer
setQueueConsumer
(
String
queueName
,
ChannelAwareMessageListener
messageListener
);
/**
/**
* 注册当前消费队列的回调
* 注册当前消费队列的回调
*
*
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
View file @
0f6d5671
...
@@ -24,6 +24,7 @@ import com.yanzuoguang.util.log.Log;
...
@@ -24,6 +24,7 @@ import com.yanzuoguang.util.log.Log;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.core.ChannelAwareMessageListener
;
import
org.springframework.amqp.rabbit.core.ChannelAwareMessageListener
;
import
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -184,6 +185,18 @@ public class MqServiceImpl implements MqService, InitializingBean {
...
@@ -184,6 +185,18 @@ public class MqServiceImpl implements MqService, InitializingBean {
return
localQueueName
;
return
localQueueName
;
}
}
/**
* 动态注册消费者回调队列
*
* @param queueName 队列名称
* @param messageListener 消费者
* @return
*/
@Override
public
SimpleMessageListenerContainer
setQueueConsumer
(
String
queueName
,
ChannelAwareMessageListener
messageListener
)
{
return
this
.
mqConsumeDynamic
.
init
(
queueName
,
messageListener
);
}
/**
/**
* 注册当前消费队列的回调
* 注册当前消费队列的回调
*
*
...
...
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