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
a2a010f0
Commit
a2a010f0
authored
May 18, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将源码打包进jar包
parent
a6395665
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
15 deletions
+32
-15
PlanConsumer.java
.../src/main/java/com.yanzuoguang.redis/mq/PlanConsumer.java
+2
-15
PlanConsumerInit.java
.../main/java/com.yanzuoguang.redis/mq/PlanConsumerInit.java
+30
-0
No files found.
yzg-util-redis/src/main/java/com.yanzuoguang.redis/mq/PlanConsumer.java
View file @
a2a010f0
...
@@ -7,36 +7,23 @@ import com.yanzuoguang.redis.PlanInfo;
...
@@ -7,36 +7,23 @@ import com.yanzuoguang.redis.PlanInfo;
import
com.yanzuoguang.redis.service.PlanService
;
import
com.yanzuoguang.redis.service.PlanService
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
com.yanzuoguang.util.helper.JsonHelper
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.nio.charset.StandardCharsets
;
/**
/**
* 任务消费
* 任务消费
*
*
* @author 颜佐光
* @author 颜佐光
*/
*/
@Component
@Component
public
class
PlanConsumer
implements
InitializingBean
{
public
class
PlanConsumer
{
private
final
MqService
mqService
;
private
final
MqService
mqService
;
private
final
PlanProcedure
planProcedure
;
private
final
PlanService
planService
;
private
final
PlanService
planService
;
public
PlanConsumer
(
MqService
mqService
,
Plan
Procedure
planProcedure
,
Plan
Service
planService
)
{
public
PlanConsumer
(
MqService
mqService
,
PlanService
planService
)
{
this
.
mqService
=
mqService
;
this
.
mqService
=
mqService
;
this
.
planProcedure
=
planProcedure
;
this
.
planService
=
planService
;
this
.
planService
=
planService
;
}
}
@Override
public
void
afterPropertiesSet
()
{
// 应用程序级的任务交给队列处理
planProcedure
.
initQueue
((
message
,
channel
)
->
PlanConsumer
.
this
.
plan
(
new
String
(
message
.
getBody
(),
StandardCharsets
.
UTF_8
),
message
,
channel
)
);
}
/**
/**
* 消费任务
* 消费任务
*
*
...
...
yzg-util-redis/src/main/java/com.yanzuoguang.redis/mq/PlanConsumerInit.java
0 → 100644
View file @
a2a010f0
package
com
.
yanzuoguang
.
redis
.
mq
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.stereotype.Component
;
import
java.nio.charset.StandardCharsets
;
/**
* 任务消费
*
* @author 颜佐光
*/
@Component
public
class
PlanConsumerInit
implements
InitializingBean
{
private
final
PlanProcedure
planProcedure
;
private
final
PlanConsumer
planConsumer
;
public
PlanConsumerInit
(
PlanProcedure
planProcedure
,
PlanConsumer
planConsumer
)
{
this
.
planProcedure
=
planProcedure
;
this
.
planConsumer
=
planConsumer
;
}
@Override
public
void
afterPropertiesSet
()
{
// 应用程序级的任务交给队列处理
planProcedure
.
initQueue
((
message
,
channel
)
->
planConsumer
.
plan
(
new
String
(
message
.
getBody
(),
StandardCharsets
.
UTF_8
),
message
,
channel
)
);
}
}
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