Skip to main content
Winter DTCE is a real-time Distributed Task Computing Engine for Winter Boot. It accepts tasks and jobs, queues them durably, and processes them through workers that you define. This page explains how DTCE works, which backends it supports, and how to configure and execute your first distributed task. A task is a small logical unit that makes progress toward a unified goal of the system. A job is a collection of similar tasks. DTCE provides the following capabilities:
  • Execute a task synchronously and asynchronously
  • Execute a big job (many tasks) synchronously and asynchronously
  • Persist tasks through a storage backend, so they are not lost on restarts or failures

Setup

Require the modules package and enable DTCE in your application:
Add the module to your application.yml:

PHP extension prerequisites

  • swoole extension is required.
  • redis extension is needed if Redis is used as a backend store.
  • rdkafka extension is needed if Kafka is used as a queue.

Architecture

There are three main components.

1. Task Queue

Any executable task is placed in the queue, then processed by a worker. Any queue implementation must implement TaskQueueHandler. This module provides four implementations out of the box.

2. Task Store

Input data to a worker and output data from a worker are stored in the Task Store. Any store implementation must implement TaskIOStorageHandler. This module provides four implementations out of the box.

3. Task Worker

This is the actual implementation of your work. A task worker must implement TaskWorker.

Example worker and execution

The following WordCounter worker counts the number of words in a string:
Execute it through TaskExecutionServiceFactory:

DTCE configuration (dtce-config.yml)

A minimal dtce-config.yml assigns a queue handler, a storage handler, and a worker class to a named task:

Full configuration

DTCE complements the built-in framework primitives. For single-process background work see Async Tasks and Scheduled Tasks; use DTCE when you need distributed, persistent task processing across nodes. Redis-backed queues use the Redis module; Kafka-backed queues use the Kafka module.