Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

POC Symfony 6.4 with Messenger component + Docker (LAMP with Supervisor, MailDev, RabbitMQ)

Notifications You must be signed in to change notification settings

jgauthi/poc_symfony6_messenger

Repository files navigation

POC Symfony 6.4 with Messenger component + Docker (LAMP with Supervisor, MailDev, RabbitMQ)

Messenger provides a message bus with the ability to send messages and then handle them immediately in your application or send them through transports (e.g. queues) to be handled later. To learn more deeply about it, read the Messenger component docs.

The messages are automatically consumed (send) by a worker from supervisor. Without it, you need to launch manually the command make messenger (or php bin/console messenger:consume async in local symfony server).

Prerequisites

  • Docker v24+ & Docker compose v2
  • Make command. On linux, install with sudo apt install build-essential. On Windows, see here.
  • These ports must be available for docker: 8000, 8080, 1025, 1080, 15672 (you can change it on docker-compose.override.yml file after install).

More information on symfony website.

Installation

Command lines:

make install db-install

# (optional) Copy and edit configuration values ".env.local"

Usage

Use docker for execute the built-in web server and access the application in your browser at http://localhost:8000:

make up

# Launch Messages service (optional: only needed if supervisor is not launch)
# make messenger

# For stop services
make stop
  • For look at emails send by the smtp service, look at this url http://localhost:1080 (maildev).
  • For database management, you can look at phpmyadmin: http://localhost:8080.
  • You can edit the var COMPOSE_FILE in .env for add / remove containers from .docker/compose folder.

Debug commands:

make messenger CMD="-vv"

# Retry failed messages several times (3 attempts)
make sf-cmd CMD="messenger:failed:show"
make sf-cmd CMD="messenger:failed:retry"

Enjoy!