Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张云鹏
/
uc-consumer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
cb36cfdf
...
cb36cfdfbb492112545c9eefc625ad2c1cb58f1d
authored
2022-06-01 16:38:52 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.update
1 parent
2c9f83ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
87 deletions
src/main/java/com/topdraw/mq/consumer/UcEngineIptv2ManagementConsumer.java
src/main/java/com/topdraw/mq/consumer/UcEngineManagement2IptvConsumer.java
src/main/resources/config/application-dev.yml
src/main/java/com/topdraw/mq/consumer/UcEngineIptv2ManagementConsumer.java
deleted
100644 → 0
View file @
2c9f83a
package
com
.
topdraw
.
mq
.
consumer
;
import
com.rabbitmq.client.Channel
;
import
com.topdraw.mq.domain.TableOperationMsg
;
import
com.topdraw.resttemplate.RestTemplateClient
;
import
com.topdraw.util.FileUtil
;
import
com.topdraw.util.JSONUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.MapUtils
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.Assert
;
import
java.io.IOException
;
import
java.time.LocalDate
;
import
java.util.Map
;
@Component
@Slf4j
public
class
UcEngineIptv2ManagementConsumer
{
@Autowired
AutoRoute
autoUser
;
@Autowired
RestTemplateClient
restTemplateClient
;
@Value
(
"#{rabbitMqErrorLogConfig.getUceError()}"
)
private
Map
<
String
,
String
>
error
;
/**
* 事件
* @param content
* @description 基础数据同步
* @author Hongyan Wang
* @date 2021/9/7 11:26 上午
*/
/*@RabbitHandler
@RabbitListener(queues = "#{rabbitMqConfig.getUceQueue()}",
containerFactory = "serviceRabbitListenerContainerFactory", ackMode = "MANUAL")*/
public
void
ucEventConsumer
(
Channel
channel
,
Message
message
,
String
content
)
throws
IOException
{
log
.
info
(
" receive dataSync msg , content is : {} "
,
content
);
try
{
TableOperationMsg
tableOperationMsg
=
this
.
parseContent
(
content
);
autoUser
.
route
(
tableOperationMsg
);
channel
.
basicAck
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
);
}
catch
(
Exception
e
)
{
channel
.
basicReject
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
);
if
(
MapUtils
.
isNotEmpty
(
error
))
{
String
errorStart
=
this
.
error
.
get
(
"start"
);
if
(
errorStart
.
equalsIgnoreCase
(
"true"
))
{
String
fileName
=
this
.
error
.
get
(
"fileName"
)+
"_"
+
LocalDate
.
now
()
+
".log"
;
String
filePath
=
this
.
error
.
get
(
"filePath"
);
String
filePath1
=
filePath
+
fileName
;
FileUtil
.
writeStringToFile2
(
filePath1
,
content
,
e
.
getMessage
());
}
}
e
.
printStackTrace
();
}
log
.
info
(
"ucEventConsumer ====>>>> end"
);
}
/**
* 数据解析
* @param content
* @return
*/
private
TableOperationMsg
parseContent
(
String
content
)
{
TableOperationMsg
tableOperationMsg
=
JSONUtil
.
parseMsg2Object
(
content
,
TableOperationMsg
.
class
);
Assert
.
notNull
(
tableOperationMsg
,
"ERROR -->> operationConsumer -->> parseContent -->> 【dataSyncMsg】 not be null !!"
);
return
tableOperationMsg
;
}
}
src/main/java/com/topdraw/mq/consumer/UcEngineManagement2IptvConsumer.java
View file @
cb36cfd
...
...
@@ -71,6 +71,7 @@ public class UcEngineManagement2IptvConsumer {
e
.
printStackTrace
();
}
log
.
info
(
"ucEventConsumer ====>>>> end"
);
}
...
...
src/main/resources/config/application-dev.yml
View file @
cb36cfd
...
...
@@ -48,6 +48,7 @@ spring:
# 生产环境设置成 none,避免程序运行时自动更新数据库结构
ddl-auto
:
none
open-in-view
:
true
show-sql
:
false
# redis
redis
:
...
...
Please
register
or
sign in
to post a comment