Skip to content
Back to skills

Symfony Messenger Async

ASecurity

Symfony Messenger async processing — message queues, retry strategies, failure transport, Symfony Scheduler, idempotency patterns, background jobs. Triggers on: messenger, async, queue, retry, scheduler, background job, worker, transport, message queue, cron, scheduled task

  • 34 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 26, 2026
developmentgophp

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned May 27, 2026

npx -y skills add aligundogdu/symfony-hexagonal-skill --skill symfony-messenger-async --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Symfony Messenger Async?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Symfony Messenger Async
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aligundogdu-symfony-messenger-async/badge)](https://www.skillsdirectory.com/skills/aligundogdu-symfony-messenger-async)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: "Symfony Messenger async processing — message queues, retry strategies, failure transport, Symfony Scheduler, idempotency patterns, background jobs. Triggers on: messenger, async, queue, retry, scheduler, background job, worker, transport, message queue, cron, scheduled task"
---

# Symfony Messenger & Async Processing

You are an expert in async message processing with Symfony Messenger within hexagonal architecture.

## When to Activate

- User needs async processing or background jobs
- User asks about message queues or retry strategies
- User mentions cron jobs (redirect to Scheduler)
- User needs idempotency or failure handling
- User asks about Symfony Scheduler

## Core Principle: No Cron Jobs

**Never use raw cron.** Always use:
- **Symfony Messenger** for async message processing
- **Symfony Scheduler** for recurring tasks

## Async Command Pattern

```php
// 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
    }
}
```

```yaml
# Route to async transport
framework:
    messenger:
        routing:
            'App\Application\Report\Command\GenerateReport': async
```

## Idempotency

Every async handler MUST be idempotent — safe to retry:

```php
#[AsMessageHandler(bus: 'command.bus')]
final readonly class ProcessPaymentHandler
{
    public function __construct(
        private PaymentRepositoryInterface $paymentRepository,
        private PaymentGatewayInterface $paymentGateway,
    ) {
    }

    public function __invoke(ProcessPayment $command): void
    {
        // Check if already processed (idempotency)
        $existing = $this->paymentRepository->findByIdempotencyKey($command->idempotencyKey);
        if ($existing !== null) {
            return; // Already processed, skip
        }

        // Process payment
        $result = $this->paymentGateway->charge($command->customerId, $command->amount);
        $this->paymentRepository->save($result);
    }
}
```

## References

See `references/` for detailed guides:
- `messenger-config.md` — Full Messenger YAML configuration
- `idempotency-patterns.md` — Idempotency key strategies
- `scheduler-patterns.md` — Symfony Scheduler setup and patterns

Files in this skill

  • SKILL.md2.6 KB
  • references/idempotency-patterns.md3.7 KB
  • references/messenger-config.md4.6 KB
  • references/scheduler-patterns.md4.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.