parent
a4dc0369ff
commit
93e38dde45
@ -0,0 +1,56 @@
|
|||||||
|
package com.shun.placeOrder.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.core.*;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 夜灬瞬
|
||||||
|
* @since 2023/6/21 21:08
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RabbitMQConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单服务的交换机
|
||||||
|
*/
|
||||||
|
public static final String PLACE_ORDER_EXCHANGE = "place_order_exchange";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 三个服务的Queue
|
||||||
|
*/
|
||||||
|
public static final String COUPON_QUEUE = "coupon_queue";
|
||||||
|
public static final String USER_POINTS_QUEUE = "user_points_queue";
|
||||||
|
public static final String BUSINESS_QUEUE = "business_queue";
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Exchange placeOrderExchange(){
|
||||||
|
return ExchangeBuilder.fanoutExchange(PLACE_ORDER_EXCHANGE).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Queue couponQueue(){
|
||||||
|
return QueueBuilder.durable(COUPON_QUEUE).build();
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public Queue userPointsQueue(){
|
||||||
|
return QueueBuilder.durable(USER_POINTS_QUEUE).build();
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public Queue businessQueue(){
|
||||||
|
return QueueBuilder.durable(BUSINESS_QUEUE).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding couponBinding(Exchange placeOrderExchange,Queue couponQueue){
|
||||||
|
return BindingBuilder.bind(couponQueue).to(placeOrderExchange).with("").noargs();
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public Binding userPointsBinding(Exchange placeOrderExchange,Queue userPointsQueue){
|
||||||
|
return BindingBuilder.bind(userPointsQueue).to(placeOrderExchange).with("").noargs();
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
public Binding businessBinding(Exchange placeOrderExchange,Queue businessQueue){
|
||||||
|
return BindingBuilder.bind(businessQueue).to(placeOrderExchange).with("").noargs();
|
||||||
|
}
|
||||||
|
}
|
@ -1 +1,3 @@
|
|||||||
RabbitMQ 模拟电商
|
RabbitMQ 模拟电商
|
||||||
|
支付 订单 商家 积分 库存 优惠券
|
||||||
|
基本逻辑
|
@ -1,19 +0,0 @@
|
|||||||
# Created by .ignore support plugin (hsz.mobi)
|
|
||||||
### Example user template template
|
|
||||||
### Example user template
|
|
||||||
|
|
||||||
# IntelliJ project files
|
|
||||||
.idea
|
|
||||||
*.iml
|
|
||||||
out
|
|
||||||
gen
|
|
||||||
target
|
|
||||||
*.class
|
|
||||||
|
|
||||||
*.log
|
|
||||||
.settings
|
|
||||||
.project
|
|
||||||
logs
|
|
||||||
job
|
|
||||||
|
|
||||||
templates
|
|
Loading…
Reference in new issue