Prerequisites
You need PHP 8.5 or later with theswoole and pcntl extensions.
Project structure
The sample uses this layout:Install dependencies
Require the framework and the modules package:Source files
Switch between the five source files. Each tab shows the exact file from the sample.- DtceSampleApplication.php
- InvoiceTotalWorker.php
- InvoiceDemoController.php
- bin/application.php
- composer.json
The single entry point. It points Winter Boot at the
config directory and at the sample namespace.Configuration
Switch between the two config files.application.yml enables the module and sets the shared-queue port, and dtce-config.yml defines the invoiceTotal task with its worker, disk store, and shared queue.
- application.yml
- dtce-config.yml
The full sample file registers See Configuration for every
DtceModule and sets the server and app identity. winter.queue.port is required by the shared queue used below:application.yml key.Run the app
Start the app, price one order, settle a batch, then check the output file. 1. Start the application:invoiceTotal queue as soon as the app boots.
2. Price a single order:
Next steps
- Read the DTCE module for the async APIs (
addTask,addJob,taskStatus,stopTask), persistent backends, and full configuration. - Browse all Libraries when you need Kafka, SQS, Redis, or Doctrine in the same app.