All Products
Search
Document Center

SchedulerX:Connect to SchedulerX over the Internet

Last Updated:Mar 11, 2026

On-premises machines, third-party servers, and containers that have Internet access can connect to SchedulerX through the Internet region. This enables you to develop and test scheduled jobs locally before deploying to Alibaba Cloud.

Prerequisites

Before you begin, make sure that you have:

  • Activated SchedulerX. For more information, see Activate SchedulerX

  • Created resources with the Internet region selected for the application. For more information, see Create resources

Access configuration parameters

To connect to SchedulerX, each application requires four configuration values, such as the Internet region and the acm.aliyun.com endpoint.

ParameterDescription
endpointSchedulerX service endpoint
namespaceNamespace that isolates environments
groupIdApplication group identifier
appKeyApplication key (required for agent version 1.2.1 or later)

To retrieve these values:

  1. Log on to the SchedulerX console. In the top navigation bar, select the Internet region.

  2. In the left-side navigation pane, click Application Management. Find your application and click Access configuration in the Operation column.

    Application Management page

  3. In the Access configuration panel, select an access method from the drop-down list (rectangular box 1 in the following figure). The panel displays the configuration values for the selected method.

    Access configuration panel

Connect your application

The following steps walk through adding the Maven dependency, initializing SchedulerxWorker, and creating a scheduled job. Choose the instructions that match your application type.

  1. Add the SchedulerxWorker dependency to your pom.xml file.

    Java or Spring application

    <dependency>
      <groupId>com.aliyun.schedulerx</groupId>
      <artifactId>schedulerx2-worker</artifactId>
      <version>${schedulerx2.version}</version>
      <!--If you use Logback, exclude Log4j and Log4j 2. -->
      <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>

    Spring Boot application

    <dependency>
      <groupId>com.aliyun.schedulerx</groupId>
      <artifactId>schedulerx2-spring-boot-starter</artifactId>
      <version>${schedulerx2.version}</version>
      <!-- If you use Logback, exclude Log4j and Log4j 2. -->
      <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>
  2. Use the configuration values retrieved from the console to initialize SchedulerxWorker. In the Access configuration panel, click One click copy to copy the values, or manually replace the placeholders below.

    Java application

    Initialize SchedulerxWorker in your main function:

    public void initSchedulerxWorker() throws Exception {
        SchedulerxWorker schedulerxWorker = new SchedulerxWorker();
        schedulerxWorker.setEndpoint("xxxx");     // Replace with your endpoint
        schedulerxWorker.setNamespace("xxxx");     // Replace with your namespace
        schedulerxWorker.setGroupId("xxxx");       // Replace with your group ID
        // Required for agent version 1.2.1 or later
        schedulerxWorker.setAppKey("xxxx");        // Replace with your application key
        schedulerxWorker.init();
    }
    Note
    • Multiple groups: To categorize scheduled jobs or provide multiple services, create multiple groups and append all group names to the groupId parameter. For example, groupId=animals.dogs,animals.cats. Instances are shared across groups automatically.

    • Additional parameters: For a full list of initialization options, see SchedulerxWorker parameters.

    Spring application

    Inject the SchedulerxWorker bean into your XML configuration file:

    <bean id="schedulerxWorker" class="com.alibaba.schedulerx.worker.SchedulerxWorker">
        <property name="endpoint">
          <value>${endpoint}</value>
        </property>
        <property name="namespace">
          <value>${namespace}</value>
        </property>
        <property name="groupId">
          <value>${groupId}</value>
        </property>
        <!--Required for agent version 1.2.1 or later -->
        <property name="appKey">
          <value>${appKey}</value>
        </property>
    </bean>

    Spring Boot application

    Add the following properties to your application.properties file:

    spring.schedulerx2.endpoint=${endpoint}
    spring.schedulerx2.namespace=${namespace}
    spring.schedulerx2.groupId=${groupId}
    # Required for agent version 1.2.1 or later
    spring.schedulerx2.appKey=${appKey}
  3. Create a class that extends JavaProcessor to define your job logic. The following example prints hello schedulerx2.0 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;
    
    @Component
    public class MyHelloJob extends JavaProcessor {
    
        @Override
        public ProcessResult process(JobContext context) throws Exception {
            System.out.println("hello schedulerx2.0");
            return new ProcessResult(true);
        }
    }
  4. Start your application in the on-premises environment.

Verify the connection

After starting the application, verify that it has connected to SchedulerX:

  1. Publish the application to Alibaba Cloud after the application is connected to SchedulerX.

  2. Log on to the SchedulerX console.

  3. In the top navigation bar, select a region.

  4. In the left-side navigation pane, click Application Management.

  5. Check the Total number of instances column for your application.

    • 0 instances: The application is not connected. Review the access configuration and make sure that your on-premises machine can reach the SchedulerX endpoint.

    • Non-zero: The application is connected. Click View instances in the Operation column to view the connected instances in the Connect to an instance panel.