Route jobs to specific machines with tags
When machines in an application group run different job implementation classes -- for example, a canary build alongside a production build -- random scheduling can dispatch a job to a machine that lacks the required class, causing failures. Tags solve this by pinning jobs to a subset of machines that share the same tag, so you can run canary releases or stress tests within a single application group.
Add the spring.schedulerx2.label property to register a tag on the SchedulerX agent, then bind jobs to that tag in the console.
How tags compare to multiple application groups
The traditional workaround is to create a dedicated application group for canary or stress-testing machines. Tags eliminate the drawbacks of that approach:
| Multiple application groups | Tags (single group) |
|---|---|
| Normal jobs cannot run on canary machines, so canary machines sit idle between releases | All machines stay in one group. Normal jobs still run on tagged machines |
| After the canary passes, you must recreate the job in the original group and delete the canary job | Remove the tag binding. No job recreation needed |
Prerequisites
Before you begin, make sure that you have:
A SchedulerX application group with connected instances
A Spring Boot application connected to SchedulerX (see Connect a Spring Boot application to SchedulerX)
Step 1: Register a tag on the agent
Add the spring.schedulerx2.label property to your Spring Boot configuration file. The following example registers the tag gray:
spring.schedulerx2.label=grayVerify the tag
Log on to the SchedulerX console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Application Management.
On the Application Management page, click View Instances in the Operation column.
In the Connect to an instance panel, confirm that the tag column displays the tag you registered (for example,
gray).
Step 2: Bind a job to tagged machines
Log on to the SchedulerX console.
In the top navigation bar, select a region.
In the left-side navigation pane, click Jobs.
On the Task Management page, find the target job and click more in the Operation column, then click Specify machine.
On the Specify machine page, set Named Types to tag, select the machines that should run the job, and click OK.
The job now runs only on the selected tagged machines.
Canary release workflow
Tags are designed for canary releases. The following workflow covers the full cycle from deploying a new job implementation class through to promotion:
Tag the canary machines. Set
spring.schedulerx2.label=grayin the Spring Boot configuration of the machines that will run the new implementation class.Verify the tag. Confirm that the canary machines appear with the correct tag in the Connect to an instance panel (see Step 1).
Bind the job. On the Specify machine page, set Named Types to tag and select the canary machines (see Step 2).
Validate. Run the job and verify that it runs only on the tagged machines with the expected behavior.
Promote. After validation, the new job implementation class is available on all of the selected machines.
Remove the tag. Delete the specified tag. The tag configuration dynamically takes effect.
Tag changes take effect dynamically.