gravatasufoca
gravatasufoca

Reputation: 39

Quarkus and transactions timeout with mutiny

I'm trying to use the Fault tolerance feature from Quarkus, but I'm stucked with the @Retry and Mutiny.

I got these methods:

@Transactional
@TransactionConfiguration(timeout = 30)
@Incoming("ocr-in")
@Retry(delay = 5000, maxRetries = 2)
@Fallback(fallbackMethod = "removerProcessamento")
protected Uni<Void> recebeEvento(Message<String> ocr) {
    log.infof("OCR %s RECEBIDO", ocr.getPayload());
    return getUni(ocr);
}

private Uni<Void> getUni(Message<String> ocr) {
    return Uni.createFrom().item(ocr)
                    .onItem()
                    .invoke(this::processar)
                    .replaceWith(ocr::ack)
                    .replaceWithVoid();

}

protected Uni<Void> removerProcessamento(Message<String> ocr) {
    log.errorf("ERRO O PROCESSAMENTO DO OCR %s, REMOVENDO REGISTROS", ocr.getPayload());
    pecaService.limparProcessamentoOcr(Long.valueOf(ocr.getPayload()));
    return Uni.createFrom().item(ocr).replaceWith(() -> ocr.nack(new RuntimeException())).replaceWithVoid();
}

I'm trying to make the retry works when the transaction timeout occurs, but It never happens! The timeout occurs, and the method is not called again.

I think is something with the Uni that I need to return. Is there a way to achieve this?

Upvotes: 0

Views: 368

Answers (1)

Serkan
Serkan

Reputation: 1235

Afaik, Microprofile Fault handling doesn’t work with Mutiny. It’s meant for working with non-reactive way.

Mutiny has its own way of fault handling.

Check this link.

Upvotes: 1

Related Questions