public static async Task <long> CommitMarkedIgnoringDisposedAsync(this IMessageBatch batch, CancellationToken cancellationToken) { try { return(await batch.CommitMarkedAsync(cancellationToken)); } catch (ObjectDisposedException) { // ignore return(0); } }
public static Task CommitAsync(this IMessageBatch batch, Message message, CancellationToken cancellationToken) { if (message == null) { return(Task.FromResult(0)); } batch.MarkSuccessful(message); return(batch.CommitMarkedAsync(cancellationToken)); }