-
Notifications
You must be signed in to change notification settings - Fork 16
SchedulerQueueCreation
Brian Lehnen edited this page Apr 9, 2026
·
4 revisions
By default, the scheduler will create queues using the transport default settings. However, you may pass in your own queue creation module. This lets you pick the options that will be used. For instance, here is how you would have the scheduler use a SQL server queue in which transactions are enabled.
This example assumes a scheduler instance named 'scheduler' has already been created.
var queueConnection = new QueueConnection("sampleSQL", connectionString);
using (var jobQueueCreation =
new JobQueueCreationContainer<SqlServerMessageQueueInit>())
{
using (var createQueue = jobQueueCreation.GetQueueCreation<SqlServerJobQueueCreation>(queueConnection))
{
createQueue.Options.EnableDelayedProcessing = false;
createQueue.Options.EnableHeartBeat = false;
createQueue.Options.EnableHoldTransactionUntilMessageCommitted = true;
createQueue.Options.EnableStatus = true;
scheduler.AddUpdateJob<SqlServerMessageQueueInit>(createQueue,
"test job5",
queueConnection,
"* * * * *",
(message, workerNotification) => Console.WriteLine(message.MessageId.Id.Value));
}
}If the queue does not already exist, it will be created with the above options.
The schedule uses a standard 5-field cron expression (minute hour day-of-month month day-of-week). For second-level granularity, use a 6-field expression with a leading seconds column. See Job Scheduler for cron syntax details.
For any issues please use the GitHub issues