feat(): 添加rabbitmq监听方法
parent
1eb9952dc0
commit
880604da65
|
@ -65,6 +65,11 @@
|
|||
<artifactId>cloud-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-rabbit</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -12,6 +12,9 @@ import org.apache.kafka.clients.producer.KafkaProducer;
|
|||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListeners;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -55,10 +58,12 @@ public class ParsingMessage {
|
|||
// kafka topic
|
||||
private static final String TIPSY = "tipsy";
|
||||
|
||||
private final static String FORM_QUEUE = "queue_inform_sms";
|
||||
|
||||
/**
|
||||
* 初始化MQTT连接
|
||||
*/
|
||||
@PostConstruct
|
||||
@RabbitListener(queuesToDeclare = @Queue(FORM_QUEUE))
|
||||
public void init() {
|
||||
connectToMqttBroker();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue