KKSU
2024-06-14 8ee5e148287a2b7105ab2baaaec2edc83af6ec36
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package cc.mrbird.febs.rabbit;
 
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.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;
 
/**
 * @author wzy
 * @date 2022-05-31
 **/
@Configuration
public class RabbitConfiguration {
 
    @Resource
    private ConnectionFactory connectionFactory;
 
    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public RabbitTemplate rabbitTemplate() {
        return new RabbitTemplate(connectionFactory);
    }
 
    // === 业绩树 start ===
    @Bean
    public DirectExchange achieveTreeExchange() {
        return new DirectExchange(QueueEnum.ACHIEVE_TREE.getExchange());
    }
 
    @Bean
    public Queue achieveTreeQueue() {
        return new Queue(QueueEnum.ACHIEVE_TREE.getQueue());
    }
 
    @Bean
    public Binding achieveTreeBind() {
        return BindingBuilder.bind(achieveTreeQueue()).to(achieveTreeExchange()).with(QueueEnum.ACHIEVE_TREE.getRoute());
    }
    // === 业绩树 end ===
 
 
    // === 提现手续费 start ===
    @Bean
    public DirectExchange withdrawFeeExchange() {
        return new DirectExchange(QueueEnum.WITHDRAW_FEE.getExchange());
    }
 
    @Bean
    public Queue withdrawFeeQueue() {
        return new Queue(QueueEnum.WITHDRAW_FEE.getQueue());
    }
 
    @Bean
    public Binding withdrawFeeBind() {
        return BindingBuilder.bind(withdrawFeeQueue()).to(withdrawFeeExchange()).with(QueueEnum.WITHDRAW_FEE.getRoute());
    }
    // === 提现手续费 end ===
 
 
 
    // === tfc最新价 start ===
    @Bean
    public DirectExchange tfcNewPriceExchange() {
        return new DirectExchange(QueueEnum.TFC_NEW_PRICE.getExchange());
    }
 
    @Bean
    public Queue tfcNewPriceQueue() {
        return new Queue(QueueEnum.TFC_NEW_PRICE.getQueue());
    }
 
    @Bean
    public Binding tfcNewPriceBind() {
        return BindingBuilder.bind(tfcNewPriceQueue()).to(tfcNewPriceExchange()).with(QueueEnum.TFC_NEW_PRICE.getRoute());
    }
    // === tfc最新价 end ===
 
 
 
    // === 手续费分发 start ===
    @Bean
    public DirectExchange feeDistributeExchange() {
        return new DirectExchange(QueueEnum.DISTRIB_PROFIT.getExchange());
    }
 
    @Bean
    public Queue feeDistributeQueue() {
        return new Queue(QueueEnum.DISTRIB_PROFIT.getQueue());
    }
 
    @Bean
    public Binding feeDistributeBind() {
        return BindingBuilder.bind(feeDistributeQueue()).to(feeDistributeExchange()).with(QueueEnum.DISTRIB_PROFIT.getRoute());
    }
    // === 手续费分发 end ===
 
 
 
    // === 发送推荐规则奖励 start ===
    @Bean
    public DirectExchange invitePerkExchange() {
        return new DirectExchange(QueueEnum.TFC_INVITE_PERK.getExchange());
    }
 
    @Bean
    public Queue invitePerkQueue() {
        return new Queue(QueueEnum.TFC_INVITE_PERK.getQueue());
    }
 
    @Bean
    public Binding invitePerkBind() {
        return BindingBuilder.bind(invitePerkQueue()).to(invitePerkExchange()).with(QueueEnum.TFC_INVITE_PERK.getRoute());
    }
    // === 发送推荐规则奖励 end ===
 
 
 
    // === 发送节点奖励 start ===
    @Bean
    public DirectExchange nodePerkExchange() {
        return new DirectExchange(QueueEnum.TFC_NODE_PERK.getExchange());
    }
 
    @Bean
    public Queue nodePerkQueue() {
        return new Queue(QueueEnum.TFC_NODE_PERK.getQueue());
    }
 
    @Bean
    public Binding nodePerkBind() {
        return BindingBuilder.bind(nodePerkQueue()).to(nodePerkExchange()).with(QueueEnum.TFC_NODE_PERK.getRoute());
    }
    // === 发送节点奖励 end ===
 
 
 
    // === 发送复投 start ===
    @Bean
    public DirectExchange nodeAgainExchange() {
        return new DirectExchange(QueueEnum.TFC_NODE_AGAIN.getExchange());
    }
 
    @Bean
    public Queue nodeAgainQueue() {
        return new Queue(QueueEnum.TFC_NODE_AGAIN.getQueue());
    }
 
    @Bean
    public Binding nodeAgainBind() {
        return BindingBuilder.bind(nodeAgainQueue()).to(nodeAgainExchange()).with(QueueEnum.TFC_NODE_AGAIN.getRoute());
    }
    // === 发送复投 end ===
}