MediatorConfiguration
Package Trax.MediatorNamespace Trax.Mediator.ConfigurationSource MediatorConfiguration.cs
The settings AddMediator resolved from its builder, registered as a singleton. Every setter is
internal: the builder is the only way to change a value.
Signature
namespace Trax.Mediator.Configuration;
public class MediatorConfiguration
{
public ServiceLifetime TrainLifetime { get; }
public Assembly[] Assemblies { get; }
public int? GlobalMaxConcurrentRun { get; }
public int? PerPrincipalMaxConcurrentRun { get; }
public int MaxInputJsonBytes { get; }
public TimeSpan MaxQueueHookDuration { get; }
public bool AllowMissingAuthorizationService { get; }
public bool SkipChainVerification { get; }
}Properties
| Property | Default | Set with | Description |
|---|---|---|---|
TrainLifetime | Transient | TrainLifetime(ServiceLifetime) | The lifetime discovered trains are registered with. Singleton is refused |
Assemblies | empty | ScanAssemblies(...) | The assemblies scanned for IServiceTrain<,> implementations, including any an earlier subsystem contributed (such as AddStateMachines) |
GlobalMaxConcurrentRun | null (no limit) | GlobalConcurrentRunLimit(int) | Concurrent direct runs across every train |
PerPrincipalMaxConcurrentRun | null (no limit) | PerPrincipalMaxConcurrentRun(int) | Concurrent direct runs per principal. Holds nothing until an ICurrentPrincipalProvider that returns ids is registered |
MaxInputJsonBytes | 262144 (256 KiB) | WithMaxInputJsonBytes(int) | The UTF-8 size cap on caller-supplied input JSON for RunAsync and QueueAsync, checked after authorization and before deserialization. A queued entry's stored, re-serialized input has its own, larger cap derived from this one |
MaxQueueHookDuration | 30 seconds | WithMaxQueueHookDuration(TimeSpan) | How long an OnQueue hook may run while its enqueue holds a connection and a transaction. Past it the enqueue fails with QueueHookTimeoutException and rolls back. Timeout.InfiniteTimeSpan removes the limit |
AllowMissingAuthorizationService | false | AllowMissingAuthorizationService() | Lets a host with [TraxAuthorize] trains start without an ITrainAuthorizationService, for scheduler-only or dashboard-only processes |
SkipChainVerification | false | SkipChainVerification() | Skips the startup check that reads every registered train's chain |
Behavior
Per-train limits from ConcurrentRunLimit<TTrain>(int) are kept internally and are not exposed
here. AddServiceTrainBus called on its own registers an instance with the defaults when none is
registered.
Example
var configuration = serviceProvider.GetRequiredService<MediatorConfiguration>();
Console.WriteLine($"Input cap: {configuration.MaxInputJsonBytes} bytes");See also
- AddMediator, the builder that sets these values
- Concurrency limits