mirror of https://github.com/ZhongFuCheng3y/austin
commit
637f48523b
@ -0,0 +1,45 @@
|
||||
package com.java3y.austin.support.mq.rabbit;
|
||||
|
||||
import com.java3y.austin.support.constans.MessageQueuePipeline;
|
||||
import com.java3y.austin.support.mq.SendMqService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @Autor xzcawl
|
||||
* @Date 2022/7/15 17:29
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@ConditionalOnProperty(name = "austin-mq-pipeline", havingValue = MessageQueuePipeline.RABBIT_MQ)
|
||||
public class RabbitSendMqServiceImpl implements SendMqService {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Value("${austin.rabbitmq.topic.name}")
|
||||
private String confTopic;
|
||||
|
||||
@Value("${austin.rabbitmq.exchange.name}")
|
||||
private String exchangeName;
|
||||
|
||||
|
||||
@Override
|
||||
public void send(String topic, String jsonValue, String tagId) {
|
||||
if (topic.equals(confTopic)) {
|
||||
rabbitTemplate.convertAndSend(exchangeName, confTopic, jsonValue);
|
||||
} else {
|
||||
log.error("RabbitSendMqServiceImpl send topic error! topic:{},confTopic:{}", topic, confTopic);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(String topic, String jsonValue) {
|
||||
send(topic, jsonValue, null);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue