I’m looking to add some defensive exception handling/retry logic around my (Java) code that enqueues tasks in App Engine. In reviewing the documentation for potential exceptions raised, I see several candidates that might make sense to catch and handle with a retry, but the documentation is a bit vague, so I thought I’d see what others have found to be worthwhile.
Here are the ones I’m looking at, and their descriptions from the docs:
- InternalFailureException – Internal task queue error.
- TransientFailureException – Intermittent failure.
- QueueFailureException – Unspecified queue failure.
- TransactionalTaskException – Queue operation failure caused by Datastore exception.
The only one for which the docs explicitly suggest that retrying might be helpful is TransientFailureException.
Also, regarding TransactionalTaskException, is this something that would only arise when enlisting a task in an enclosing datastore transaction, or could this arise when enqueuing a standalone task?
I got some feedback on this question in App Engine google group (see this thread), so I thought I’d post a summary here to benefit others.
Some examination of the GAE source revealed that:
Robert Kluin also gave the following advice (paraphrasing here):