|
@@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @author: yaoll
|
|
* @author: yaoll
|
|
* @date: 2020-10-22
|
|
* @date: 2020-10-22
|
|
@@ -74,16 +76,23 @@ public class JmsConfig {
|
|
return BindingBuilder.bind(alarmObjQueue()).to(exchange()).with(alarmObjRoutingKey);
|
|
return BindingBuilder.bind(alarmObjQueue()).to(exchange()).with(alarmObjRoutingKey);
|
|
}
|
|
}
|
|
|
|
|
|
- @RabbitListener(queues = alarmObjQueue) //监听器监听指定的Queue
|
|
|
|
|
|
+ @RabbitListener(queues = {alarmObjQueue, "${persagy.dmp.alarm.queue}"}) //监听器监听指定的Queue
|
|
public void process(String message, Channel channel, Message msg) {
|
|
public void process(String message, Channel channel, Message msg) {
|
|
log.info("============================== Receive:" + message);
|
|
log.info("============================== Receive:" + message);
|
|
DmpMessage dmpMessage = JacksonMapper.toObject(message, DmpMessage.class);
|
|
DmpMessage dmpMessage = JacksonMapper.toObject(message, DmpMessage.class);
|
|
messageProcesser.listen(dmpMessage);
|
|
messageProcesser.listen(dmpMessage);
|
|
|
|
+ // 手动确认消息已消费
|
|
|
|
+ try {
|
|
|
|
+ channel.basicAck(msg.getMessageProperties().getDeliveryTag(),false);
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ log.error("消息消费反馈失败", e);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- @RabbitListener(queues = "${persagy.dmp.alarm.queue}") //监听器监听指定的Queue
|
|
|
|
- public void process(DmpMessage message) {
|
|
|
|
- log.info("============================== Receive:" + JacksonMapper.toSimpleJson(message));
|
|
|
|
- messageProcesser.listen(message);
|
|
|
|
- }
|
|
|
|
|
|
+// @RabbitListener(queues = "${persagy.dmp.alarm.queue}") //监听器监听指定的Queue
|
|
|
|
+// public void process(DmpMessage message) {
|
|
|
|
+// log.info("============================== Receive:" + JacksonMapper.toSimpleJson(message));
|
|
|
|
+// messageProcesser.listen(message);
|
|
|
|
+// }
|
|
|
|
+
|
|
}
|
|
}
|