-
Notifications
You must be signed in to change notification settings - Fork 16
SchedulerQueueCreation
Brian Lehnen edited this page Dec 8, 2020
·
2 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.EnableHoldTransactionUntilMessageCommited = true;
createQueue.Options.EnableStatus = true;
scheduler.AddUpdateJob<SqlServerMessageQueueInit>(createQueue,
"test job5",
"sampleSQL",
connectionString,
"min(*)",
(message, workerNotification) => Console.WriteLine(message.MessageId.Id.Value));
}
}
If the queue does not already exist, it will be created with the above options.
For any issues please use the GitHub issues