Now I am using rabbitMQ to consume message using Java code client, this is my client code:
@RabbitHandler
public void handle(@Payload byte[] message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag) throws IOException {
String messageContext = new String(message, "UTF-8");
ReportWalletConsumeRecord record = JSON.parseObject(messageContext, ReportWalletConsumeRecord.class);
asyncService.submit(() -> {
try {
MyContext.setTenant(record.getTenantId());
asyncFlushRecord(record, channel, tag);
} catch (Exception e) {
log.error("save message failed:" + JSON.toJSONString(record), e);
}
});
}
but sometimes the flush failed and the message turned to unack, is it possible to repull the unack message and try again(1-3 times)?