Nak with delay only working once and not on redelivery. #560
Unanswered
marumarumaru89
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am trying to implement a wait strategy using the .nak() method with a delay, such as:
except Exception as e:
print(e)
if delivery_attempt == 6:
await nc.publish_to_dlq_preprocess(msg_data, correlation_id)
await msg.term()
preprocessor_fail.inc()
logger.log(
f"Fifth message processing failed, terminated message and published to dlq. Error: {e}",
correlation_id,
)
continue
else:
await msg.nak(delay=5)
logger.log(
f"Error during preprocess, nak with 5s delay. Error: {e}",
correlation_id,
attempt=delivery_attempt,
)
continue
Inside a while = True loop that continuously waits for and fetches messages.
This works once, giving me this print:
After that, no further redelivery attempts are made. With a con report it shows Ack Pending: 1, Redelivered: 1.
I first tried to implement this using the Backoff parameter of the consumer, but when NAKing a message, it was redelivered immediately, and when doing neither NAK nor ACK it was not redelivered at all, despite Ack Wait being on 1m and the first backoff step being 1m as well.
Would appreciate any help!
Beta Was this translation helpful? Give feedback.
All reactions