Skip to content

Commit

Permalink
feat: streamline Message part in az servicebus fallback message han…
Browse files Browse the repository at this point in the history
…dlers (arcus-azure#197)
  • Loading branch information
stijnmoreels authored Jun 23, 2021
1 parent fd18ae3 commit 0d5a489
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/preview/features/message-pumps/service-bus.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public class DeadLetterFallbackMessageHandler : AzureServiceBusFallbackMessageHa
public override async Task ProcessMessageAsync(ServiceBusReceivedMessage message, AzureServiceBusMessageContext context, ...)
{
Logger.LogInformation("Message is not handled by any message handler, will dead letter");
await DeadLetterAsync(message);
await DeadLetterMessageAsync(message);
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract Task ProcessMessageAsync(
/// <param name="message">The Azure Service Bus message to be completed.</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="message"/> is <c>null</c>.</exception>
/// <exception cref="InvalidOperationException">Thrown when the message handler was not initialized yet.</exception>
protected async Task CompleteAsync(ServiceBusReceivedMessage message)
protected async Task CompleteMessageAsync(ServiceBusReceivedMessage message)
{
Guard.NotNull(message, nameof(message), "Requires a message to be completed");

Expand All @@ -65,7 +65,7 @@ protected async Task CompleteAsync(ServiceBusReceivedMessage message)
/// <param name="newMessageProperties">The properties to modify on the message during the dead lettering of the message.</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="message"/> is <c>null</c>.</exception>
/// <exception cref="InvalidOperationException">Thrown when the message handler was not initialized yet.</exception>
protected async Task DeadLetterAsync(ServiceBusReceivedMessage message, IDictionary<string, object> newMessageProperties = null)
protected async Task DeadLetterMessageAsync(ServiceBusReceivedMessage message, IDictionary<string, object> newMessageProperties = null)
{
Guard.NotNull(message, nameof(message), "Requires a message to be dead lettered");

Expand All @@ -89,7 +89,7 @@ protected async Task DeadLetterAsync(ServiceBusReceivedMessage message, IDiction
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="message"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentException">Thrown when the <paramref name="deadLetterReason"/> is blank.</exception>
/// <exception cref="InvalidOperationException">Thrown when the message handler was not initialized yet.</exception>
protected async Task DeadLetterAsync(ServiceBusReceivedMessage message, string deadLetterReason, string deadLetterErrorDescription = null)
protected async Task DeadLetterMessageAsync(ServiceBusReceivedMessage message, string deadLetterReason, string deadLetterErrorDescription = null)
{
Guard.NotNull(message, nameof(message), "Requires a message to be dead lettered");
Guard.NotNullOrWhitespace(deadLetterReason, nameof(deadLetterReason), "Requires a non-blank dead letter reason for the message");
Expand All @@ -112,7 +112,7 @@ protected async Task DeadLetterAsync(ServiceBusReceivedMessage message, string d
/// <param name="newMessageProperties">The properties to modify on the message during the abandoning of the message.</param>
/// <exception cref="ArgumentNullException">Thrown when the <paramref name="message"/> is <c>null</c>.</exception>
/// <exception cref="InvalidOperationException">Thrown when the message handler was not initialized yet.</exception>
protected async Task AbandonAsync(ServiceBusReceivedMessage message, IDictionary<string, object> newMessageProperties = null)
protected async Task AbandonMessageAsync(ServiceBusReceivedMessage message, IDictionary<string, object> newMessageProperties = null)
{
Guard.NotNull(message, nameof(message), "Requires a message to be abandoned");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public override async Task ProcessMessageAsync(
if (azureMessageContext.SystemProperties.DeliveryCount <= 1)
{
Logger.LogTrace("Abandoning message '{MessageId}'...", message.MessageId);
await AbandonAsync(message);
await AbandonMessageAsync(message);
Logger.LogTrace("Abandoned message '{MessageId}'", message.MessageId);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override async Task ProcessMessageAsync(
CancellationToken cancellationToken)
{
Logger.LogTrace("Dead letter message '{MessageId}'...", message.MessageId);
await DeadLetterAsync(message);
await DeadLetterMessageAsync(message);
Logger.LogInformation("Message '{MessageId}' is dead lettered", message.MessageId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public override async Task ProcessMessageAsync(
CancellationToken cancellationToken)
{
await _fallbackMessageHandler.ProcessMessageAsync(message, messageContext, correlationInfo, cancellationToken);
await CompleteAsync(message);
await CompleteMessageAsync(message);
}
}
}

0 comments on commit 0d5a489

Please sign in to comment.