ZeridionFlareOptions
Global configuration for the Zeridion Flare SDK, set via the AddZeridionFlare configuration delegate.
Namespace: Zeridion.Flare · Assembly: Zeridion.Flare.dll
public sealed class ZeridionFlareOptions
{
public string ApiKey { get; set; } = string.Empty;
public string ApiBaseUrl { get; set; } = "https://api.zeridion.com";
public string DefaultQueue { get; set; } = "default";
public int DefaultMaxAttempts { get; set; } = 3;
public TimeSpan DefaultTimeout { get; set; } = TimeSpan.FromMinutes(30);
public int ConcurrencyLimit { get; set; } = 10;
public TimeSpan PollInterval { get; set; } = TimeSpan.FromSeconds(2);
public Assembly[]? JobAssemblies { get; set; }
}
Properties
| Property | Type | Default | Description |
|---|---|---|---|
ApiKey | string | "" (required) | API key from the Zeridion Flare dashboard. |
ApiBaseUrl | string | "https://api.zeridion.com" | Cloud API base URL. |
DefaultQueue | string | "default" | Reserved for future use. Not currently consumed by the enqueue path. |
DefaultMaxAttempts | int | 3 | Reserved for future use. Not currently consumed by the enqueue path. |
DefaultTimeout | TimeSpan | 30 minutes | Reserved for future use. Not currently consumed by the enqueue path. |
ConcurrencyLimit | int | 10 | Max concurrent jobs the worker processes simultaneously. |
PollInterval | TimeSpan | 2 seconds | Interval between poll cycles when no jobs are available. |
JobAssemblies | Assembly[]? | null (scans entry assembly) | Assemblies to scan for job implementations. |
ApiKey
Required. An ArgumentException is thrown during service registration if the API key is empty or whitespace.
API keys use prefixes to indicate their environment:
| Prefix | Environment |
|---|---|
zf_live_sk_ | Production |
zf_test_sk_ | Test |
builder.Services.AddZeridionFlare(options =>
{
options.ApiKey = builder.Configuration["Zeridion:ApiKey"]!;
});
Never hardcode API keys in source code. Use appsettings.json, environment variables, or a secrets manager.
ApiBaseUrl
Override the API endpoint. The default points to the Zeridion cloud API. For local development against a self-hosted Flare API, point to http://localhost:5000:
builder.Services.AddZeridionFlare(options =>
{
options.ApiKey = builder.Configuration["Zeridion:ApiKey"]!;
options.ApiBaseUrl = "http://localhost:5000";
});
DefaultQueue, DefaultMaxAttempts, DefaultTimeout
These properties are defined on the options class but are not currently consumed by the SDK's enqueue path (FlareJobClient.BuildCreateRequest). The effective cascade for queue, max attempts, and timeout is JobOptions > [JobConfig] > hardcoded defaults (see Option Precedence).
Setting these properties has no effect in the current SDK version. Use [JobConfig] for per-class defaults or JobOptions for per-call overrides instead. These properties are reserved for a future release that will wire them into the cascade.
ConcurrencyLimit
Controls how many jobs the background worker processes in parallel. Higher values improve throughput but consume more CPU and memory. Set this based on your job characteristics:
| Job type | Recommended limit |
|---|---|
| I/O-bound (HTTP, DB, email) | 10–50 |
| CPU-bound (image processing) | 1–4 |
| Mixed workloads | 5–15 |
options.ConcurrencyLimit = 20; // process up to 20 jobs in parallel
PollInterval
How often the worker polls the API for new jobs when the previous poll returned nothing. Lower values increase responsiveness but generate more API traffic. The worker polls immediately after completing a job — this interval only applies to idle periods.
options.PollInterval = TimeSpan.FromSeconds(5); // check every 5 seconds when idle
JobAssemblies
By default, the SDK scans the entry assembly for IJob<T> and IRecurringJob implementations. If your job classes live in separate assemblies (a class library, for example), specify them explicitly:
options.JobAssemblies = new[]
{
typeof(SendWelcomeEmail).Assembly,
typeof(ProcessPayment).Assembly
};
Configuration from appsettings.json
Bind options from configuration for environment-specific overrides:
{
"Zeridion": {
"ApiKey": "zf_live_sk_xxxxxxxxxxxxxxxxxxxx",
"ApiBaseUrl": "https://api.zeridion.com",
"ConcurrencyLimit": 10
}
}
builder.Services.AddZeridionFlare(options =>
{
var section = builder.Configuration.GetSection("Zeridion");
options.ApiKey = section["ApiKey"]!;
options.ApiBaseUrl = section["ApiBaseUrl"] ?? options.ApiBaseUrl;
if (int.TryParse(section["ConcurrencyLimit"], out var concurrency))
options.ConcurrencyLimit = concurrency;
});
Usage example
A fully configured setup with all options:
builder.Services.AddZeridionFlare(options =>
{
options.ApiKey = builder.Configuration["Zeridion:ApiKey"]!;
options.ApiBaseUrl = builder.Environment.IsDevelopment()
? "http://localhost:5000"
: "https://api.zeridion.com";
options.ConcurrencyLimit = 20;
options.PollInterval = TimeSpan.FromSeconds(3);
options.JobAssemblies = new[] { typeof(Program).Assembly };
});
See also
- [JobConfig] Attribute — per-class defaults (lowest priority in the cascade)
- JobOptions — per-call overrides (highest priority in the cascade)
- Option precedence — the two-level cascade
- Configuration guide — getting started with configuration
- AddZeridionFlare — the registration method that accepts these options