Helius
2021-05-25 f40fc18d708f4ae6efa8c3c134491d134c3c905d
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
package com.xcong.excoin.rabbit.producer;
 
import cn.hutool.core.util.IdUtil;
import com.xcong.excoin.configurations.RabbitMqConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
@Slf4j
@Component
public class YunDingProducter implements RabbitTemplate.ConfirmCallback {
    @Override
    public void confirm(CorrelationData correlationData, boolean b, String s) {
 
    }
 
    private RabbitTemplate rabbitTemplate;
 
    @Autowired
    public YunDingProducter(RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
        rabbitTemplate.setConfirmCallback(this);
    }
 
    public void sendYunDingUsdtProfit(Long id) {
        log.info("发送购买矿机USDT返利消息:{}", id);
        CorrelationData correlationData = new CorrelationData(IdUtil.simpleUUID());
        rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_XCH, RabbitMqConfig.ROUTING_KEE_XCH_USDT_PRIFIT, id.toString(), correlationData);
    }
 
    public void sendYunDingAutoAgent(Long memberId) {
        log.info("发送自动升级代理消息:{}", memberId);
        CorrelationData correlationData = new CorrelationData(IdUtil.simpleUUID());
        rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_XCH, RabbitMqConfig.ROUTING_KEY_XCH_AUTO_AGENT, memberId.toString(), correlationData);
    }
}