dunglas / symfony-docker

A Docker-based installer and runtime for Symfony. Install: download and `docker compose up`.
https://dunglas.dev/2021/12/symfonys-new-native-docker-support-symfony-world/
2.59k stars 772 forks source link

messenger:consume #515

Closed treeindark closed 11 months ago

treeindark commented 11 months ago

Hello,

I see https://github.com/dunglas/symfony-docker/issues/205

But I can not consume message, /app is empty, can you provie a full description howto ?

Very Thank you !!!

maxhelias commented 11 months ago

Hello,

Messages can be consumed in many different ways. You'll find everything you need in the Symfony doc : https://symfony.com/doc/6.4/messenger.html#consuming-messages-running-the-worker

treeindark commented 11 months ago

it's ok with in compose.override with

messenger:
    build:
      context: .
      target: frankenphp_dev
    command: 'sh -c "php bin/console messenger:consume async -vvv"'
    environment:
      REDIS_URL: ${REDIS_URL:-redis}
      DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}  
    healthcheck:
      interval: 10s
      timeout: 3s
      retries: 3
      start_period: 30s
    restart: unless-stopped
    volumes:
      - ./:/app
      - ./frankenphp/Caddyfile:/etc/caddy/Caddyfile:ro
      - ./frankenphp/conf.d/app.dev.ini:/usr/local/etc/php/conf.d/app.dev.ini:ro

    depends_on:
      - php

with supervisor, messenger restart every Xseconds ( conf file) for limit memery consume, with docker we can not stop it, Did we use [Stateless Worker](https://symfony.com/doc/6.4/messenger.html#stateless-worker)

framework.messenger.reset_on_message: true

treeindark commented 11 months ago

No need to restart ?