Commit d8649a9f authored by 赵啸非's avatar 赵啸非

添加消息发送

parent 68d362d3
package com.mortals.xhx.base.framework.config;
import com.mortals.xhx.common.key.QueueKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
......@@ -12,6 +13,7 @@ import java.util.HashMap;
import java.util.Map;
@Configuration
@Slf4j
public class RabbitConfig {
public Integer messageTtl = 86400000;
public Map<String, Object> args = new HashMap<>();
......@@ -38,6 +40,7 @@ public class RabbitConfig {
// 创建 Binding
@Bean
public Binding accessBinding() {
log.info("添加队列ALARM_MSG_QUEUE");
return BindingBuilder.bind(alarmMsgQueue()).to(exchange()).with(QueueKey.ALARM_MSG_QUEUE);
}
......
......@@ -42,7 +42,7 @@ public class AlarmSendMsgThread extends AbstractThread {
@Override
protected int getSleepTime() {
return 1000;
return 10000;
}
@Override
......@@ -60,6 +60,11 @@ public class AlarmSendMsgThread extends AbstractThread {
CorrelationData correlationData = new CorrelationData(IdUtil.fastSimpleUUID());
rabbitTemplate.convertAndSend(QueueKey.DEFAULT_EXCHANGE, QueueKey.ALARM_MSG_QUEUE, JSON.toJSONString(queueMsg), correlationData);
alarmRecordsEntity.setPush(YesNoEnum.YES.getValue());
alarmRecordsEntity.setUpdateTime(new Date());
recordsService.update(alarmRecordsEntity);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment