Commit 6fc5fc3a authored by 赵啸非's avatar 赵啸非

网关日志添加

parent b74ca08a
...@@ -3,18 +3,27 @@ package com.mortals.xhx.module; ...@@ -3,18 +3,27 @@ package com.mortals.xhx.module;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.mortals.xhx.common.keys.QueueKey; import com.mortals.xhx.common.keys.QueueKey;
import com.mortals.xhx.common.pdu.access.AccessLogPdu; import com.mortals.xhx.common.pdu.access.AccessLogPdu;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
@Component @Component
@Slf4j
public class MessageProducer { public class MessageProducer {
@Autowired @Autowired
private RabbitTemplate rabbitTemplate; private RabbitTemplate rabbitTemplate;
public void syncAccessSend(AccessLogPdu accessLogPdu) { public void syncAccessSend(AccessLogPdu accessLogPdu) {
if (!ObjectUtils.isEmpty(accessLogPdu)) {
if (log.isDebugEnabled()) {
log.debug("accessLog==>{}", JSON.toJSONString(accessLogPdu));
}
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu)); rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu));
} }
}
} }
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