mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-14 20:30:04 +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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user