メインコンテンツまでスキップ

Extend Task Scheduler

Last updated on July 3, 2026

Overview

Extend Task Scheduler enables you to define tasks with custom logic within your Extend app and run them at scheduled times. If you are already familiar with cron, you will find scheduling task execution with Extend Task Scheduler straightforward.

important

Extend Task Scheduler is available only in the Extend Service Extension app.

Create a task containing custom logic in your Extend Service Extension app

  1. In your Extend app project, create pkg/proto/generic/task_scheduler/v1 folder and put task_scheduler.proto there.

  2. Run make proto to generate consumer client code from task_scheduler.proto.

  3. Implement your custom logic in OnJobTriggered handler.

    package service

    import (
    "io"

    "github.com/sirupsen/logrus"
    "google.golang.org/grpc"

    ts "extend-custom-task-service/pkg/pb/generic/task_scheduler/v1"
    )

    type TaskSchedulerServiceImpl struct {
    ts.UnimplementedTaskSchedulerServiceServer
    myService *MyServiceServerImpl
    }

    func NewTaskSchedulerService(myService *MyServiceServerImpl) *TaskSchedulerServiceImpl {
    return &TaskSchedulerServiceImpl{
    myService: myService,
    }
    }

    func (s *TaskSchedulerServiceImpl) OnJobTriggered(
    stream grpc.BidiStreamingServer[ts.ExecutionContext, ts.Response],
    ) error {
    for {
    // Receive ExecutionContext from the stream
    execCtx, err := stream.Recv()
    if err == io.EOF {
    // Client closed the stream
    return nil
    }
    if err != nil {
    logrus.Errorf("Error receiving ExecutionContext: %v", err)
    return err
    }

    // Handle different message types
    switch execCtx.MessageType {
    case ts.MessageType_TASK_START:
    // Increment task execution count when a task starts
    s.myService.IncrementTaskExecutionCount()
    logrus.Infof("Task started with cron expression: %s", execCtx.CronExpression)
    case ts.MessageType_HEART_BEAT:
    // Handle heartbeat - just log it
    logrus.Infof("Received heartbeat with cron expression: %s", execCtx.CronExpression)
    default:
    logrus.Warnf("Unknown message type: %v", execCtx.MessageType)
    }

    // Send a response back
    response := &ts.Response{}
    if err := stream.Send(response); err != nil {
    logrus.Errorf("Error sending response: %v", err)
    return err
    }
    }
    }
  4. Register the handler.

    taskSchedulerService := service.NewTaskSchedulerService(myServiceServer)
    ts.RegisterTaskSchedulerServiceServer(s, taskSchedulerService)

Set task execution schedules

  1. On the App Details page of your Extend Service Extension app, go to the Task Scheduler tab, and click the Create Task button.

    Task scheduler tab with no task yet

  2. Enter a task name, a cron schedule, and the task's start and end dates. The task will run according to the specified cron schedule for as long as it remains within this date range.

    Create task modal

  3. You can create multiple tasks, as well as temporarily disable or delete any existing tasks.

    Task scheduler tab with tasks

important

Make sure that your Extend Service Extension app, which contains the task for the Task Scheduler, is running: Otherwise, a warning will appear and the scheduled task may not run.

Task scheduler warning

Review task execution history

  1. On the App Details page of your Extend Service Extension app, go to the Task Scheduler tab, and click the name of the task you want to review.

    Task scheduler tab with tasks

  2. You can view the task's execution history, status, duration, and associated logs. You can also run the task manually at any time by clicking Run Task Now button, or update its configuration by clicking Edit Task button.

    Task scheduler tab with tasks

Samples

The sample Extend Service Extension app below includes a task with custom logic that can be triggered by the Extend Task Scheduler.

git clone https://github.com/AccelByte/extend-service-extension-with-task-scheduler-go.git