Created
April 3, 2024 04:56
-
-
Save stijnmoreels/e21e294953eddced207ba08183f80f3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Arcus.Messaging.Abstractions.ServiceBus.MessageHandling; | |
using Arcus.Messaging.Pumps.Abstractions.Resiliency; | |
public class OrderMessageHandler : IAzureServiceBusMessageHandler<Order> | |
{ | |
private readonly IMessagePumpCircuitBreaker _circuitBreaker; | |
public OrderMessageHandler(IMessagePumpCircuitBreaker circuitBreaker) | |
{ | |
_circuitBreaker = circuitBreaker; | |
} | |
public async Task ProcessMessageAsync(Order message, AzureServiceBusMessageContext messageContext, ...) | |
{ | |
// Determine whether your dependent system is healthy... | |
// If not, call the circuit breaker, processing will be halted temporarily. | |
await _circuitBreaker.PauseMessageProcessingAsync(messageContext.JobId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment