Skip to content

Options

EventSourcingKit is configured through EventSourcingKitOptions, bound from the EventSourcingKit section of your configuration. This page lists every option; the features they control are covered on their own pages.

Configuring the Options

The options are read from configuration when you call AddEventSourcingKit. You can also set them in code through the optional delegate, which runs after the configuration is bound and so overrides it:

builder.Services.AddEventSourcingKit(
    builder.Configuration,
    [typeof(BookRegistered).Assembly],
    options => options.RequireEvents = true
);

A typical configuration section looks like this:

{
  "EventSourcingKit": {
    "Source": "https://library.eventsourcingkit.net",
    "SubjectPrefix": "/library",
    "RequireEvents": true,
    "RequireSchemasForAllEvents": false,
    "AutoRegisterEventSchemas": true
  }
}

Available Options

Option Type Default Purpose
Source string – (required) The origin of the events this application writes, stored with every event. Must be a non-empty, stable URI.
SubjectPrefix string none A prefix prepended to every subject, on writing and reading. Lets several applications share one store.
EventVerificationPolicy None | VerifyHashOnly | VerifySignature None How event integrity is verified as events are read.
PublicKeyFilePath string none Path to the PEM-encoded Ed25519 public key, required when the policy is VerifySignature.
RequireEvents bool false Throw at startup if the store contains event types not discovered in your code.
RequireSchemasForAllEvents bool false Throw at startup if any discovered event type has no schema.
AutoRegisterEventSchemas bool false Register discovered schemas that the store does not yet know.
ObservationRetryPolicy object see below How the observer retries when processing an event fails.

Source is the only required option. The rest have safe defaults, so a minimal configuration sets just Source.

The Observation Retry Policy

ObservationRetryPolicy controls how the background observer recovers from a failure while processing an event. It is its own section with four settings:

Setting Type Default Purpose
MaxRetryAttempts int 3 How many times to retry before the observer stops.
InitialDelayInMs int 1000 The delay before the first retry, in milliseconds.
BackOffFactor int 2 The multiplier applied to the delay after each attempt.
MaxDelayInMs int 30000 The upper bound on the delay between retries, in milliseconds.
{
  "EventSourcingKit": {
    "Source": "https://library.eventsourcingkit.net",
    "ObservationRetryPolicy": {
      "MaxRetryAttempts": 5,
      "InitialDelayInMs": 500,
      "BackOffFactor": 2,
      "MaxDelayInMs": 10000
    }
  }
}

The options are validated at startup: an empty Source, an out-of-range retry setting, or a MaxDelayInMs smaller than InitialDelayInMs fails fast, so a misconfiguration surfaces immediately rather than at runtime.

For More Information