Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jenkins
order-group
Commits
60ff567f
Commit
60ff567f
authored
Feb 18, 2020
by
huvchao@126.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orderDeliveryQueue
parent
843ee1d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
order-application-service/src/main/java/cn/freemud/amp/config/PushOrderConfig.java
+13
-0
order-application-service/src/main/java/cn/freemud/amp/service/ProduceMQService.java
+2
-4
No files found.
order-application-service/src/main/java/cn/freemud/amp/config/PushOrderConfig.java
View file @
60ff567f
...
@@ -21,6 +21,10 @@ public class PushOrderConfig {
...
@@ -21,6 +21,10 @@ public class PushOrderConfig {
public
static
final
String
PUSH_ORDER_QUEUE
=
"push-order-queue"
;
public
static
final
String
PUSH_ORDER_QUEUE
=
"push-order-queue"
;
public
static
final
String
PUSH_ORDER_QUEUE_ROUTING_KEY
=
"push-order-queue-routing-key"
;
public
static
final
String
PUSH_ORDER_QUEUE_ROUTING_KEY
=
"push-order-queue-routing-key"
;
// 配送信息消息队列
public
static
final
String
OPEN_PLATFORM_ORDER_DELIVERY_QUEUE
=
"open-platform-order-delivery-queue"
;
public
static
final
String
OPEN_PLATFORM_ORDER_DELIVERY_ROUTING_KEY
=
"open-platform-order-delivery-routing-key"
;
/**
/**
* 定义基于Fanout 的Exchange。
* 定义基于Fanout 的Exchange。
* 基于这个代码,也可以非常方便的定义其他的Exchange类型。
* 基于这个代码,也可以非常方便的定义其他的Exchange类型。
...
@@ -58,4 +62,13 @@ public class PushOrderConfig {
...
@@ -58,4 +62,13 @@ public class PushOrderConfig {
public
OrderMQService
orderMQService
()
{
public
OrderMQService
orderMQService
()
{
return
new
OrderMQService
();
return
new
OrderMQService
();
}
}
@Bean
public
Queue
orderDeliveryQueue
(){
return
QueueBuilder
.
durable
(
OPEN_PLATFORM_ORDER_DELIVERY_QUEUE
).
build
();
}
@Bean
Binding
bindingOrderDeliveryQueue
(
Queue
orderDeliveryQueue
,
Exchange
topicExchange
)
{
return
BindingBuilder
.
bind
(
orderDeliveryQueue
).
to
(
topicExchange
).
with
(
OPEN_PLATFORM_ORDER_DELIVERY_ROUTING_KEY
).
noargs
();
}
}
}
order-application-service/src/main/java/cn/freemud/amp/service/ProduceMQService.java
View file @
60ff567f
package
cn
.
freemud
.
amp
.
service
;
package
cn
.
freemud
.
amp
.
service
;
import
cn.freemud.amp.config.PushOrderConfig
;
import
cn.freemud.amqp.MQMessage
;
import
cn.freemud.amqp.MQMessage
;
import
cn.freemud.amqp.MQService
;
import
cn.freemud.amqp.MQService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -13,15 +14,12 @@ public class ProduceMQService {
...
@@ -13,15 +14,12 @@ public class ProduceMQService {
@Autowired
@Autowired
private
MQService
mqService
;
private
MQService
mqService
;
private
static
final
String
exchangeName
=
"topic-Exchange"
;
private
static
final
String
routeKey
=
"open-platform-order-delivery-routing-key"
;
/**
/**
* 发送配送状态变更信息
* 发送配送状态变更信息
* @param body
* @param body
*/
*/
public
void
sendOfDeliveryInfo
(
MQMessage
body
)
{
public
void
sendOfDeliveryInfo
(
MQMessage
body
)
{
mqService
.
convertAndSend
(
exchangeName
,
routeKey
,
body
);
mqService
.
convertAndSend
(
PushOrderConfig
.
EXCHANGE_NAME
,
PushOrderConfig
.
OPEN_PLATFORM_ORDER_DELIVERY_ROUTING_KEY
,
body
);
}
}
}
}
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