Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
Overview
Overview
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
黄营
datax-cloud
Commits
eae9c125
Commit
eae9c125
authored
Sep 23, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
90b6917d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
RabbitMqListenerConfig.java
...ce/data/market/mapping/config/RabbitMqListenerConfig.java
+15
-6
No files found.
datax-modules/data-market-service-parent/data-market-service-mapping/src/main/java/cn/datax/service/data/market/mapping/config/RabbitMqListenerConfig.java
View file @
eae9c125
...
...
@@ -2,7 +2,9 @@ package cn.datax.service.data.market.mapping.config;
import
cn.datax.common.rabbitmq.config.RabbitMqConstant
;
import
cn.datax.common.utils.ThrowableUtil
;
import
cn.datax.service.data.market.mapping.service.QueueHandlerService
;
import
cn.datax.service.data.market.api.entity.DataApiEntity
;
import
cn.datax.service.data.market.api.feign.DataApiServiceFeign
;
import
cn.datax.service.data.market.mapping.handler.MappingHandlerMapping
;
import
com.rabbitmq.client.Channel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.core.Message
;
...
...
@@ -19,12 +21,16 @@ import java.util.Map;
@Configuration
public
class
RabbitMqListenerConfig
{
@Autowired
private
QueueHandlerService
queueHandlerService
;
private
static
String
HANDLER_RELEASE
=
"1"
;
private
static
String
HANDLER_CANCEL
=
"2"
;
@Autowired
private
DataApiServiceFeign
dataApiServiceFeign
;
@Autowired
private
MappingHandlerMapping
mappingHandlerMapping
;
/**
* api发布与撤销
* @param map type 1:发布 2:撤销
...
...
@@ -40,10 +46,13 @@ public class RabbitMqListenerConfig {
String
id
=
(
String
)
map
.
get
(
"id"
);
String
type
=
(
String
)
map
.
get
(
"type"
);
log
.
info
(
"fanoutQueueRelease接收到了:{},{}"
,
id
,
type
);
DataApiEntity
dataApiEntity
=
dataApiServiceFeign
.
getDataApiById
(
id
);
if
(
dataApiEntity
!=
null
)
{
if
(
HANDLER_RELEASE
.
equals
(
type
))
{
queueHandlerService
.
handlerRelease
(
id
);
mappingHandlerMapping
.
registerMapping
(
dataApiEntity
);
}
else
if
(
HANDLER_CANCEL
.
equals
(
type
))
{
queueHandlerService
.
handlerCancel
(
id
);
mappingHandlerMapping
.
unregisterMapping
(
dataApiEntity
);
}
}
// 手动确认
channel
.
basicAck
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
);
...
...
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