mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-25 13:35:15 +08:00
通过 RabbitMQ调用增加积分
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.jsowell.common.config.mq;
|
||||
|
||||
import com.jsowell.common.constant.RabbitConstants;
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 积分奖励 RabbitMQ 配置
|
||||
*/
|
||||
@Configuration
|
||||
public class PointsRabbitConfig {
|
||||
|
||||
/**
|
||||
* 积分奖励队列
|
||||
*/
|
||||
@Bean
|
||||
public Queue pointsRewardQueue() {
|
||||
// durable: 持久化
|
||||
return new Queue(RabbitConstants.QUEUE_POINTS_REWARD, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 积分奖励交换机
|
||||
*/
|
||||
@Bean
|
||||
public DirectExchange pointsRewardExchange() {
|
||||
return new DirectExchange(RabbitConstants.EXCHANGE_POINTS_REWARD, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定队列到交换机
|
||||
*/
|
||||
@Bean
|
||||
public Binding pointsRewardBinding(Queue pointsRewardQueue, DirectExchange pointsRewardExchange) {
|
||||
return BindingBuilder.bind(pointsRewardQueue)
|
||||
.to(pointsRewardExchange)
|
||||
.with(RabbitConstants.ROUTING_KEY_POINTS_REWARD);
|
||||
}
|
||||
}
|
||||
@@ -40,4 +40,13 @@ public class RabbitConstants {
|
||||
// upChargeOrderInfo: 消费充电结算订单
|
||||
public static final String QUEUE_UP_CHARGE_ORDER_INFO = "ykc.upChargeOrderInfo-topic.userplat-group";
|
||||
|
||||
// pointsReward: 积分奖励队列
|
||||
public static final String QUEUE_POINTS_REWARD = "ykc.pointsReward-topic.member-group";
|
||||
|
||||
// 积分奖励交换机
|
||||
public static final String EXCHANGE_POINTS_REWARD = "pointsRewardExchange";
|
||||
|
||||
// 积分奖励路由键
|
||||
public static final String ROUTING_KEY_POINTS_REWARD = "points.reward";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user