Commit 47bb84cc authored by 赵啸非's avatar 赵啸非

添加材料排序

parent dba44ffe
Pipeline #2627 canceled with stages
...@@ -71,6 +71,18 @@ ...@@ -71,6 +71,18 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>4.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.mortals.xhx.common.keys;
/**
* rabbit 队列key定义
*/
public class QueueKey {
public static final String ACCESS_LOG_QUEUE = "ACCESS_LOG_QUEUE";
public static final String BIZ_LOG_QUEUE = "BIZ_LOG_QUEUE";
public static final String ERROR_LOG_QUEUE = "ERROR_LOG_QUEUE";
public static final String OPERATION_LOG_QUEUE = "OPERATION_LOG_QUEUE";
public static final String EXCHANGE = "LOG";
public static final String ROUTING_KEY = "LOG_ROUTING_KEY";
}
package com.mortals.xhx.system;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.AccessLogPdu;
import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.ErrorLogPdu;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.common.keys.QueueKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@Component
@Primary
@Slf4j
public class MessageProducer implements IMessageProduceService {
@Autowired
private RabbitTemplate rabbitTemplate;
public void syncAccessSend(AccessLogPdu accessLogPdu) {
//new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8))
//rabbitTemplate.send(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE,new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8)));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu));
//rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, accessLogPdu);
}
@Override
public void syncBizSend(BizLogPdu bizLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.BIZ_LOG_QUEUE, JSON.toJSONString(bizLogPdu));
}
@Override
public void syncErrorSend(ErrorLogPdu errorLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu));
}
@Override
public void syncOperSend(OperateLogPdu operLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu));
}
}
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