Commit 78917d32 authored by 赵啸非's avatar 赵啸非

业务日志添加

parent dde9042a
......@@ -19,7 +19,7 @@ fi
echo "stoping application $PROJECT_NAME......"
kill -9 ${pid}
kill -15 ${pid}
echo "Send shutdown request to Server $PROJECT_NAME OK"
......
......@@ -45,30 +45,9 @@ public class AccessMessageConsumerListener {
@Autowired
private AccessLogService accessLogService;
/* @RabbitHandler
public void onMessage(List<AccessLogEntity> messages) {
log.info("[Access onMessage][线程编号:{} 消息数量:{}]", Thread.currentThread().getName() + Thread.currentThread().getId(), messages.size());
List<AccessLogEntity> collect = messages.stream().map(entity -> {
try {
// System.out.println(new String(message, Charset.defaultCharset()));
// AccessLogEntity entity = null;
// entity = JSON.parseObject(new String(message, Charset.defaultCharset()), AccessLogEntity.class);
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
entity.setCreateUserId(1L);
entity.setCreateTime(new Date());
return entity;
} catch (Exception e) {
log.info("反序列化异常", e);
return null;
}
}).filter(f -> f != null).collect(Collectors.toList());
accessLogService.save(collect);
}*/
@RabbitHandler
public void onMessage(List<String> messages) throws Exception {
public void onMessage(List<String> messages) {
log.info("[Access onMessage][线程编号:{} 消息数量:{}]", Thread.currentThread().getName() + Thread.currentThread().getId(), messages.size());
List<AccessLogEntity> collect = messages.stream().map(message -> {
try {
AccessLogEntity entity =null;
......
......@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
* @description:
**/
@Slf4j
//@Component
@Component
@RabbitListener(queues = QueueKey.BIZ_LOG_QUEUE,
containerFactory = "consumerBatchContainerFactory")
public class BizMessageConsumerListener {
......
......@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
* @description:
**/
@Slf4j
//@Component
@Component
@RabbitListener(queues = QueueKey.ERROR_LOG_QUEUE,
containerFactory = "consumerBatchContainerFactory")
public class ErrorMessageConsumerListener {
......@@ -42,13 +42,12 @@ public class ErrorMessageConsumerListener {
@RabbitHandler
public void onMessage(List<ErrorLogEntity> messages) {
log.info("[Error onMessage][线程编号:{} 消息数量:{}]", Thread.currentThread().getName()+Thread.currentThread().getId(), messages.size());
log.info("[Error onMessage][线程编号:{} 消息数量:{}]", Thread.currentThread().getName() + Thread.currentThread().getId(), messages.size());
messages.stream().peek(entity -> {
//ErrorLogEntity entity = JSON.parseObject(new String(str, Charset.defaultCharset()), ErrorLogEntity.class);
entity.setCreateUserId(1L);
entity.setCreateTime(new Date());
if (!ObjectUtils.isEmpty(entity.getFingerprint())) {
//// TODO: 2022/8/24 指纹匹配
//// TODO: 2022/8/24 指纹匹配
} else {
//比较message platform appname 如果相同 则checknum+1 并更新日志时间
ErrorLogQuery errorLogQuery = new ErrorLogQuery();
......@@ -57,7 +56,7 @@ public class ErrorMessageConsumerListener {
errorLogQuery.setMessage(entity.getMessage());
ErrorLogEntity errorLogEntity = errorLogService.selectOne(errorLogQuery, null);
if (!ObjectUtils.isEmpty(errorLogEntity)) {
errorLogEntity.setCheckNum(errorLogEntity.getCheckNum()+1);
errorLogEntity.setCheckNum(errorLogEntity.getCheckNum() + 1);
errorLogEntity.setLogTime(entity.getLogTime());
errorLogEntity.setThreadNo(entity.getThreadNo());
errorLogEntity.setCreateTime(new Date());
......
......@@ -31,7 +31,7 @@ import java.util.stream.Collectors;
* @description:
**/
@Slf4j
//@Component
@Component
@RabbitListener(queues = QueueKey.OPERATION_LOG_QUEUE,
containerFactory = "consumerBatchContainerFactory")
public class OperateMessageConsumerListener {
......
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