Merge remote-tracking branch 'origin/master'

cert
schry 2 years ago
commit 6defa35079

@ -13,6 +13,8 @@ public class TopicRabbitConfig {
//绑定键
public final static String common = "topic.common";
public final static String trace = "topic.trace";
public final static String publicer = "topic.all";
public final static String delaytrace = "local.trace.delay";
public final static String TRACE_TOPIC_EXCHANGE = "trace.topic.exchange";
@ -29,6 +31,10 @@ public class TopicRabbitConfig {
return new Queue(TopicRabbitConfig.common);
}
@Bean
public Queue allQueue() {
return new Queue(TopicRabbitConfig.publicer);
}
@Bean
public Queue traceDelayQueue() {

@ -5,6 +5,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
@ -12,7 +13,7 @@ import java.util.Date;
*/
@Data
@Builder
public class MqTaskDelayMessage {
public class MqTaskDelayMessage implements Serializable {
private Date createTime;
private Long taskId;

@ -10,6 +10,9 @@ import java.util.List;
*/
@Data
public class TraceTaskDlResponse {
private Long id;
/**
* UDI
*/

@ -7,6 +7,7 @@ import com.glxp.api.config.rabbit.TopicRabbitConfig;
import com.glxp.api.entity.trace.MqTaskDelayMessage;
import com.glxp.api.entity.trace.MqTraceMessage;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.JsonUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
@ -27,7 +28,8 @@ public class RabbitPushService {
public BaseResponse send(MqTraceMessage mqTraceMessage) {
rabbitTemplate.convertAndSend(TopicRabbitConfig.TRACE_TOPIC_EXCHANGE, TopicRabbitConfig.trace, mqTraceMessage);
rabbitTemplate.convertAndSend(TopicRabbitConfig.TRACE_TOPIC_EXCHANGE, TopicRabbitConfig.trace, JsonUtils.toJsonString(mqTraceMessage));
return ResultVOUtils.success("发送成功");
}

@ -22,10 +22,10 @@ public class TraceSearchReceiver {
TraceTaskNoticeService taskNoticeService;
@RabbitHandler
@RabbitListener(queues = TopicRabbitConfig.trace)
public void traceReceiver(MqTraceMessage mqTraceMessage) {
@RabbitListener(queues = TopicRabbitConfig.common)
public void traceReceiver(String mqTraceMessage) {
log.info("追随查询任务" + mqTraceMessage.toString());
System.out.println("xxxx.xxxx.xxxx收到的消息内容为\n" + mqTraceMessage);
//todo 测试用
}

Loading…
Cancel
Save