I have a deferred task using DeferredTask. The task can sometimes fail permanently. Normally when the task throws an exception, it is retried. The documentation of DeferredTaskContext mentions a method setDoNotRetry(boolean value). I have tried calling this method inside of my defferred task, but the task is still ran again. How is this call supposed to work?
I understand I could just silently catch the exception, however I hoped that by throwing it and marking the task no to retry I would get the failure logged in the Google App Engine Console, similar to how this is described in the Python version of the library:
Raise a deferred.PermanentTaskFailure exception. This is a special exception, and is treated as a permanent failure. It is logged as an exception, so it will show up in the Google Cloud Platform Console as one, but causes the task to not be retried again.
Is there some other way how would I get this behaviour in Google App Engine Java environment?