SaveApis.Framework

Documentation for SaveApis.Framework

View on GitHub

WolverineInstaller

Key: Wolverine
Default Enabled: ✅ (when added via AddCritterStack())
Package: SaveApis.Utils.CritterStack


Purpose

Configures Wolverine as the message bus with PostgreSQL-backed durable messaging, structured logging, and two built-in message queues for local and cross-service communication.


What It Does

Builder phase:


Dependencies

No explicit installer dependencies. Must be registered after CritterStackInstaller (guaranteed by AddCritterStack() registration order).


Configuration

This installer has no configuration section. All settings are applied as fixed defaults.

The PostgreSQL connection used by Wolverine for its message store is provided via Marten’s IntegrateWithWolverine() call (configured in MartenInstaller). No separate connection string is needed.


Message Routing

Two marker interfaces control where messages are routed:

ILocaleMessage

Messages implementing ILocaleMessage are published to the local in-process queue named messages.

// Marker interface
public interface ILocaleMessage { }

// Usage
public record UserCreatedEvent(Guid UserId, string Email) : ILocaleMessage;

// Publish (via Wolverine IMessageBus)
await bus.PublishAsync(new UserCreatedEvent(userId, email));

Use for: events or commands that should be handled within the same process. No durable persistence — if the process crashes, unprocessed messages are lost.


IServiceMessage

Messages implementing IServiceMessage are published to the PostgreSQL-backed durable queue named messages.

// Marker interface
public interface IServiceMessage { }

// Usage
public record SendEmailCommand(Guid RecipientId, string Subject) : IServiceMessage;

// Publish
await bus.PublishAsync(new SendEmailCommand(recipientId, subject));

Use for: commands or events that must survive process restarts or be consumed by another service. Backed by the PostgreSQL outbox table provided by MartenInstaller.


OpenTelemetry Integration

The installer registers Wolverine as an OTLP source automatically:

builder.Services.ConfigureOpenTelemetryMeterProvider(meter => meter.AddMeter("Wolverine"));
builder.Services.ConfigureOpenTelemetryTracerProvider(trace => trace.AddSource("Wolverine"));

This happens in AddCritterStack() (before the installer runs), so Wolverine metrics and traces are exported via the application’s configured OTLP endpoint when OpenTelemetryInstaller is active.

Similarly, Marten sources are also registered:

metrics.AddMeter("Marten").AddMeter("Wolverine")
traces.AddSource("Marten").AddSource("Wolverine*")

Notes