Newer Version Available
Comparing setResumeCheckpoint() and EventBus.RetryableException
| setResumeCheckpoint() Method | EventBus.RetryableException |
|---|---|
| Use setResumeCheckpoint() when the trigger has processed event messages successfully before an unhandled exception occurs, such as a limit exception. After the exception, the trigger resumes after the last checkpointed event message. | Throw the EventBus.RetryableException to reprocess events when you expect an external condition to change or a transient error to go away. |
| Trigger execution continues after setResumeCheckpoint(). | Trigger execution halts after the EventBus.RetryableException is thrown. |
| DML operations performed are committed. | DML operations performed before the exception is thrown are rolled back and not committed. |
| When the trigger fires again, only the event messages after the one with the specified replay ID are resent, in addition to any new event messages. | When the trigger fires again, all event messages from the previous batch are resent in the new batch, in addition to any new event messages. |
| These TriggerContext properties don’t apply and aren’t populated: retries and lastError. | These TriggerContext properties are populated: retries and lastError. |
| No limit on how many times you can set a checkpoint with setResumeCheckpoint() and how many times the trigger can resume from the checkpoint after an unhandled exception occurs. | You can retry the trigger nine times after its initial run by throwing EventBus.RetryableException. |