Commit 7a797f31 authored by 赵啸非's avatar 赵啸非

网关日志添加

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