Class ExecutionGroupAttribute
- Namespace
- Quartz
- Assembly
- Quartz.dll
The execution group a trigger for this job counts against when it names none of its own, such as
[ExecutionGroup("tenant:{TenantId}")].
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
public sealed class ExecutionGroupAttribute : Attribute
- Inheritance
-
ExecutionGroupAttribute
- Inherited Members
Remarks
Read by TriggerBuilder<TJob> for its own TJob, and by the one-call
ScheduleJob<TJob, TInput> overloads. An explicit WithExecutionGroup — or
ExecutionGroup — wins, and WithExecutionGroup(null) opts one
trigger out. A trigger built for IJob, or built before this attribute was added, is not
affected: the group is resolved once, when the trigger is built, and stored as a plain name.
{key} placeholders read the trigger's own JobDataMap when the trigger is built.
{{ and }} are literal braces. A placeholder with nothing behind it fails the build,
naming the key.
A manual firing — TriggerJob(JobKey, JobDataMap?, CancellationToken), and so the HTTP API and the dashboard — and a
RunAtStartup run read it too, off the job type stored with the job. Their placeholders read the
job's JobDataMap overlaid by the firing's, the map the job will see. A placeholder with
nothing behind it, or a type this node cannot load, does not fail the firing: it takes the group every
trigger of the job shares, or none.
The one-call overloads apply a name with no placeholders. A one-off trigger's job data is its input,
stored whole, so a template there has nothing to read and the call throws
FormatException: name the group at the call site instead, as in
OneOffJobOptions.ExecutionGroup = $"tenant:{input.TenantId}".
Inherited from a base class. Unlike DisallowConcurrentExecutionAttribute it is not read from interfaces, because a group is a property of the concrete work, and two contracts could name two.
Constructors
ExecutionGroupAttribute(string)
Declares the execution group, or a template for one.
public ExecutionGroupAttribute(string template)
Parameters
templatestringA group name, or one with
{key}placeholders.
Exceptions
- ArgumentNullException
templateis null.- ArgumentException
templateis blank, malformed, or a name reserved for limits configuration.
Properties
Template
The execution group, or the template it is resolved from.
public string Template { get; }