修复打包失败
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 12m38s
All checks were successful
Build and Push to Target Registry / 构建并推送镜像到目标仓库 (push) Successful in 12m38s
This commit is contained in:
@@ -1,65 +1,65 @@
|
|||||||
package org.dromara.sis.rocketmq.producer;
|
//package org.dromara.sis.rocketmq.producer;
|
||||||
|
//
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.rocketmq.common.message.Message;
|
//import org.apache.rocketmq.common.message.Message;
|
||||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
//import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
//import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* @author lsm
|
// * @author lsm
|
||||||
* @apiNote ProducerService
|
// * @apiNote ProducerService
|
||||||
* @since 2025/8/26
|
// * @since 2025/8/26
|
||||||
*/
|
// */
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
@Component
|
//@Component
|
||||||
public class ProducerService {
|
//public class ProducerService {
|
||||||
|
//
|
||||||
@Autowired
|
|
||||||
@Qualifier("rocketMQTemplateClusterOne")
|
|
||||||
private RocketMQTemplate rocketMQTemplateClusterOne;
|
|
||||||
|
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// @Qualifier("rocketMQTemplateClusterTwo")
|
// @Qualifier("rocketMQTemplateClusterOne")
|
||||||
// private RocketMQTemplate rocketMQTemplateClusterTwo;
|
// private RocketMQTemplate rocketMQTemplateClusterOne;
|
||||||
|
//
|
||||||
/**
|
//// @Autowired
|
||||||
* 向mq写入消息
|
//// @Qualifier("rocketMQTemplateClusterTwo")
|
||||||
*
|
//// private RocketMQTemplate rocketMQTemplateClusterTwo;
|
||||||
* @param topic 消息topic
|
//
|
||||||
* @param tag 消息tag
|
// /**
|
||||||
* @param msg 消息
|
// * 向mq写入消息
|
||||||
*/
|
// *
|
||||||
public void defaultSend(String topic, String tag, String msg) {
|
// * @param topic 消息topic
|
||||||
try {
|
// * @param tag 消息tag
|
||||||
String destination = topic + ":" + tag;
|
// * @param msg 消息
|
||||||
// 使用 RocketMQTemplate 的同步发送方法
|
// */
|
||||||
rocketMQTemplateClusterOne.syncSend(destination, msg);
|
// public void defaultSend(String topic, String tag, String msg) {
|
||||||
|
|
||||||
log.info("发送RocketMQOne消息成功, nameServer:{}", rocketMQTemplateClusterOne.getProducer().getNamesrvAddr());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("发送RocketMQOne消息失败", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 向mq写入消息
|
|
||||||
*
|
|
||||||
* @param topic 消息topic
|
|
||||||
* @param tag 消息tag
|
|
||||||
* @param msg 消息
|
|
||||||
*/
|
|
||||||
// public void clusterSend(String topic, String tag, String msg) {
|
|
||||||
// try {
|
// try {
|
||||||
// String destination = topic + ":" + tag;
|
// String destination = topic + ":" + tag;
|
||||||
// // 使用 RocketMQTemplate 的同步发送方法
|
// // 使用 RocketMQTemplate 的同步发送方法
|
||||||
// rocketMQTemplateClusterTwo.syncSend(destination, msg);
|
// rocketMQTemplateClusterOne.syncSend(destination, msg);
|
||||||
//
|
//
|
||||||
// log.info("发送RocketMQTwo消息成功, nameServer:{}", rocketMQTemplateClusterTwo.getProducer().getNamesrvAddr());
|
// log.info("发送RocketMQOne消息成功, nameServer:{}", rocketMQTemplateClusterOne.getProducer().getNamesrvAddr());
|
||||||
// } catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
// log.error("发送RocketMQTwo消息失败", e);
|
// log.error("发送RocketMQOne消息失败", e);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 向mq写入消息
|
||||||
|
// *
|
||||||
|
// * @param topic 消息topic
|
||||||
|
// * @param tag 消息tag
|
||||||
|
// * @param msg 消息
|
||||||
|
// */
|
||||||
|
//// public void clusterSend(String topic, String tag, String msg) {
|
||||||
|
//// try {
|
||||||
|
//// String destination = topic + ":" + tag;
|
||||||
|
//// // 使用 RocketMQTemplate 的同步发送方法
|
||||||
|
//// rocketMQTemplateClusterTwo.syncSend(destination, msg);
|
||||||
|
////
|
||||||
|
//// log.info("发送RocketMQTwo消息成功, nameServer:{}", rocketMQTemplateClusterTwo.getProducer().getNamesrvAddr());
|
||||||
|
//// } catch (Exception e) {
|
||||||
|
//// log.error("发送RocketMQTwo消息失败", e);
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
//}
|
||||||
|
Reference in New Issue
Block a user