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
4b36cc4e
Commit
4b36cc4e
authored
Aug 09, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实例化关系
parent
068a6d24
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
2 deletions
+48
-2
YzgMqConsumer.java
.../src/main/java/com/yanzuoguang/mq/plan/YzgMqConsumer.java
+0
-1
MqService.java
...q/src/main/java/com/yanzuoguang/mq/service/MqService.java
+17
-0
MqServiceImpl.java
...n/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
+31
-1
No files found.
yzg-util-mq/src/main/java/com/yanzuoguang/mq/plan/YzgMqConsumer.java
View file @
4b36cc4e
...
...
@@ -2,7 +2,6 @@ package com.yanzuoguang.mq.plan;
import
com.rabbitmq.client.Channel
;
import
com.yanzuoguang.mq.service.MqService
;
import
com.yanzuoguang.mq.service.QueueService
;
import
com.yanzuoguang.mq.vo.MessagePlan
;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
com.yanzuoguang.mq.vo.req.RegisterServerTokenReqVo
;
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/MqService.java
View file @
4b36cc4e
...
...
@@ -33,6 +33,23 @@ public interface MqService {
@ApiOperation
(
value
=
"发送消息"
)
String
message
(
MessageVo
req
);
/**
* 写入当前对象
*
* @param message 当前消息的内容
* @return
*/
@ApiOperation
(
value
=
"写入当前对象"
)
void
logCurrent
(
Message
message
);
/**
* 删除当前对象
*
* @return
*/
@ApiOperation
(
value
=
"写入当前对象"
)
void
logCurrentRemove
();
/**
* 记录一个消息已完成
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
View file @
4b36cc4e
...
...
@@ -21,6 +21,7 @@ import com.yanzuoguang.util.helper.UrlHelper;
import
com.yanzuoguang.util.log.Log
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.MessageProperties
;
import
org.springframework.amqp.rabbit.core.ChannelAwareMessageListener
;
import
org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
;
import
org.springframework.beans.BeansException
;
...
...
@@ -53,6 +54,8 @@ public class MqServiceImpl implements MqService, ApplicationContextAware, MqInit
private
YzgMqProcedure
yzgMqProcedure
;
private
String
localName
=
""
;
private
ThreadLocal
<
Message
>
localMessage
=
new
ThreadLocal
<>();
/**
* Set the ApplicationContext that this object runs in.
* Normally this call will be used to initialize the object.
...
...
@@ -118,6 +121,28 @@ public class MqServiceImpl implements MqService, ApplicationContextAware, MqInit
return
this
.
message
(
req
,
false
);
}
/**
* 写入当前对象
*
* @param message 当前消息的内容
* @return
*/
@Override
public
void
logCurrent
(
Message
message
)
{
localMessage
.
set
(
message
);
}
/**
* 删除当前对象
*
* @return
*/
@Override
public
void
logCurrentRemove
()
{
localMessage
.
remove
();
}
/**
* 记录一个消息已完成
*
...
...
@@ -125,7 +150,12 @@ public class MqServiceImpl implements MqService, ApplicationContextAware, MqInit
*/
@Override
public
String
log
()
{
throw
new
CodeException
(
"该函数暂时未实现"
);
Message
message
=
localMessage
.
get
();
if
(
message
==
null
)
{
throw
new
CodeException
(
"当前队列没有消息"
);
}
MessageProperties
messageProperties
=
message
.
getMessageProperties
();
return
this
.
log
(
new
MessageLogReqVo
(
messageProperties
.
getConsumerQueue
(),
messageProperties
.
getMessageId
()));
}
/**
...
...
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