Control Framework Start Queue
Purpose
Section titled “Purpose”Generates a SQL Server script that starts the DIRECT Framework data-logistics state-machine queue — the SQL Agent jobs that poll the control-framework tables and execute registered modules and batches.
Motivation
Section titled “Motivation”DIRECT runs its data-logistics work through two SQL Agent jobs: Queue_Batch (orchestrates registered Batches) and Queue_Module (executes individual Modules). For a controlled startup — say, after maintenance or before a scheduled load window — you need a script that starts those jobs only if they’re not already running.
This template generates that script. It checks the current state of each job using msdb.dbo.sysjobactivity and starts it only when no active execution is present.
Applicability
Section titled “Applicability”- SQL Server family databases with SQL Server Agent enabled.
- DIRECT Framework deployments only.
Design Pattern
Section titled “Design Pattern”N/A — operational control.
Schema Type
Section titled “Schema Type”- All Metadata
Output Type
Section titled “Output Type”- SQL
Implementation guidelines
Section titled “Implementation guidelines”The script targets msdb and uses sysjobactivity to determine whether a given queue job is currently executing. The output is static SQL — no metadata interpolation — but the template lives in the all-metadata reference so that it can be bundled with the rest of a project’s deployment scripts.
Considerations and consequences
Section titled “Considerations and consequences”- Requires
SQLAgentOperatorRoleor higher on the deploying account. - Pairs with the Stop Queue template — typical usage is a maintenance window that stops both jobs, applies changes, then starts them again.
- If your DIRECT deployment renames the queue jobs (
Queue_Batch/Queue_Module), edit the generated SQL or the template to match.
Extensions
Section titled “Extensions”N/A — the template is static SQL.