KKSU
2024-12-31 e081193a764667cb091390b034795ee05a36b4fb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package cc.mrbird.febs.common.configure;
 
import cc.mrbird.febs.rabbit.enumerates.RabbitQueueEnum;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
 
import javax.annotation.Resource;
 
@Configuration
public class RabbitConfigure {
 
    @Resource
    private ConnectionFactory connectionFactory;
 
    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public RabbitTemplate rabbitTemplate() {
        return new RabbitTemplate(connectionFactory);
    }
 
 
 
 
    // === 充值自动过期 延时  start ===
    @Bean
    public DirectExchange chargeDelayTtlExchange() {
        return new DirectExchange(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE_FAIL_TTL.getExchange());
    }
    @Bean
    public Binding chargeDelayTtlBind() {
        return BindingBuilder.bind(chargeDelayTtlQueue()).to(chargeDelayTtlExchange()).with(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE_FAIL_TTL.getRoute());
    }
    @Bean
    public Queue chargeDelayTtlQueue() {
        return QueueBuilder.durable(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE_FAIL_TTL.getQueue())
                //到期后转发的交换机
                .withArgument("x-dead-letter-exchange", RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE_FAIL.getExchange())
                //到期后转发的路由键
                .withArgument("x-dead-letter-routing-key", RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE_FAIL.getRoute())
                .build();
    }
    @Bean
    public DirectExchange chargeDelayExchange() {
        return new DirectExchange(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE_FAIL.getExchange());
    }
    @Bean
    public Queue chargeDelayQueue() {
        return new Queue(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE_FAIL.getQueue());
    }
    @Bean
    public Binding chargeDelayBind() {
        return BindingBuilder.bind(chargeDelayQueue()).to(chargeDelayExchange()).with(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE_FAIL.getRoute());
    }
    // === 充值自动过期 延时  end ===
 
 
 
    // start
    @Bean
    public DirectExchange agentReturnExchange() {
        return new DirectExchange(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE.getExchange());
    }
 
    @Bean
    public Queue agentReturnQueue() {
        return new Queue(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE.getQueue());
    }
 
    @Bean
    public Binding agentReturnBind() {
        return BindingBuilder.bind(agentReturnQueue()).to(agentReturnExchange()).with(RabbitQueueEnum.RUN_VIP_OPERATION_CHARGE.getRoute());
    }
    // end
 
 
 
    // start
    @Bean
    public DirectExchange nodeUpExchange() {
        return new DirectExchange(RabbitQueueEnum.RUN_VIP_NODE_UP.getExchange());
    }
 
    @Bean
    public Queue nodeUpQueue() {
        return new Queue(RabbitQueueEnum.RUN_VIP_NODE_UP.getQueue());
    }
 
    @Bean
    public Binding nodeUpBind() {
        return BindingBuilder.bind(nodeUpQueue()).to(nodeUpExchange()).with(RabbitQueueEnum.RUN_VIP_NODE_UP.getRoute());
    }
    // end
 
}