Scheduled publication: time, time zones and repeated execution
Define the publication instant and protect a schedule from repeated or obsolete messages using Symfony Clock, native PDO and a MySQL 8.4/InnoDB transaction.
An article is ready, but it should appear in the journal later. At first glance, saving a date and adding a job to a queue seems sufficient. Yet the form displays local time, the server compares instants, and a message can arrive late or more than once. Before starting a worker, it helps to define exactly what “publish at ten” means.
The Schedule module uses a separate native PDO connection to MySQL 8.4, app.schedule_connection, explicitly injected into the handler and demonstration command. Its factory creates an owned temporary teaching schema through the shared App\Infrastructure\MysqlLab; run the example through the guarded MySQL fixture introduced earlier in article_demo. Preserve the earlier exercises’ PDO service. Messenger invokes the handler synchronously; this exercise configures no broker, background worker or external message delivery.
Agree on the meaning of time first
In this example, publication is allowed when publish_at_epoch <= now. Equality already means the deadline has arrived. Before that instant the article remains scheduled; after it, a delivery delay does not cancel the author's decision. All comparisons use whole seconds. Fractional seconds, recurring schedules and calendar rules are outside this model.
The saved deadline and the observed processing time serve different purposes. The publish_at_epoch field holds the agreed instant, while published_at_epoch holds the instant the handler read from its clock. It is not the exact time the transaction finished. If a message arrives five minutes late, both values should remain available for examining that delay.
A time zone interprets the author's intent. The name Europe/Kyiv describes a set of rules, while +02:00 describes just one offset. The IANA database is updated as civil time changes. A real editor should therefore retain the original local input, zone name and chosen offset alongside the resolved instant. Our handler starts with that resolved instant; the scheduling interface is outside the example.
For a one-time publication, we choose a fixed-instant policy: a change to time-zone rules after confirmation does not silently move it. If the author wants to preserve a future local hour under the new rules instead, that is a separate rescheduling decision with a new schedule version.
The next step in the shared project
Continue the same Symfony project, article_demo, built from the official skeleton. Run commands from its root and preserve earlier routes, services and data. Add only the required public dependencies. Requirements are PHP 8.4+, Composer 2, the pdo_mysql extension and MySQL 8.4 with InnoDB. The commands below require the shared MysqlLab and guarded disposable MySQL fixture already added to the project; the bash fixtures/mysql_labs/run.sh wrapper passes their configuration to the PHP process. See the PDO MySQL documentation for the driver.
composer require symfony/clock:"8.1.*" symfony/messenger:"8.1.*" 'ext-pdo:*' 'ext-pdo_mysql:*'
composer require --dev symfony/test-pack phpunit/phpunit:"^12.5"
Local input must identify one instant
The contract accepts local time, a numeric offset and a zone name. Adding the offset removes the ambiguity of a repeated autumn hour. At the same time, an arbitrary offset must not make a nonexistent spring time valid.
The src/Schedule/PublicationTime.php file first checks the input shape, then parses the date and converts it back into the specified zone. The reconstructed input must exactly match the original. PHP documents normalization of overflowing dates, so successfully creating an object is insufficient. The warning check also accounts for getLastErrors returning false when there are no errors.
<?php
declare(strict_types=1);
namespace App\Schedule;
use DateTimeImmutable;
use DateTimeZone;
use InvalidArgumentException;
final class PublicationTime
{
public static function resolve(string $local, string $offset, string $zone): DateTimeImmutable
{
if (!preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/D', $local)
|| !preg_match('/^[+-]\d{2}:\d{2}$/D', $offset)
|| !in_array($zone, DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC), true)) {
throw new InvalidArgumentException('Expected local time, numeric offset and an IANA zone.');
}
$input = $local.$offset;
$instant = DateTimeImmutable::createFromFormat('!Y-m-d\TH:i:sP', $input);
$errors = DateTimeImmutable::getLastErrors();
if ($instant === false
|| ($errors !== false && ($errors['warning_count'] > 0 || $errors['error_count'] > 0))
|| $instant->format('Y-m-d\TH:i:sP') !== $input
|| $instant->setTimezone(new DateTimeZone($zone))->format('Y-m-d\TH:i:sP') !== $input) {
throw new InvalidArgumentException('Local time and offset do not match the zone.');
}
return $instant->setTimezone(new DateTimeZone('UTC'));
}
}
In the test data, ten in Kyiv and nine in Warsaw in January represent the same instant. The autumn overlap is checked as two distinct instants, 3600 seconds apart. The spring gap is rejected with both adjacent offsets. Calendar values inside the tests are historical fixtures; they do not describe when the experiment ran or predict future clock-change rules.
The message names a decision version
An article key alone is insufficient. The author may reschedule publication while an old message is already queued. The scheduleVersion field ties the message to a particular scheduling decision. Every rescheduling operation increases this version. It must never be reset, reused or bypassed by an unchecked write.
The src/Schedule/PublishScheduled.php file contains only data. It does not carry the complete article, a database object or a dependency on the server's local time.
<?php
declare(strict_types=1);
namespace App\Schedule;
use InvalidArgumentException;
final readonly class PublishScheduled
{
public function __construct(public string $articleKey, public int $scheduleVersion)
{
if (!preg_match('/^[a-z][a-z0-9-]{0,63}$/D', $articleKey) || $scheduleVersion < 1) {
throw new InvalidArgumentException('Invalid article key or schedule version.');
}
}
}
The src/Schedule/LabDatabase.php file explicitly creates two InnoDB teaching tables through a separate migrator connection, before the business transaction begins. The first stores the current state; the second stores a publication event intent. Keys use VARCHAR with utf8mb4_0900_bin collation; the version and time instants use BIGINT SIGNED. A foreign key, CHECK constraints, and uniqueness of the event key and article-version pair enforce the model's rules. After setup, the handler and command receive a runtime connection without CREATE, ALTER or DROP privileges. This is neither an atomic schema upgrade nor an automatic data transfer from the old SQLite database: MySQL DDL can implicitly commit a transaction.
<?php
declare(strict_types=1);
namespace App\Schedule;
use App\Infrastructure\MysqlLab;
use PDO;
final class LabDatabase
{
public static function connect(): PDO
{
return self::createFixture()->runtime();
}
public static function createFixture(): MysqlLab
{
$fixture = MysqlLab::create('schedule');
try {
$db = $fixture->migrator();
$db->exec(<<<'SQL'
CREATE TABLE article_head (
article_key VARCHAR(64) NOT NULL PRIMARY KEY,
schedule_version BIGINT SIGNED NOT NULL CHECK (schedule_version > 0),
state VARCHAR(16) NOT NULL CHECK (state IN ('draft', 'scheduled', 'published', 'cancelled')),
publish_at_epoch BIGINT SIGNED NOT NULL,
published_at_epoch BIGINT SIGNED NULL
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin
SQL);
$db->exec(<<<'SQL'
CREATE TABLE publication_intent (
event_key VARCHAR(92) NOT NULL PRIMARY KEY,
article_key VARCHAR(64) NOT NULL,
schedule_version BIGINT SIGNED NOT NULL,
occurred_at_epoch BIGINT SIGNED NOT NULL,
UNIQUE (article_key, schedule_version),
FOREIGN KEY (article_key) REFERENCES article_head(article_key)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin
SQL);
return $fixture;
} catch (\Throwable $error) {
$fixture->close();
throw $error;
}
}
}
The model assumes one publication per schedule version and forbids deleting and recreating the same key with a reset version. Another release after publication would need a separate rule. In this example, authorization of transitions and the form that increments the version remain outside the handler.
Keep the condition next to the state change
The handler reads the clock once, starts its own short transaction and performs a conditional update. The state, version and deadline checks are in the same SQL statement that changes the state. Reading first and writing unconditionally later would leave a window for a stale decision.
The src/Schedule/PublishWhenDue.php file records an event intent only after exactly one row changes. Both writes belong to one InnoDB transaction. If inserting the intent fails, the handler rolls back its own transaction if it is still active and propagates the error. This matters because InnoDB errors have different rollback scopes: not every error automatically cancels the entire transaction. The handler rejects an existing outer transaction. For native prepared statements, the single observed clock value is bound through two distinct parameters: :published_now and :due_now.
<?php
declare(strict_types=1);
namespace App\Schedule;
use LogicException;
use PDO;
use Psr\Clock\ClockInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Throwable;
#[AsMessageHandler]
final class PublishWhenDue
{
public function __construct(private readonly PDO $pdo, private readonly ClockInterface $clock)
{
}
public function __invoke(PublishScheduled $message): bool
{
if ($this->pdo->inTransaction()) {
throw new LogicException('This handler owns its transaction.');
}
$now = $this->clock->now()->getTimestamp();
$this->pdo->beginTransaction();
try {
$update = $this->pdo->prepare(<<<'SQL'
UPDATE article_head
SET state = 'published', published_at_epoch = :published_now
WHERE article_key = :key
AND schedule_version = :version
AND state = 'scheduled'
AND publish_at_epoch <= :due_now
SQL);
$update->execute([
'published_now' => $now,
'due_now' => $now,
'key' => $message->articleKey,
'version' => $message->scheduleVersion,
]);
$changed = $update->rowCount() === 1;
if ($changed) {
$intent = $this->pdo->prepare(<<<'SQL'
INSERT INTO publication_intent
(event_key, article_key, schedule_version, occurred_at_epoch)
VALUES (:event, :key, :version, :now)
SQL);
$intent->execute([
'event' => 'publish:'.$message->articleKey.':'.$message->scheduleVersion,
'key' => $message->articleKey,
'version' => $message->scheduleVersion,
'now' => $now,
]);
}
$this->pdo->commit();
return $changed;
} catch (Throwable $error) {
if ($this->pdo->inTransaction()) {
$this->pdo->rollBack();
}
throw $error;
}
}
}
A repeated message sees the already published state and leaves the first processing time intact. An obsolete version, a cancelled schedule and an early delivery also leave the row unchanged. These are different reasons for the same handler result; an operational journal should distinguish them without weakening the update condition.
Messenger allows redelivery, including after a failure between processing and acknowledgement. In the example, the stable event key comes from the article and schedule version. A random key generated for every dispatch would give the same decision a new identity each time.
An intent record is not yet a sent email or an updated search index. Delivering it requires a separate mechanism with its own retries and an idempotent recipient. This transaction covers only two local tables and does not promise that every external effect happens exactly once.
A clock and a container without hidden magic
Merge these definitions under the existing services key in config/services.yaml. Preserve earlier registrations, _defaults and imports; keep the rest of the file. DTOs and static factories do not need broad App\ service scanning.
services:
app.schedule_connection:
class: PDO
factory: ['App\Schedule\LabDatabase', 'connect']
Symfony\Component\Clock\NativeClock: ~
Psr\Clock\ClockInterface:
alias: Symfony\Component\Clock\NativeClock
App\Schedule\PublishWhenDue:
arguments:
$pdo: '@app.schedule_connection'
App\Command\SchedulePublicationDemoCommand:
arguments:
$pdo: '@app.schedule_connection'
Native composer require symfony/messenger lets Flex add config/packages/messenger.yaml. Keep handling synchronous: add no async transport routing for PublishScheduled. The command below dispatches one message twice through the real bus and checks for one local intent; it does not start a worker.
src/Command/SchedulePublicationDemoCommand.php:
<?php
declare(strict_types=1);
namespace App\Command;
use App\Schedule\PublishScheduled;
use PDO;
use Psr\Clock\ClockInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Messenger\Stamp\HandledStamp;
#[AsCommand(name: 'app:schedule-publication-demo', description: 'Dispatch one local publication twice.')]
final class SchedulePublicationDemoCommand extends Command
{
public function __construct(
private readonly PDO $pdo,
private readonly ClockInterface $clock,
private readonly MessageBusInterface $bus,
) {
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$due = $this->clock->now()->getTimestamp();
$seed = $this->pdo->prepare(<<<'SQL'
INSERT INTO article_head (article_key, schedule_version, state, publish_at_epoch)
VALUES ('demo-publication', 1, 'scheduled', :due)
SQL);
$seed->execute(['due' => $due]);
$message = new PublishScheduled('demo-publication', 1);
$first = $this->bus->dispatch($message)->last(HandledStamp::class)?->getResult();
$publishedAt = $this->pdo->query('SELECT published_at_epoch FROM article_head')->fetchColumn();
$second = $this->bus->dispatch($message)->last(HandledStamp::class)?->getResult();
$after = $this->pdo->query('SELECT published_at_epoch FROM article_head')->fetchColumn();
$intents = (int) $this->pdo->query('SELECT COUNT(*) FROM publication_intent')->fetchColumn();
$ok = $first === true && $second === false && $publishedAt === $after && $intents === 1;
$output->writeln(json_encode([
'first_changed' => $first,
'second_changed' => $second,
'local_intents' => $intents,
'published_at_unchanged' => $publishedAt === $after,
'expected_state' => $ok,
], JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT));
return $ok ? Command::SUCCESS : Command::FAILURE;
}
}
bash fixtures/mysql_labs/run.sh php bin/console app:schedule-publication-demo
The Clock component makes the time source replaceable. Tests use MockClock, so there is no need to wait for a real minute. A publication deadline needs a calendar instant; a monotonic stopwatch is useful for measuring execution duration instead. These are different questions to ask a clock.
Boundaries to verify
The tests/Schedule/PublishWhenDueTest.php file checks time zones, a repeated and a missing hour, the instant before the deadline, exact equality, repeated dispatch, an obsolete decision, cancellation, late arrival, failure to record an intent, and transaction ownership. A separate case checks that a 64-character article key combined with version PHP_INT_MAX produces an event key without truncation, while a longer article key is rejected. Each test obtains its own MySQL schema through LabDatabase::createFixture() and closes the fixture afterward; schema setup and assertions use separate native migrator and runtime connections to that schema.
<?php
declare(strict_types=1);
namespace App\Tests\Schedule;
use App\Infrastructure\MysqlLab;
use App\Schedule\LabDatabase;
use App\Schedule\PublicationTime;
use App\Schedule\PublishScheduled;
use App\Schedule\PublishWhenDue;
use DateTimeImmutable;
use InvalidArgumentException;
use LogicException;
use PDO;
use PDOException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Clock\MockClock;
use Symfony\Component\Messenger\Handler\HandlersLocator;
use Symfony\Component\Messenger\MessageBus;
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;
final class PublishWhenDueTest extends TestCase
{
private MysqlLab $fixture;
private PDO $pdo;
private MockClock $clock;
private PublishWhenDue $handler;
private int $due;
protected function setUp(): void
{
$this->fixture = LabDatabase::createFixture();
$this->pdo = $this->fixture->runtime();
$this->clock = new MockClock('2024-01-15T08:00:00+00:00');
$this->due = (new DateTimeImmutable('2024-01-15T08:00:00+00:00'))->getTimestamp();
$insert = $this->pdo->prepare(<<<'SQL'
INSERT INTO article_head (article_key, schedule_version, state, publish_at_epoch)
VALUES ('field-notes', 1, 'scheduled', :due)
SQL);
$insert->execute(['due' => $this->due]);
$this->handler = new PublishWhenDue($this->pdo, $this->clock);
}
protected function tearDown(): void
{
$this->fixture->close();
}
public function testTwoZonesResolveTheSameInstant(): void
{
$kyiv = PublicationTime::resolve('2024-01-15T10:00:00', '+02:00', 'Europe/Kyiv');
$warsaw = PublicationTime::resolve('2024-01-15T09:00:00', '+01:00', 'Europe/Warsaw');
self::assertSame($this->due, $kyiv->getTimestamp());
self::assertSame($kyiv->getTimestamp(), $warsaw->getTimestamp());
}
public function testAutumnOverlapHasTwoExplicitInstants(): void
{
$first = PublicationTime::resolve('2024-10-27T03:30:00', '+03:00', 'Europe/Kyiv');
$second = PublicationTime::resolve('2024-10-27T03:30:00', '+02:00', 'Europe/Kyiv');
self::assertSame('2024-10-27T00:30:00+00:00', $first->format('c'));
self::assertSame('2024-10-27T01:30:00+00:00', $second->format('c'));
self::assertSame(3600, $second->getTimestamp() - $first->getTimestamp());
}
public static function invalidLocalTimes(): iterable
{
yield 'spring gap with old offset' => ['2024-03-31T03:30:00', '+02:00', 'Europe/Kyiv'];
yield 'spring gap with new offset' => ['2024-03-31T03:30:00', '+03:00', 'Europe/Kyiv'];
yield 'invalid day' => ['2024-02-30T10:00:00', '+02:00', 'Europe/Kyiv'];
yield 'wrong winter offset' => ['2024-01-15T10:00:00', '+03:00', 'Europe/Kyiv'];
yield 'offset is not a zone' => ['2024-01-15T10:00:00', '+02:00', '+02:00'];
yield 'trailing space' => ['2024-01-15T10:00:00 ', '+02:00', 'Europe/Kyiv'];
}
#[DataProvider('invalidLocalTimes')]
public function testInvalidLocalTimeIsRejected(string $local, string $offset, string $zone): void
{
$this->expectException(InvalidArgumentException::class);
PublicationTime::resolve($local, $offset, $zone);
}
public function testOneSecondBeforeDueDoesNotPublish(): void
{
$this->clock->modify('-1 second');
self::assertFalse(($this->handler)(new PublishScheduled('field-notes', 1)));
self::assertSame('scheduled', $this->state());
self::assertSame(0, $this->intentCount());
self::assertNull($this->pdo->query('SELECT published_at_epoch FROM article_head')->fetchColumn());
}
public function testExactBoundaryPublishesOnceAcrossRepeatedBusDispatch(): void
{
$bus = new MessageBus([
new HandleMessageMiddleware(new HandlersLocator([
PublishScheduled::class => [$this->handler],
])),
]);
$bus->dispatch(new PublishScheduled('field-notes', 1));
$this->clock->modify('+1 minute');
$bus->dispatch(new PublishScheduled('field-notes', 1));
self::assertSame('published', $this->state());
self::assertSame(1, $this->intentCount());
self::assertSame($this->due, (int) $this->pdo->query('SELECT published_at_epoch FROM article_head')->fetchColumn());
self::assertSame('publish:field-notes:1', $this->pdo->query('SELECT event_key FROM publication_intent')->fetchColumn());
}
public function testObsoleteScheduleIsIgnored(): void
{
$this->pdo->exec('UPDATE article_head SET schedule_version = 2');
self::assertFalse(($this->handler)(new PublishScheduled('field-notes', 1)));
self::assertSame('scheduled', $this->state());
self::assertSame(0, $this->intentCount());
self::assertTrue(($this->handler)(new PublishScheduled('field-notes', 2)));
self::assertSame(1, $this->intentCount());
}
public function testCancelledScheduleIsIgnored(): void
{
$this->pdo->exec("UPDATE article_head SET state = 'cancelled'");
self::assertFalse(($this->handler)(new PublishScheduled('field-notes', 1)));
self::assertSame('cancelled', $this->state());
self::assertSame(0, $this->intentCount());
}
public function testLateDeliveryStoresObservedTime(): void
{
$this->clock->modify('+5 minutes');
self::assertTrue(($this->handler)(new PublishScheduled('field-notes', 1)));
self::assertSame($this->due, (int) $this->pdo->query('SELECT publish_at_epoch FROM article_head')->fetchColumn());
self::assertSame($this->due + 300, (int) $this->pdo->query('SELECT published_at_epoch FROM article_head')->fetchColumn());
self::assertSame($this->due + 300, (int) $this->pdo->query('SELECT occurred_at_epoch FROM publication_intent')->fetchColumn());
}
public function testIntentFailureRollsBackPublication(): void
{
$this->fixture->migrator()->exec(<<<'SQL'
CREATE TRIGGER reject_intent BEFORE INSERT ON publication_intent FOR EACH ROW
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'injected intent failure'
SQL);
try {
($this->handler)(new PublishScheduled('field-notes', 1));
self::fail('The injected failure must escape.');
} catch (PDOException $error) {
self::assertStringContainsString('injected intent failure', $error->getMessage());
self::assertFalse($this->pdo->inTransaction());
self::assertSame('scheduled', $this->state());
self::assertNull($this->pdo->query('SELECT published_at_epoch FROM article_head')->fetchColumn());
self::assertSame(0, $this->intentCount());
}
$this->fixture->migrator()->exec('DROP TRIGGER reject_intent');
self::assertTrue(($this->handler)(new PublishScheduled('field-notes', 1)));
self::assertSame(1, $this->intentCount());
}
public function testExistingTransactionIsRejected(): void
{
$this->pdo->beginTransaction();
try {
($this->handler)(new PublishScheduled('field-notes', 1));
self::fail('An existing transaction must be rejected.');
} catch (LogicException) {
self::assertTrue($this->pdo->inTransaction());
self::assertSame('scheduled', $this->state());
} finally {
$this->pdo->rollBack();
}
}
public function testMaximumMessageIdentityFitsIntentWithoutTruncation(): void
{
$key = 'a'.str_repeat('b', 63);
$version = PHP_INT_MAX;
$insert = $this->pdo->prepare('INSERT INTO article_head (article_key, schedule_version, state, publish_at_epoch) VALUES (?, ?, ?, ?)');
$insert->execute([$key, $version, 'scheduled', $this->due]);
self::assertTrue(($this->handler)(new PublishScheduled($key, $version)));
self::assertSame('publish:'.$key.':'.$version, $this->pdo->query('SELECT event_key FROM publication_intent')->fetchColumn());
try {
new PublishScheduled($key.'c', 1);
self::fail('Oversized article key must be rejected.');
} catch (InvalidArgumentException) {
self::assertSame(1, $this->intentCount());
}
}
private function state(): string
{
return (string) $this->pdo->query('SELECT state FROM article_head')->fetchColumn();
}
private function intentCount(): int
{
return (int) $this->pdo->query('SELECT COUNT(*) FROM publication_intent')->fetchColumn();
}
}
The double dispatch goes through a real synchronous Messenger bus. It does not simulate restarting a broker or running two workers in parallel. A separate migrator connection installs a test MySQL trigger that rejects the insert with SIGNAL SQLSTATE '45000'. The runtime connection performs only DML and assertions: the error escapes the handler, the transaction ends, the article remains scheduled, its publication time stays null, and no event intent is saved. After the migrator removes the trigger, another attempt publishes the article. Binary logging is disabled in the guarded disposable fixture for test-trigger creation; this is not a recommendation for a production database.
php -v
php -r 'echo timezone_version_get(), PHP_EOL;'
composer check-platform-reqs
find src tests -name '*.php' -print0 | xargs -0 -n1 php -l
php bin/console lint:yaml config
bash fixtures/mysql_labs/run.sh php bin/console lint:container
APP_ENV=test bash fixtures/mysql_labs/run.sh php bin/console lint:container
bash fixtures/mysql_labs/run.sh php bin/console debug:messenger
bash fixtures/mysql_labs/run.sh php vendor/bin/phpunit tests/Schedule/PublishWhenDueTest.php --testdox
bash fixtures/mysql_labs/run.sh php vendor/bin/phpunit tests/Schedule/PublishWhenDueTest.php
After execution, check the strength of the tests separately: changing the comparison to a strict one should break the exact boundary, while removing the version condition should break the obsolete-schedule case. After each such change, restore the original code and run the entire suite again.
What a real schedule still needs
An early delivery in this example finishes without changing state. It does not reserve an automatic retry. The triggering mechanism must therefore select current scheduled articles whose deadlines have arrived again, or explicitly schedule another message. A single early message without such a mechanism leaves the article unpublished.
The polling interval describes the ordinary extra delay only while the system is working and there is no backlog. A stopped worker, a database lock or a retry after failure can increase it. That is a reason to show the author the planned time and actual state separately, rather than promise second-level precision through a date field alone.
A working deployment needs a durable database, access control, a rescheduling path that increments the version, a retry policy for transient failures and delivery of event intents. The teaching example keeps these boundaries explicit. Its useful result is a precise rule under which one current schedule can change state, while a repeated or obsolete message creates no new editorial decision.
The shared MySQL fixture and its files are introduced in the transaction chapter. Run commands from the single article_demo root; do not create a separate Symfony application for each article.
Check the current example against an owned disposable MySQL schema: