yangys
2024-03-27 e48aa2ac8dea1be5db11c63edf0b912c4ad5ce65
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
package com.qianwen.smartman.modules.notify.message.rocket.producer;
 
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.core.notify.NotifyResultProducer;
import com.qianwen.core.notify.event.SerializableNotifierEvent;
import com.qianwen.smartman.modules.sync.constant.QyWechatConstant;
 
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/message/rocket/producer/RocketNotifyResultProducer.class */
public class RocketNotifyResultProducer implements NotifyResultProducer {
    private static final Logger log = LoggerFactory.getLogger(RocketNotifyResultProducer.class);
    private final RocketMQTemplate rocketMQTemplate;
 
    public RocketNotifyResultProducer(final RocketMQTemplate rocketMQTemplate) {
        this.rocketMQTemplate = rocketMQTemplate;
    }
 
    public boolean syncSend(SerializableNotifierEvent object) {
        return false;
    }
 
    public void asyncSend(final SerializableNotifierEvent object) {
        String topicWithTag = "notify-center-history-topic:" + (object.isSuccess() ? QyWechatConstant.CALLBACK_RESULT : "error");
        this.rocketMQTemplate.asyncSend(topicWithTag, object, new SendCallback() { // from class: org.springblade.modules.notify.message.rocket.producer.RocketNotifyResultProducer.1
            public void onSuccess(SendResult sendResult) {
                RocketNotifyResultProducer.log.info("[RocketNotifyResultProducer][发送编号:[{}] 发送成功,结果为:[{}]]", object.toString(), sendResult);
            }
 
            public void onException(Throwable throwable) {
                RocketNotifyResultProducer.log.info("[RocketNotifyResultProducer][发送编号:[{}] 发送异常]]", object.toString(), throwable);
            }
        });
    }
}