/// <inheritdoc /> public override Task <DeleteResponse> Delete( Deletable deletable, CancellationToken cancellationToken = default ) { var memoryDeletable = CastAndValidate( deletable, d => (!string.IsNullOrWhiteSpace(d.MessageId), nameof(d.MessageId)) ); _messages.TryRemove(memoryDeletable.MessageId, out _); return(Task.FromResult(new DeleteResponse())); }
/// <inheritdoc /> public override async Task <DeleteResponse> Delete( Deletable deletable, CancellationToken cancellationToken = default ) { var azureDeletable = CastAndValidate( deletable, d => (!string.IsNullOrWhiteSpace(d.MessageId), nameof(d.MessageId)), d => (!string.IsNullOrWhiteSpace(d.PopId), nameof(d.PopId)) ); var response = await _azureQueueClient .DeleteMessageAsync(azureDeletable.MessageId, azureDeletable.PopId, cancellationToken) .ConfigureAwait(false); return(new DeleteResponse { Success = response.Status == 204 }); }
/// <inheritdoc /> public override async Task <DeleteResponse> Delete( Deletable deletable, CancellationToken cancellationToken = default ) { var sqsDeletable = CastAndValidate( deletable, d => (!string.IsNullOrWhiteSpace(d.ReceiptHandle), nameof(d.ReceiptHandle)) ); var response = await _client.DeleteMessageAsync(new DeleteMessageRequest { QueueUrl = _options.QueueUrl, ReceiptHandle = sqsDeletable.ReceiptHandle }, cancellationToken).ConfigureAwait(false); return(new DeleteResponse { Success = response != null && (int)response.HttpStatusCode == 200 }); }
/// <inheritdoc /> public async Task <DeleteResponse> Delete(Deletable deletable, CancellationToken cancellationToken = default) { DeletableValidator.Validate(deletable); return(await GetProvider(deletable.Queue).Delete(deletable, cancellationToken).ConfigureAwait(false)); }