2

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)?

IMSoP
  • 89,526
  • 13
  • 117
  • 169
Dolphin
  • 29,069
  • 61
  • 260
  • 539
  • there is a similar [question](https://stackoverflow.com/questions/17654475/consuming-not-acknowledge-messages-from-rabbitmq), see if it helps you – spike 王建 Nov 12 '20 at 06:06

0 Answers0