Skip to content

ChronicleOptions Reference

ChronicleOptions is the root configuration class for all Chronicle .NET clients. All properties can be set in code via the configureOptions callback on AddCratisChronicle, and most can be bound directly from appsettings.json under the Cratis:Chronicle section.

There are three options classes that form an inheritance chain, each adding settings relevant to its hosting context:

ClassUsed byAdds
ChronicleOptionsAll clientsConnection, serialization, timeouts, TLS, auth
ChronicleClientOptionsWorker services, console appsEvent store name, namespace resolver type
ChronicleAspNetCoreOptionsASP.NET Core appsHTTP header–based namespace resolution

All bindable settings live under Cratis:Chronicle:

{
"Cratis": {
"Chronicle": {
"ConnectionString": "chronicle://localhost:35000",
"EventStore": "my-store",
"EnableEventTypeGenerationValidation": false,
"DefaultSinkTypeId": "SQL",
"ConnectTimeout": 5,
"AutoDiscoverAndRegister": true,
"MaxReceiveMessageSize": 104857600,
"MaxSendMessageSize": 104857600,
"ProgramIdentifier": "my-app",
"ClaimsBasedNamespaceResolverClaimType": "tenant_id",
"Tls": {
"CertificatePath": "/certs/client.pfx",
"CertificatePassword": "secret"
},
"Authentication": {
"Authority": "https://login.example.com"
}
}
}
}

Asks the Kernel to enforce strict migration chain validation when registering event types at generation 2 or higher. The value is forwarded as part of the registration request.

Typebool
Defaultfalse

Image restriction: This flag is only honoured by the development image of the Kernel. The production image always ignores it and validates unconditionally, regardless of what the client sends. This makes it impossible to accidentally skip migration chain validation in production even if the client has this flag set to false.

To opt in to strict validation during development (recommended once your event schemas are stable), set the flag to true:

using Microsoft.Extensions.Hosting;
public static class ChronicleOptionsEnableValidationRegistration
{
public static void Configure(string[] args)
{
var builder = Host.CreateApplicationBuilder(args);
builder.AddCratisChronicle(configureOptions: options =>
{
options.EnableEventTypeGenerationValidation = true;
});
}
}

In appsettings.json: "EnableEventTypeGenerationValidation": true.

See Generation Validation for the full ruleset.

The gRPC endpoint for Chronicle Server.

TypeChronicleConnectionString
DefaultDevelopment connection string (chronicle://localhost:35000 with default dev credentials)
using Microsoft.Extensions.Hosting;
public static class ChronicleOptionsConnectionStringRegistration
{
public static void Configure(string[] args)
{
var builder = Host.CreateApplicationBuilder(args);
builder.AddCratisChronicle(configureOptions: options =>
{
options.ConnectionString = "chronicle://myserver:35000";
});
}
}

In appsettings.json: "ConnectionString": "chronicle://myserver:35000".

Timeout in seconds when establishing a connection to Chronicle Server.

Typeint
Default5

Controls whether Chronicle automatically discovers event types, projections, reactors, reducers, and other artifacts from loaded assemblies on startup.

Typebool
Defaulttrue

Set to false when using a custom IClientArtifactsProvider or when you want full manual control over what gets registered.

Controls which sink type is used when registering projections and reducers with the Kernel. Chronicle supports two built-in sink types:

ValueDescription
WellKnownSinkTypes.MongoDBStores read models in MongoDB (default)
WellKnownSinkTypes.SQLStores read models in a SQL database as JSON documents
TypeSinkTypeId
DefaultWellKnownSinkTypes.MongoDB

To use SQL as the storage backend for all read models:

using Microsoft.Extensions.Hosting;
using Cratis.Chronicle.Sinks;
public static class ChronicleOptionsSqlSinkRegistration
{
public static void Configure(string[] args)
{
var builder = Host.CreateApplicationBuilder(args);
builder.AddCratisChronicle(configureOptions: options =>
{
options.DefaultSinkTypeId = WellKnownSinkTypes.SQL;
});
}
}

In appsettings.json:

{ "Cratis": { "Chronicle": { "DefaultSinkTypeId": "SQL" } } }

See Sinks for detailed guidance on storage backends.

MaxReceiveMessageSize / MaxSendMessageSize

Section titled “MaxReceiveMessageSize / MaxSendMessageSize”

Maximum gRPC message sizes in bytes. See gRPC Message Size for detailed guidance.

Typeint?
Default104857600 (100 MB)

A human-readable identifier for the running application. Included in root causation metadata to identify which program appended an event.

Typestring
Default"[N/A]"

The software version of the entry assembly, extracted from AssemblyInformationalVersion or AssemblyVersion. Included in root causation to track which build produced an event.

Typestring
DefaultResolved from the entry assembly at startup

The commit SHA of the entry assembly, extracted from the +commit part of AssemblyInformationalVersion. Included in root causation to track which commit produced an event.

Typestring
DefaultResolved from the entry assembly at startup

The JWT claim type used by ClaimsBasedNamespaceResolver when namespace resolution is configured via WithClaimsBasedNamespaceResolver.

Typestring
Default"tenant_id"

How registering the client’s artifacts is retried when the Kernel does not accept them.

TypeRegistrationRetryOptions
DefaultFive attempts, two seconds growing to thirty
Nested propertyTypeDefaultDescription
MaxAttemptsint5How many times registering all artifacts is attempted before the failure surfaces. 1 disables retrying
InitialDelayTimeSpan00:00:02Wait after the first failed attempt. Each further attempt doubles it, jittered
MaximumDelayTimeSpan00:00:30Upper bound for the wait between attempts

Registration runs on the way up, so a registration that fails takes the host with it. A Kernel that is merely busy — catching a newly added read model up over a large event log, say — answers late rather than wrongly, and a host that dies on that answer comes back and asks again, adding its whole registration to the queue it was already waiting on. Retrying in place lets the client wait out a busy Kernel instead. Registration is idempotent, so a retry costs the Kernel only the comparison it already does; a Kernel that is genuinely refusing the definitions keeps failing and the host still ends up down, just after the attempts are spent rather than on the first.

In appsettings.json:

{ "Cratis": { "Chronicle": { "RegistrationRetry": { "MaxAttempts": 10, "MaximumDelay": "00:01:00" } } } }

TLS certificate settings for the gRPC connection. TLS is active when both CertificatePath and CertificatePassword are set. See TLS for full details.

TypeTls
DefaultTLS disabled (no certificate configured)
Nested propertyTypeDescription
CertificatePathstring?Path to a PFX certificate file
CertificatePasswordstring?Password for the certificate file

OAuth/OIDC authority configuration. When Authority is not set, the Chronicle internal OAuth authority is used.

TypeAuthentication
DefaultInternal authority
Nested propertyTypeDescription
Authoritystring?OAuth/OIDC authority URL

ChronicleClientOptions extends ChronicleOptions and is used by worker services, console apps, and other non-web hosts via IHostApplicationBuilder.AddCratisChronicle.

The name of the event store the client connects to. Required.

TypeEventStoreName
Default(none — must be set)
{ "Cratis": { "Chronicle": { "EventStore": "my-store" } } }

The Type of the IEventStoreNamespaceResolver to use for resolving the event store namespace. When null, defaults to DefaultEventStoreNamespaceResolver at runtime, which always returns the default namespace.

TypeType?
DefaultnullDefaultEventStoreNamespaceResolver

This is a structural dependency — it resolves a type reference and cannot be meaningfully set from appsettings.json. Set it in code via the configureOptions callback or via IChronicleBuilder.

ChronicleAspNetCoreOptions extends ChronicleClientOptions and is used by ASP.NET Core applications via WebApplicationBuilder.AddCratisChronicle. It defaults EventStoreNamespaceResolverType to HttpHeaderEventStoreNamespaceResolver.

The HTTP request header used to resolve the event store namespace on a per-request basis.

Typestring
Default"x-cratis-tenant-id"
{ "Cratis": { "Chronicle": { "NamespaceHttpHeader": "x-my-tenant" } } }