...
Code Block | ||
---|---|---|
| ||
public override void OnError(IMessageContext context, Connexion.Core.ErrorEventArgs args) { if(args.Exception is NotSupportedException) { args.ShouldRetry = true; args.SleepTime = TimeSpan.FromMinutes(2); Logger.Write(EventSeverity.Error, 54321, args.Exception.Message); } } |
Using the implementation above, messages will not be moved to the error queue. They will remain in the queued state and errors will be logged to your device.
Next, implement your batch processing method. It is important to note that the error handling behavior within batch processing differs from the regular ProcessMessageAsync method.
- You must provide your own exception handling and individually set the properties of each context within the batch. For example, if you are sending messages to an external service in parallel, you must handle updating each individual context manually.