Skip to content



Wolverine requires the usage of the Lamar IoC container, and the call to UseWolverine() quietly replaces the built in .NET container with Lamar.

Lamar was originally written specifically to support Wolverine's runtime model as well as to be a higher performance replacement for the older StructureMap tool.

Wolverine is configured with the IHostBuilder.UseWolverine() extension methods, with the actual configuration living on a single WolverineOptions object. The WolverineOptions is the configuration model for your Wolverine application, and as such it can be used to configure directives about:

  • Basic elements of your Wolverine system like the system name itself
  • Connections to external messaging infrastructure through Wolverine's transport model
  • Messaging endpoints for either listening for incoming messages or subscribing endpoints
  • Subscription rules for outgoing messages
  • How message handlers are discovered within your application and from what assemblies
  • Policies to control how message handlers function, or endpoints are configured, or error handling policies

Wolverine Configuration Model


At this point, Wolverine only supports IHostBuilder for bootstrapping, but may also support the newer HostApplicationBuilder model in the future.

With ASP.NET Core

Below is a sample of adding Wolverine to an ASP.NET Core application that is bootstrapped with WebApplicationBuilder:

using Oakton;
using Quickstart;
using Wolverine;

var builder = WebApplication.CreateBuilder(args);

// The almost inevitable inclusion of Swashbuckle:)

// For now, this is enough to integrate Wolverine into
// your application, but there'll be *many* more
// options later of course :-)

// Some in memory services for our application, the
// only thing that matters for now is that these are
// systems built by the application's IoC container

var app = builder.Build();

// An endpoint to create a new issue that delegates to Wolverine as a mediator
app.MapPost("/issues/create", (CreateIssue body, IMessageBus bus) => bus.InvokeAsync(body));

// An endpoint to assign an issue to an existing user that delegates to Wolverine as a mediator
app.MapPost("/issues/assign", (AssignIssue body, IMessageBus bus) => bus.InvokeAsync(body));

// Swashbuckle inclusion

app.MapGet("/", () => Results.Redirect("/swagger"));

// Opt into using Oakton for command line parsing
// to unlock built in diagnostics and utility tools within
// your Wolverine application
return await app.RunOaktonCommands(args);

snippet source | anchor

"Headless" Applications


The WolverineOptions.Services property can be used to add additional IoC service registrations with either the standard .NET IServiceCollection model or the Lamar ServiceRegistry syntax.

For "headless" console applications with no user interface or HTTP service endpoints, the bootstrapping can be done with just the HostBuilder mechanism as shown below:

return await Host.CreateDefaultBuilder(args)
    .UseWolverine(opts =>
        opts.ServiceName = "Subscriber1";





        // Publish to the other subscriber

        // Add Open Telemetry tracing
        opts.Services.AddOpenTelemetryTracing(builder =>

                // Add Wolverine as a source

    // Executing with Oakton as the command line parser to unlock
    // quite a few utilities and diagnostics in our Wolverine application

snippet source | anchor

Released under the MIT License.