Table of Contents

Class HttpClientOptions

Namespace
Quartz
Assembly
Quartz.HttpClient.dll

What AddQuartzHttpClient needs to build an HttpScheduler: which remote scheduler to address, and which HttpClient to reach it with.

public sealed class HttpClientOptions
Inheritance
HttpClientOptions
Inherited Members

Remarks

The client is named or built, never held: exactly one of HttpClientName and CreateHttpClient is given, and the options are validated when the scheduler is first resolved rather than when they are bound.

Properties

CreateHttpClient

Builds the client to call the remote scheduler with, for a client that is not registered by name.

public Func<IServiceProvider, HttpClient>? CreateHttpClient { get; set; }

Property Value

Func<IServiceProvider, HttpClient>

Remarks

Either this or HttpClientName must be given, and not both. It runs once, when the scheduler is first resolved, and is handed the container so that a client assembled from other services — a handler, a token provider — can be built here.

The client it returns is not disposed by the scheduler: whoever created it owns it. This is a factory rather than a client for that reason — an options object is bound, cached and shared, and a live HttpClient sitting in one is a disposable resource with no owner and no way to bind it from configuration.

HttpClientName

The name the client is registered under with AddHttpClient, resolved through IHttpClientFactory.

public string? HttpClientName { get; set; }

Property Value

string

Remarks

Either this or CreateHttpClient must be given, and not both. This is the shape to reach for: the factory pools and recycles handlers, which is what keeps a long-lived client from pinning stale DNS.

JsonSerializerOptions

Optional json serializer options to be used by the HTTP scheduler

public JsonSerializerOptions? JsonSerializerOptions { get; set; }

Property Value

JsonSerializerOptions

SchedulerName

Name of the scheduler, must be same as the remote scheduler.

public string SchedulerName { get; set; }

Property Value

string