Table of Contents

Class QuartzAspNetCoreConfigurationExtensions

Namespace
Quartz
Assembly
Quartz.AspNetCore.dll

Registers and maps the Quartz HTTP API — the server half of Quartz.HttpClient.

public static class QuartzAspNetCoreConfigurationExtensions
Inheritance
QuartzAspNetCoreConfigurationExtensions
Inherited Members

Methods

AddQuartzHttpApi(IServiceCollection, Action<QuartzHttpApiOptions>?)

Serves the schedulers in this container over HTTP, so a remote client can drive them.

public static IServiceCollection AddQuartzHttpApi(this IServiceCollection services, Action<QuartzHttpApiOptions>? configure = null)

Parameters

services IServiceCollection

The service collection.

configure Action<QuartzHttpApiOptions>

Configures the API, including the path it is served under.

Returns

IServiceCollection

Remarks

The API is container-wide rather than a scheduler's — a request names the scheduler it is for — so this is where it belongs, and there is deliberately no IQuartzBuilder form: written inside AddQuartz(name, …) it would look like that scheduler's API while configuring everybody's, and two of them with different ApiPaths would be last-writer-wins. Call MapQuartzHttpApi() on the application to map the endpoints.

MapQuartzHttpApi(IEndpointRouteBuilder)

Maps the Quartz HTTP API endpoints under the path AddQuartzHttpApi(IServiceCollection, Action<QuartzHttpApiOptions>?) configured, which defaults to /quartz-api.

public static IEndpointConventionBuilder MapQuartzHttpApi(this IEndpointRouteBuilder builder)

Parameters

builder IEndpointRouteBuilder

Returns

IEndpointConventionBuilder

MapQuartzHttpApi(IEndpointRouteBuilder, string)

Maps the Quartz HTTP API endpoints under the given route pattern.

public static IEndpointConventionBuilder MapQuartzHttpApi(this IEndpointRouteBuilder builder, string pattern)

Parameters

builder IEndpointRouteBuilder

The endpoint route builder.

pattern string

The path the API is served under, for example /quartz-api.

Returns

IEndpointConventionBuilder

Remarks

Naming the path where the endpoints are mapped is how the rest of ASP.NET Core reads — MapHealthChecks("/health") — and it puts the route beside an application's other routes rather than in a registration callback somewhere else.

The pattern given here wins over ApiPath, whichever way that was set. It has to start with /, the same rule the option is validated against.