Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stijnmoreels/e21e294953eddced207ba08183f80f3f to your computer and use it in GitHub Desktop.
Save stijnmoreels/e21e294953eddced207ba08183f80f3f to your computer and use it in GitHub Desktop.
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