/symfony-hexagonal:symfony-messenger-asyncfrom symfony-hexagonal
Configures Symfony Messenger for async processing and Symfony Scheduler as a cron replacement: transports, routing, retry with backoff/jitter, failure handling, idempotency keys, and workers.
Ships in symfony-hexagonal. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in async message processing with Symfony Messenger within hexagonal architecture.
Never use raw cron. Always use:
| Feature | Requires | Fallback |
|---|---|---|
Scheduler component, RecurringMessage | Symfony 6.3 | - (no cron) |
#[AsCronTask], #[AsPeriodicTask] | Symfony 6.4 | ScheduleProviderInterface |
retry_strategy.jitter | Symfony 7.1 | omit |
#[AsMessage('async')] routing attribute | Symfony 7.2 | YAML routing: |
DeduplicateStamp (+ symfony/lock) | Symfony 7.3 | idempotency key + unique constraint |
messenger:consume --keepalive | Symfony 7.2/7.3 (transport dependent) | shorter --time-limit |
#[AsMessageHandler(sign: true)] message signing | Symfony 7.4 | trusted transport |
messenger:consume --all --exclude-receivers=failed | Symfony 7.4 | list receivers explicitly |
#[AsMessage(serializedTypeName: ...)], PriorityStamp, regex receiver names | Symfony 8.1 | FQCN type names, separate priority transports |
// The command is the same: async is a routing concern, not a code concern
namespace App\Application\Report\Command;
final readonly class GenerateReport
{
public function __construct(
public string $reportId,
public string $userId,
public string $type,
) {
}
}
// Handler is identical to sync: the bus handles async dispatch
#[AsMessageHandler(bus: 'command.bus')]
final readonly class GenerateReportHandler
{
public function __invoke(GenerateReport $command): void
{
// Long-running operation
}
}
# Route to async transport (all versions)
framework:
messenger:
routing:
'App\Application\Report\Command\GenerateReport': async
Symfony 7.2+: #[AsMessage('async')] on the command class works too. Never put it on domain events: Domain must stay free of Symfony attributes, so events are always routed in YAML.
Every async handler MUST be idempotent: messages can be delivered more than once (retries, worker crashes, redeliveries).
#[AsMessageHandler(bus: 'command.bus')]
final readonly class ProcessPaymentHandler
{
public function __construct(
private PaymentRepositoryInterface $payments,
private PaymentGatewayInterface $gateway,
) {
}
public function __invoke(ProcessPayment $command): void
{
if ($this->payments->existsByIdempotencyKey($command->idempotencyKey)) {
return; // Already processed, skip
}
$result = $this->gateway->charge(
$command->customerId,
new Money($command->amount, $command->currency),
sprintf('Order %s', $command->orderId),
$command->idempotencyKey, // the provider deduplicates too
);
$this->payments->record($command->orderId, $result, $command->idempotencyKey);
}
}
Symfony 7.3+ adds DeduplicateStamp, which prevents the same message from being queued twice while one is pending. It complements, but does not replace, handler idempotency (see references/idempotency-patterns.md).
See references/ for detailed guides:
messenger-config.md - Full Messenger YAML configuration, workers, failure transportidempotency-patterns.md - Idempotency key strategies, DeduplicateStampscheduler-patterns.md - Symfony Scheduler setup and patternsWhat SKILL.md sets; muted values are Claude Code's defaults
10 skills in this plugin
/symfony-api-responseSymfony REST API response standard {result, error, extra, status}: thin controllers, #[MapRequestPayload] / #[MapQueryString] request DTOs, ApiResponseTrait, exception subscriber that unwraps Messenger HandlerFailedException, validation error format, debug mode. Use when: API, endpoint, controller, response, error handling, JSON, REST, API response, exception subscriber, HTTP, request DTO/symfony-cqrs-handlersSymfony CQRS with Messenger: commands, queries, handlers, command.bus / query.bus / event.bus configuration, typed bus wrappers, HandlerFailedException unwrapping, read ports and pagination, use cases. Works on Symfony 6.4, 7.x, 8.x. Use when: command, query, handler, CQRS, bus, use case, command handler, query handler, message bus, HandleTrait, HandledStamp/symfony-doctrine-persistenceDoctrine persistence for Symfony hexagonal architecture (ORM 2.x/3.x, DBAL 3/4, DoctrineBundle 2/3): repository adapters, XML mapping in Infrastructure, embeddables, enums, custom DBAL types, native lazy objects, migrations, transactions, read models with DBAL QueryBuilder, strict no-native-SQL rule. Use when: doctrine, repository, persistence, database, mapping, migration, ORM, entity manager, DBAL, transaction, query builder, pagination/symfony-domain-modelingSymfony DDD domain modeling in pure PHP: entities, aggregates, value objects, domain events, domain exceptions, ID generation ports, PHP 8.2-8.5 modeling features (readonly, private(set), clone with). Use when: entity, value object, domain event, aggregate, domain exception, domain model, domain logic, business rule, invariant, enum status/symfony-hexagonal-architectureSymfony hexagonal architecture (ports & adapters) setup for Symfony 6.4 LTS, 7.4 LTS and 8.x: project structure, module scaffolding, layer responsibilities, dependency rules, version compatibility, progressive refactoring of legacy code. Use when: architecture, module, layer, hexagonal, scaffold, project structure, directory structure, new project, new module, bounded context, deptrac, Symfony version, upgrade/symfony-ports-adaptersSymfony ports and adapters: port interfaces in Domain, adapter implementations in Infrastructure, dependency injection, autowiring, services.yaml aliases, #[AsAlias], environment-specific and decorated adapters, in-memory test adapters. Use when: port, adapter, interface, repository interface, DI, autowiring, dependency injection, services.yaml, binding, decorator, AsAliasnpx claudepluginhub aligundogdu/symfony-hexagonal-skill --plugin symfony-hexagonalOther plugins' skills for the same job