Click or drag to resize
QueueAttribute Class
Represents attribute, that is used to determine queue name for background jobs. It can be applied to the methods and classes. If the attribute is not applied neither to the method, nor the class, then default queue will be used.
Inheritance Hierarchy

Namespace: Hangfire
Assembly: Hangfire.Core (in Hangfire.Core.dll) Version: 1.5.0.0
Syntax
public sealed class QueueAttribute : JobFilterAttribute, 
	IElectStateFilter

The QueueAttribute type exposes the following members.

Constructors
  NameDescription
Public methodQueueAttribute
Initializes a new instance of the QueueAttribute class using the specified queue name.
Top
Properties
  NameDescription
Public propertyAllowMultiple (Inherited from JobFilterAttribute.)
Public propertyOrder (Inherited from JobFilterAttribute.)
Public propertyQueue
Gets the queue name that will be used for background jobs.
Top
Methods
  NameDescription
Public methodOnStateElection
Top
Examples
[Queue("high")] public class ErrorService { public void ReportError(string message) { } [Queue("critical")] public void ReportFatal(string message) { } } // Background job will be placed on the 'high' queue. BackgroundJob.Enqueue<ErrorService>(x => x.ReportError("Something bad happened")); // Background job will be placed on the 'critical' queue. BackgroundJob.Enqueue<ErrorService>(x => x.ReportFatal("Really bad thing!"));
See Also