All Products
Search
Document Center

Microservices Engine:Connect a Spring Boot application to SchedulerX

Last Updated:Mar 11, 2026

When your Spring Boot application needs distributed task scheduling -- such as recurring data syncs, periodic cleanup, or timed notifications -- SchedulerX provides centralized scheduling, execution monitoring, and failure alerting without requiring you to build scheduling infrastructure. After completing this guide, your application is registered as a SchedulerX worker, and the connected instance count appears in the MSE console.

Before you begin

Make sure that you have:

  • A Spring Boot 2.x or 3.x project with Maven configured

  • (Optional) A namespace created in the MSE console to isolate resources and services across environments. For details, see Create a namespace

Workflow overview

  1. Create a SchedulerX application in the MSE console to get connection parameters (endpoint, namespace, GroupID, and AppKey).

  2. Add the dependency and configure your Spring Boot project with the connection parameters and a job processor class.

  3. Verify the connection by checking the instance count in the console.

Step 1: Create a SchedulerX application

1.1 Configure basic settings

  1. Log on to the MSE SchedulerX console and select a region in the top navigation bar.

  2. In the left navigation pane, click Application Management. Select a Namespace, then click Create Application.

  3. Enter the Application Name and Application ID, select the Application Type, and configure any advanced settings. Then click Next.

image
Important

Make sure that resources are created in the selected region and namespace and that the resource information is valid.

The following table describes each field:

FieldDescriptionDefault
Application NameA custom name for the application.None
Application IDThe GroupID for client access. Must be unique within the namespace. Can be the same as Application Name.None
Application TypeRegular App: not deployed in Kubernetes and does not use Kubernetes jobs. k8s App: deployed in Kubernetes and uses Kubernetes jobs.Regular App
EditionSelect an edition based on your requirements.Professional Edition
Simple Log ServiceView scheduling logs (including distributed job logs) in the console. Requires a Log4j or Logback configuration in your application.Off
load5The 5-minute load average threshold. Cannot exceed the number of CPU cores on the client machine.0
Memory UsageIf the average memory usage in the past 5 minutes exceeds this threshold, the worker is considered busy.90%
Disk UsageIf disk usage exceeds this threshold, the client machine is considered busy.95%
Trigger Busy MachineWhether to continue triggering job execution when the machine is busy.On

Expand Advanced Configuration to access additional settings:

FieldDescriptionDefault
Maximum Number Of JobsThe maximum number of jobs supported in a group.1000
Automatic Scale-outAutomatically scale out resources. Requires setting Global Job Count.Off
Traffic ThrottlingThrottle traffic to prevent overload. Requires setting Task Instance Concurrency.Off
CalendarSchedule based on Financial Day (trading days for financial business) or Workday (standard working days).0

1.2 Configure notifications

  1. On the Notification Configuration page, select a Notification Channel and set Contacts. Supported notification channels: Text Message, Email, Webhook, and Phone. For webhook configuration details, see Webhook configuration description.

  2. Add notification recipients: The following table describes each contact field:

    FieldDescription
    Notification ChannelSupported channels: Text Message, Email, Webhook, and Phone.
    EmailThe email address of the contact.
    WebhookWebhook URL for WeCom, Lark, or DingTalk. Separate multiple URLs with commas (,). For DingTalk, add the case-sensitive keyword "SchedulerX" to the robot configuration. For details, see DingTalk Developer Documentation, WeCom Developer Documentation, and Lark Developer Documentation.
    Mobile Phone NumberThe mobile phone number of the contact.

    image

    image

  3. After completing the notification configuration, refresh the Application Management page and verify that the new application appears in the list under the selected region and namespace.

Step 2: Connect your Spring Boot application

2.1 Add the Maven dependency

Add the schedulerx2-spring-boot-starter dependency to your pom.xml:

<dependency>
    <groupId>com.aliyun.schedulerx</groupId>
    <artifactId>schedulerx2-spring-boot-starter</artifactId>
    <version>1.11.5</version> <!-- Replace with the latest version -->
    <!-- Exclude Log4j if you use Logback -->
    <exclusions>
        <exclusion>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </exclusion>
        <exclusion>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </exclusion>
    </exclusions>
</dependency>
Important

Replace 1.11.5 with the latest client version. For version information, see Client version release notes.

2.2 Configure connection parameters

Add the following properties to your application.properties file. Four parameters are required to connect SchedulerxWorker to SchedulerX:

# --- Required ---
spring.schedulerx2.endpoint=<your-endpoint>       # Regional endpoint (see table below)
spring.schedulerx2.namespace=<your-namespace-id>   # Namespace UID from the Namespaces page
spring.schedulerx2.groupId=<your-group-id>         # Application ID from Application Management
spring.schedulerx2.appKey=<your-app-key>           # Application key (agent 1.2.1+)

# --- Alternative authentication (if not using appKey) ---
# spring.schedulerx2.aliyunAccessKey=<your-access-key-id>
# spring.schedulerx2.aliyunSecretKey=<your-access-key-secret>
# spring.schedulerx2.stsToken=<your-sts-token>

Replace the placeholders with your actual values:

PlaceholderDescriptionWhere to find it
<your-endpoint>The regional endpoint for SchedulerX.Endpoint list
<your-namespace-id>The namespace UID.Namespaces page in the console
<your-group-id>The application ID (GroupID).Application Management page in the console
<your-app-key>The application key.Application Management page in the console

To quickly find your connection parameters, go to the Application Management page, click Access Configuration in the Actions column for your application, then select Spring Boot.

Access configuration
Important
Note

To manage multiple application groups within a single client, use comma-separated GroupIDs: spring.schedulerx2.groupId=animals.dog,animals.cat. Create each group separately in the console -- they share the same client instance.

2.3 Create a job processor

Extend JavaProcessor to handle scheduled tasks. The following example prints a message each time the job runs:

package com.aliyun.schedulerx.test.job;

import com.alibaba.schedulerx.worker.domain.JobContext;
import com.alibaba.schedulerx.worker.processor.JavaProcessor;
import com.alibaba.schedulerx.worker.processor.ProcessResult;
import org.springframework.stereotype.Component;

@Component
public class MyHelloJob extends JavaProcessor {

    @Override
    public ProcessResult process(JobContext context) throws Exception {
        System.out.println("hello schedulerx2.0");
        return new ProcessResult(true);  // Return true to indicate success
    }
}

Step 3: Verify the connection

  1. Start your Spring Boot application.

  2. Log on to the MSE SchedulerX console.

  3. In the left navigation pane, click Application Management. Select the correct region and namespace.

  4. Check the Total Instances column for your application:

    • Total Instances > 0: the application connected successfully. The number reflects the count of connected worker instances.

    • Total Instances = 0: the connection failed. Check your configuration parameters and network connectivity.

image

What to do next

After a successful connection, create scheduled tasks in the SchedulerX console. For details, see Create a scheduling task.

Configuration reference

All spring.schedulerx2.* properties are listed below. Only endpoint, namespace, groupId, and appKey are required.

PropertyDescriptionDefaultSince
spring.schedulerx2.enabledEnable or disable the SchedulerX 2.0 starter.true0.1.7
spring.schedulerx2.endpointRegional endpoint. See Endpoint list.N/A0.1.7
spring.schedulerx2.namespaceNamespace UID, from the Namespaces page.None0.1.7
spring.schedulerx2.groupIdApplication ID, from the Application Management page.N/A0.1.7
spring.schedulerx2.appKeyApplication key, from the Application Management page.N/A1.2.1
spring.schedulerx2.hostActual IP address when multiple IPs exist (VPN, multiple NICs).N/A0.1.7
spring.schedulerx2.portCustom port for the client listener. A random available port is used if not set.None0.1.7
spring.schedulerx2.blockAppStartBlock application startup if SchedulerX initialization fails.true1.1.0
spring.schedulerx2.shareContainerPoolShare a thread pool across all task executions on the client.false1.2.1.2
spring.schedulerx2.sharePoolSizeThread pool size when shareContainerPool is enabled.641.2.1.2
spring.schedulerx2.labelTags for the client. Use with task management for canary releases or stress testing.N/A1.2.2.2
spring.schedulerx2.enableCgroupMetricsCollect metrics using cgroup. Enable manually in Kubernetes container environments.false1.2.2.2
spring.schedulerx2.cgroupPathPrefixCgroup path in the container./sys/fs/cgroup/cpu/1.2.2.2
spring.schedulerx2.enableHeartbeatLogWrite heartbeat logs to ${user.home}/logs/schedulerx/heartbeat.log.true1.2.4
spring.schedulerx2.mapMasterStatusCheckIntervalInterval (ms) for checking whether all sub-tasks are complete in the Map model. Lower values increase scheduling frequency for second-granularity jobs.30001.2.5.2
spring.schedulerx2.enableSecondDelayCycleIntervalMsInterpret second_delay latency in milliseconds instead of seconds, increasing scheduling frequency.false1.2.5.2
spring.schedulerx2.broadcastMasterExecEnableWhether the primary node participates in broadcast task execution.true1.8.13
spring.schedulerx2.broadcastDispatchRetryTimesMaximum retries after a broadcast dispatch failure. Retry interval is fixed at 2 seconds.31.8.13
spring.schedulerx2.enableSecondDelayStandaloneDispatchDispatch standalone jobs every second.false1.8.13

FAQ

Related topics

For other client connection methods, see Quickly connect a client to SchedulerX.