Skip to content

Comments

Add sending failure policies for outgoing message error handling#2179

Merged
jeremydmiller merged 6 commits intomainfrom
sending-error-policies
Feb 15, 2026
Merged

Add sending failure policies for outgoing message error handling#2179
jeremydmiller merged 6 commits intomainfrom
sending-error-policies

Conversation

@jeremydmiller
Copy link
Member

Summary

User-facing API

// Global: discard messages that are too large
opts.SendingFailure.OnException<MessageTooLargeException>().Discard();

// Global: move to dead letter after 3 retries
opts.SendingFailure.OnException<ServiceBusException>()
    .RetryTimes(3).Then.MoveToErrorQueue();

// Per-endpoint override
opts.PublishAllMessages().ToAzureServiceBusTopic("orders")
    .ConfigureSending(s => s.OnException<ServiceBusException>().Discard());

Key changes

  • SendingFailurePolicies class reusing existing IWithFailurePolicies/FailureRuleCollection infrastructure
  • SendingEnvelopeLifecycle adapter enabling existing IContinuation implementations to work on outgoing envelopes
  • LatchSenderContinuation to pause sending agents (mirrors PauseListenerContinuation)
  • Envelope.SendAttempts for independent send attempt tracking
  • Integration into SendingAgent, DurableSendingAgent, BufferedSendingAgent, and InlineSendingAgent
  • EndpointCollection resolves combined global + per-endpoint policies during agent construction

Test plan

  • Core Wolverine project builds with 0 errors
  • Azure Service Bus project builds with 0 errors
  • Slim solution builds with 0 errors across all projects
  • 1000/1003 CoreTests pass (3 pre-existing failures unrelated to this change)
  • Azure Service Bus integration tests (requires emulator infrastructure)

🤖 Generated with Claude Code

jeremydmiller and others added 4 commits February 14, 2026 10:32
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit b799693.
Implement configurable failure handling policies for outgoing message
send failures (Issue #1686). When a message fails to send to an external
transport, users can now configure policies to discard, move to dead
letter queue, retry with backoff, or take custom actions instead of
relying solely on the existing retry/circuit-breaker behavior.

Key additions:
- SendingFailurePolicies class with IWithFailurePolicies support
- SendingEnvelopeLifecycle adapter for IContinuation reuse
- LatchSenderContinuation to pause sending agents
- MessageTooLargeException for oversized message detection
- Global policies via WolverineOptions.SendingFailure
- Per-endpoint policies via ConfigureSending() fluent API
- Envelope.SendAttempts for independent send attempt tracking

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jeremydmiller and others added 2 commits February 14, 2026 10:42
PauseSending now takes a TimeSpan and automatically resumes the sender
after the specified duration. Falls back to CircuitWatcher if resume
fails. Adds SendingFailurePoliciesTests covering the full API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ions

DefaultMessageBatcher.Group() threw ArgumentNullException when TenantId
was null because Dictionary does not allow null keys. The exception was
silently swallowed by the Block error handler, completely breaking batch
processing. Also fix two OTel tracing tests that asserted ConversationId
instead of CorrelationId to match what WriteTags actually writes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant