Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
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
徐少华
midjourney-proxy
Commits
3297fab6
Commit
3297fab6
authored
Oct 22, 2018
by
lili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deleteVideo Topic 合并
parent
4da6f8d5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
17 deletions
+22
-17
BookApplication.java
...e-book/src/main/java/com/pcloud/book/BookApplication.java
+10
-0
MQTopicConumer.java
...c/main/java/com/pcloud/book/mq/config/MQTopicConumer.java
+1
-1
MqConfig.java
...ook/src/main/java/com/pcloud/book/mq/config/MqConfig.java
+1
-4
DeleteVideoListener.java
...in/java/com/pcloud/book/mq/topic/DeleteVideoListener.java
+10
-12
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/BookApplication.java
View file @
3297fab6
...
@@ -72,6 +72,7 @@ public class BookApplication {
...
@@ -72,6 +72,7 @@ public class BookApplication {
((
DruidDataSource
)
dataSource
).
setConnectionInitSqls
(
arr
);
((
DruidDataSource
)
dataSource
).
setConnectionInitSqls
(
arr
);
return
dataSource
;
return
dataSource
;
}
}
@Bean
@Bean
public
ActiveMQConnectionFactory
activeMQConnectionFactory
(
@Value
(
"${mq.brokerURL}"
)
String
url
)
{
public
ActiveMQConnectionFactory
activeMQConnectionFactory
(
@Value
(
"${mq.brokerURL}"
)
String
url
)
{
ActiveMQConnectionFactory
activeMQConnectionFactory
=
new
ActiveMQConnectionFactory
();
ActiveMQConnectionFactory
activeMQConnectionFactory
=
new
ActiveMQConnectionFactory
();
...
@@ -80,6 +81,15 @@ public class BookApplication {
...
@@ -80,6 +81,15 @@ public class BookApplication {
return
activeMQConnectionFactory
;
return
activeMQConnectionFactory
;
}
}
@Bean
public
Queue
deleteVideoQueue
(){
return
RabbitMQFactory
.
queueBuilder
(
MQTopicConumer
.
DELETE_VIDEO
);
}
@Bean
public
Binding
deleteVideoBind
(){
return
RabbitMQFactory
.
bindingExchange
(
deleteVideoQueue
(),
MQTopicProducer
.
DELETE_VIDEO
);
}
@Bean
@Bean
public
Queue
chooseDefaultChannelQueue
(){
public
Queue
chooseDefaultChannelQueue
(){
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/config/MQTopicConumer.java
View file @
3297fab6
...
@@ -13,7 +13,7 @@ public class MQTopicConumer {
...
@@ -13,7 +13,7 @@ public class MQTopicConumer {
/**
/**
* 清除录音消费者
* 清除录音消费者
*/
*/
//
public static final String DELETE_VIDEO = PREFIX + MQTopicProducer.DELETE_VIDEO;
public
static
final
String
DELETE_VIDEO
=
PREFIX
+
MQTopicProducer
.
DELETE_VIDEO
;
/**
/**
* 注册当事人Topic监听
* 注册当事人Topic监听
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/config/MqConfig.java
View file @
3297fab6
...
@@ -42,9 +42,6 @@ public class MqConfig implements ApplicationListener<ContextRefreshedEvent> {
...
@@ -42,9 +42,6 @@ public class MqConfig implements ApplicationListener<ContextRefreshedEvent> {
@Autowired
@Autowired
private
ActiveMQConnectionFactory
connectionFactory
;
private
ActiveMQConnectionFactory
connectionFactory
;
@Autowired
private
DeleteVideoListener
deleteVideoListener
;
// 清除录音
private
static
MessageProducer
bookDeleteMsgProducer
;
// 书籍删除消息生产者
private
static
MessageProducer
bookDeleteMsgProducer
;
// 书籍删除消息生产者
@Autowired
@Autowired
...
@@ -73,7 +70,7 @@ public class MqConfig implements ApplicationListener<ContextRefreshedEvent> {
...
@@ -73,7 +70,7 @@ public class MqConfig implements ApplicationListener<ContextRefreshedEvent> {
bookDeleteMsgProducer
=
this
.
createProducer
(
BookProps
.
getBookDeleteProducer
());
bookDeleteMsgProducer
=
this
.
createProducer
(
BookProps
.
getBookDeleteProducer
());
bookThawProducer
=
this
.
createProducer
(
BookProps
.
getBookThawProducer
());
bookThawProducer
=
this
.
createProducer
(
BookProps
.
getBookThawProducer
());
// 创建消费者,开始监听
// 创建消费者,开始监听
this
.
createConsumer
(
deleteVideoListener
,
BookProps
.
getDeleteVideoConsumer
());
//
this.createConsumer(deleteVideoListener, BookProps.getDeleteVideoConsumer());
this
.
createConsumer
(
registerPartyListener
,
BookProps
.
getRegisterPartyConsumer
());
this
.
createConsumer
(
registerPartyListener
,
BookProps
.
getRegisterPartyConsumer
());
LOGGER
.
info
(
"【消息队列】初始化消息发送队列,<END>"
);
LOGGER
.
info
(
"【消息队列】初始化消息发送队列,<END>"
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/DeleteVideoListener.java
View file @
3297fab6
...
@@ -7,8 +7,11 @@ import javax.jms.Message;
...
@@ -7,8 +7,11 @@ import javax.jms.Message;
import
javax.jms.MessageListener
;
import
javax.jms.MessageListener
;
import
javax.jms.ObjectMessage
;
import
javax.jms.ObjectMessage
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
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.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -22,8 +25,9 @@ import com.pcloud.common.exceptions.BizException;
...
@@ -22,8 +25,9 @@ import com.pcloud.common.exceptions.BizException;
* @作者:songx
* @作者:songx
* @创建时间:2017年7月5日,上午11:58:44 @版本:1.0
* @创建时间:2017年7月5日,上午11:58:44 @版本:1.0
*/
*/
@Component
(
"deleteVideoListener"
)
@Component
public
class
DeleteVideoListener
implements
MessageListener
{
@RabbitListener
(
queues
=
MQTopicConumer
.
DELETE_VIDEO
)
public
class
DeleteVideoListener
{
/**
/**
*
*
...
@@ -36,21 +40,15 @@ public class DeleteVideoListener implements MessageListener {
...
@@ -36,21 +40,15 @@ public class DeleteVideoListener implements MessageListener {
/**
/**
* 接收录音删除消息
* 接收录音删除消息
*/
*/
@Override
@RabbitHandler
public
void
onMessage
(
Message
message
)
throws
BizException
{
public
void
process
(
Long
videoId
)
throws
BizException
{
if
(!(
message
instanceof
ObjectMessage
))
{
if
(
videoId
==
null
)
return
;
throw
new
BookBizException
(
BookBizException
.
CONSUMER_TOPIC_ERROR
,
"【录音删除】类型转换错误"
);
try
{
}
try
{
// 转换消息实体
ObjectMessage
om
=
(
ObjectMessage
)
message
;
Long
videoId
=
Long
.
parseLong
(
om
.
getObject
().
toString
());
// 清除录音
// 清除录音
bookProductBiz
.
clearSound
(
videoId
);
bookProductBiz
.
clearSound
(
videoId
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【录音删除】消费topic,JMS异常,<ERROR>:"
+
e
.
getMessage
(),
e
);
LOGGER
.
error
(
"【录音删除】消费topic,JMS异常,<ERROR>:"
+
e
.
getMessage
(),
e
);
return
;
return
;
}
}
}
}
}
}
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