Skip to content

Class WolverineSetupExtensions

Namespace: Momentum.ServiceDefaults.Messaging.Wolverine
Assembly: Momentum.ServiceDefaults.dll

Provides extension methods for configuring Wolverine messaging framework.

csharp
public static class WolverineSetupExtensions

Inheritance

objectWolverineSetupExtensions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Fields

SectionName

csharp
public const string SectionName = "Wolverine"

Field Value

string

Methods

AddWolverineWithDefaults(IServiceCollection, IConfiguration, Action<WolverineOptions>?)

Adds Wolverine services with comprehensive defaults for enterprise messaging scenarios.

csharp
public static void AddWolverineWithDefaults(this IServiceCollection services, IConfiguration configuration, Action<WolverineOptions>? configure)

Parameters

services IServiceCollection

The service collection to configure.

configuration IConfiguration

The application configuration containing connection strings and messaging settings.

configure Action<WolverineOptions>?

Optional action to customize Wolverine options for specific business requirements.

Remarks

This method provides a complete messaging infrastructure configuration including:

Persistence and Reliability:

  • PostgreSQL persistence for message durability and transaction support
  • Reliable messaging with inbox/outbox patterns for guaranteed delivery
  • Automatic transaction scoping for consistency across business operations
  • Dead letter queue handling for failed message processing

Integration and Transport:

  • Kafka integration for high-throughput event streaming
  • CloudEvents standard support for interoperability
  • System.Text.Json serialization with performance optimization
  • Cross-service message routing and topic management

Quality and Observability:

  • FluentValidation integration for automatic message validation
  • Structured exception handling with retry policies
  • OpenTelemetry instrumentation for distributed tracing
  • Performance monitoring and request tracking middleware
  • Health checks for messaging infrastructure components

Development and Deployment:

  • Resource setup on startup for database migrations
  • Convention-based handler discovery from domain assemblies
  • Environment-aware configuration and feature flags

ConfigureAppHandlers(WolverineOptions, Assembly?)

Configures Wolverine to discover and register message handlers from domain assemblies.

csharp
public static WolverineOptions ConfigureAppHandlers(this WolverineOptions options, Assembly? applicationAssembly = null)

Parameters

options WolverineOptions

The Wolverine options to configure.

applicationAssembly Assembly?

Optional application assembly. If null, uses the entry assembly.

Returns

WolverineOptions

The configured Wolverine options for method chaining.

Remarks

Discovers handlers from all assemblies marked with .

ConfigureReliableMessaging(WolverineOptions)

Configures Wolverine for reliable message delivery.

csharp
public static WolverineOptions ConfigureReliableMessaging(this WolverineOptions options)

Parameters

options WolverineOptions

Returns

WolverineOptions

Remarks

Enables:

  • Automatic transaction middleware
  • Durable local queues for reliable processing
  • Durable outbox pattern on all sending endpoints
These settings ensure message delivery reliability and prevent message loss in case of failures.