|
@@ -260,13 +260,15 @@ public class RabbitMqListener {
|
|
|
Long building = redisUtil.incr(key, 1);
|
|
|
buildLogService.save(buildLog);
|
|
|
|
|
|
- // 设置消息id幂等性,防止消息重复消费
|
|
|
- long messageIdCount = redisUtil.incr(SysConstants.SCENE_BUILDING + buildLog.getMessageId(), 1);
|
|
|
- if (messageIdCount == 1) {
|
|
|
- redisUtil.expire(key, SysConstants.modelTimeOut);
|
|
|
- }else{
|
|
|
- log.error("服务:{},消息重复消费:{},重复消费次数:{}", SysConstants.hostName, buildLog.getMessageId(),messageIdCount);
|
|
|
- throw new BuildException(ModelingBuildStatus.REPEAT);
|
|
|
+ if(!ObjectUtils.isEmpty(buildLog.getMessageId())){
|
|
|
+ // 设置消息id幂等性,防止消息重复消费
|
|
|
+ long messageIdCount = redisUtil.incr(SysConstants.SCENE_BUILDING + buildLog.getMessageId(), 1);
|
|
|
+ if (messageIdCount == 1) {
|
|
|
+ redisUtil.expire(key, SysConstants.modelTimeOut);
|
|
|
+ }else{
|
|
|
+ log.error("服务:{},消息重复消费:{},重复消费次数:{}", SysConstants.hostName, buildLog.getMessageId(),messageIdCount);
|
|
|
+ throw new BuildException(ModelingBuildStatus.REPEAT);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (building.compareTo(1L) > 0) {
|