I use aiokafka 0.8.0 in Python 3.9 to consume a Kafka topic.
Occasionally the processing fails with what we would normally consider a Retryable exception, so the message is sent again soon after.
In some cases the exception is not genuinely Retryable though and it is hard to distinguish at runtime.
I would like to enforce a max retry limit of say 5-10 to avoid infinite loops in this case.
Using aiokafka, how can I either a) enforce a retry limit; or b) get information about the number of retries for the message, so I can check this and retry it myself?