forked from ZhongFuCheng3y/austin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...in-support/src/main/java/com/java3y/austin/support/mq/rabbit/RabbitSendMqServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters