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
fd2d9a49
Commit
fd2d9a49
authored
Aug 04, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日志只执行1次
parent
e2aed704
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
32 deletions
+18
-32
YzgMqConsumer.java
.../src/main/java/com/yanzuoguang/mq/plan/YzgMqConsumer.java
+1
-17
YzgMqProcedure.java
...src/main/java/com/yanzuoguang/mq/plan/YzgMqProcedure.java
+2
-0
MqServiceImpl.java
...n/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
+15
-15
No files found.
yzg-util-mq/src/main/java/com/yanzuoguang/mq/plan/YzgMqConsumer.java
View file @
fd2d9a49
...
...
@@ -11,7 +11,6 @@ import com.yanzuoguang.util.helper.JsonHelper;
import
com.yanzuoguang.util.log.Log
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -21,7 +20,7 @@ import org.springframework.stereotype.Component;
* @author 颜佐光
*/
@Component
public
class
YzgMqConsumer
implements
InitializingBean
{
public
class
YzgMqConsumer
{
@Autowired
private
MqService
mqService
;
...
...
@@ -32,21 +31,6 @@ public class YzgMqConsumer implements InitializingBean {
@Autowired
private
QueueService
queueService
;
/**
* Invoked by a BeanFactory after it has set all bean properties supplied
* (and satisfied BeanFactoryAware and ApplicationContextAware).
* <p>This method allows the bean instance to perform initialization only
* possible when all bean properties have been set and to throw an
* exception in the event of misconfiguration.
*
* @throws Exception in the event of misconfiguration (such
* as failure to set an essential property) or if initialization fails.
*/
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
yzgMqProcedure
.
clearLog
();
}
/**
* MQ回调
*
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/plan/YzgMqProcedure.java
View file @
fd2d9a49
...
...
@@ -71,6 +71,7 @@ public class YzgMqProcedure implements InitializingBean {
*/
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
System
.
out
.
println
(
"init"
);
mqService
.
createQueue
(
new
QueueVo
(
YZG_CLEAR_LOG
));
mqService
.
createQueue
(
new
QueueVo
(
YZG_MQ_SYSTEM_QUEUE
));
mqService
.
createQueue
(
new
QueueVo
(
YZG_MQ_SYSTEM_QUEUE_PLAN
));
...
...
@@ -95,6 +96,7 @@ public class YzgMqProcedure implements InitializingBean {
}
mqService
.
createQueue
(
new
QueueVo
(
getQueueName
(
item
),
item
.
unit
,
YZG_MQ_SYSTEM_QUEUE_PLAN
));
}
this
.
clearLog
();
}
/**
...
...
yzg-util-mq/src/main/java/com/yanzuoguang/mq/service/impl/MqServiceImpl.java
View file @
fd2d9a49
...
...
@@ -74,6 +74,21 @@ public class MqServiceImpl implements MqService, InitializingBean {
*/
private
boolean
init
=
false
;
/**
* Invoked by a BeanFactory after it has set all bean properties supplied
* (and satisfied BeanFactoryAware and ApplicationContextAware).
* <p>This method allows the bean instance to perform initialization only
* possible when all bean properties have been set and to throw an
* exception in the event of misconfiguration.
*
* @throws Exception in the event of misconfiguration (such
* as failure to set an essential property) or if initialization fails.
*/
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
this
.
init
();
}
public
synchronized
void
init
()
{
if
(
this
.
init
)
{
return
;
...
...
@@ -430,19 +445,4 @@ public class MqServiceImpl implements MqService, InitializingBean {
return
ret
;
}
}
/**
* Invoked by a BeanFactory after it has set all bean properties supplied
* (and satisfied BeanFactoryAware and ApplicationContextAware).
* <p>This method allows the bean instance to perform initialization only
* possible when all bean properties have been set and to throw an
* exception in the event of misconfiguration.
*
* @throws Exception in the event of misconfiguration (such
* as failure to set an essential property) or if initialization fails.
*/
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
this
.
init
();
}
}
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