记得上下班打卡 | git大法好,push需谨慎

Commit d7cbccab authored by anjiabin's avatar anjiabin

修改redis消费队列方式

parent 31e5c675
......@@ -38,17 +38,15 @@ public abstract class AbstractRedisReceiver implements StreamListener<String, Ma
boolean result = this.consumerSqlDaoHandler(message.getValue().get("message"));
// 消费成功确认,消息删除和消息确认是一个事务
if(result){
log.error("consumer success delete message messageId:{} ",message.getId());
try {
log.info("consumer success delete message messageId:{} ",message.getId());
try {
// stringRedisTemplate.multi();
stringRedisTemplate.opsForStream().delete(this.getRedisStreamKey(), message.getId());
stringRedisTemplate.opsForStream().delete(this.getRedisStreamKey(), message.getId());
// stringRedisTemplate.opsForStream().acknowledge(getRedisStreamGroup(), message);
// stringRedisTemplate.exec();
} catch (Exception e) {
e.printStackTrace();
log.error("delete redis queue message error messageId:{} errMsg:{}",message.getId(),e.getMessage());
}
} catch (Exception e) {
e.printStackTrace();
log.error("delete redis queue message error messageId:{} errMsg:{}",message.getId(),e.getMessage());
}
}
......@@ -61,6 +59,8 @@ public abstract class AbstractRedisReceiver implements StreamListener<String, Ma
log.debug("CONSUMER SQL result of execution:{}", rstBatchSqls);
if (rstBatchSqls) {
return true;
}else{
sendMySqlRedis(msg);
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -80,4 +80,4 @@ public class RedisRefundReceiver implements StreamListener<String, MapRecord<Str
return false;
}
}
}
}
\ No newline at end of file
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