Skip to content

Commit

Permalink
Merge branch 'vip' into rocketmq
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongFuCheng3y authored Jul 20, 2022
2 parents 95236d6 + 1c72cb6 commit 637f485
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
6 changes: 6 additions & 0 deletions austin-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public interface MessageQueuePipeline {
String EVENT_BUS = "eventBus";
String KAFKA = "kafka";
String ROCKET_MQ = "rocketMq";
String RABBIT_MQ = "rabbitMq";

}
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);
}
}
20 changes: 20 additions & 0 deletions austin-web/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ spring.kafka.consumer.enable-auto-commit=true
rocketmq.name-server=${austin-rocketmq-nameserver-ip}:${austin-rocketmq-nameserver-port}
rocketmq.producer.group=${austin-rocketmq-producer-group}

##################### Rabbit properties #####################
server.port=8080
spring.application.name=cl
#RabbitMq所在服务器IP
spring.rabbitmq.host=127.0.0.1
#连接端口号
spring.rabbitmq.port=5672
#用户名
spring.rabbitmq.username=root
#用户密码
spring.rabbitmq.password=123456
# 开启发送确认
spring.rabbitmq.publisher-confirm-type=correlated
# 开启发送失败退回
spring.rabbitmq.publisher-returns=true
spring.rabbitmq.virtual-host=/
austin.rabbitmq.topic.name=austinRabbit
austin.rabbitmq.exchange.name=austin.point


##################### redis properties #####################
spring.redis.host=${austin-redis-ip}
spring.redis.port=${austin-redis-port}
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@
<version>${flink.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.flink/flink-connector-rabbitmq -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-rabbitmq</artifactId>
<version>1.15.1</version>
</dependency>

<!--微信服务号第三方SDK-->
<dependency>
<groupId>com.github.binarywang</groupId>
Expand Down Expand Up @@ -193,6 +200,7 @@
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down

0 comments on commit 637f485

Please sign in to comment.