diff --git a/.dev/rabbitmq.conf b/.dev/rabbitmq.conf new file mode 100644 index 0000000..5b2b7ea --- /dev/null +++ b/.dev/rabbitmq.conf @@ -0,0 +1,20 @@ +## Networking +listeners.tcp.default = 5672 +listeners.tcp.1 = 127.0.0.1:5672 + +## Management Plugin +management.tcp.port = 15672 +management.tcp.ip = 127.0.0.1 + +## Authentication and Authorization +auth_mechanisms.1 = PLAIN +auth_mechanisms.2 = AMQPLAIN +default_user = guest +default_pass = guest + +## Logging +log.console = true + +## Resource Limits +vm_memory_high_watermark.relative = 0.4 +disk_free_limit.relative = 1.0 diff --git a/.env b/.env index 56be89f..ff4afdc 100644 --- a/.env +++ b/.env @@ -2,12 +2,5 @@ APP_ENV=dev APP_SECRET= APP_DOCKER_TAG="symfony-skeleton" -###> doctrine/doctrine-bundle ### -# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml -# -# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data_%kernel.environment%.db" -# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4" -# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4" DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=16&charset=utf8" -###< doctrine/doctrine-bundle ### +MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages diff --git a/.idea/php.xml b/.idea/php.xml index 04a4d82..5a499ab 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -12,109 +12,114 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/symfony-skeleton.iml b/.idea/symfony-skeleton.iml index ce06798..1445054 100644 --- a/.idea/symfony-skeleton.iml +++ b/.idea/symfony-skeleton.iml @@ -5,110 +5,115 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.rr.dev.yaml b/.rr.dev.yaml index 0d6e6e9..d38357c 100644 --- a/.rr.dev.yaml +++ b/.rr.dev.yaml @@ -1,37 +1,55 @@ version: "3" server: - command: "php public/index.php" - env: - - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime + command: "php public/index.php" + env: + - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime http: - address: 0.0.0.0:8000 - middleware: [ "static", "gzip" ] - pool: - debug: true - uploads: - forbid: [ ".php", ".exe", ".bat" ] - static: - dir: "public" - forbid: [ ".php", ".htaccess" ] + address: 0.0.0.0:8000 + middleware: [ "static", "gzip" ] + pool: + debug: true + uploads: + forbid: [ ".php", ".exe", ".bat" ] + static: + dir: "public" + forbid: [ ".php", ".htaccess" ] + +rpc: + listen: tcp://127.0.0.1:6001 logs: - mode: development - channels: - http: - level: debug # Log all http requests, set to info to disable - server: - level: info # Everything written to worker stderr is logged - mode: raw - metrics: - level: debug + mode: development + channels: + http: + level: debug # Log all http requests, set to info to disable + server: + level: info # Everything written to worker stderr is logged + mode: raw + metrics: + level: debug service: postgres: command: "postgres -D .data/postgres" # The command to execute + service_name_in_log: true processNum: 1 # Number of processes to run execTimeout: 0 # Execution timeout (0 for no timeout) remainAfterExit: false # Whether to keep the service running after exit env: APP_ENV: "production" + rabbitmq: + command: "rabbitmq-server" # The command to execute + service_name_in_log: true + processNum: 1 # Number of processes to run + execTimeout: 0 # Execution timeout (0 for no timeout) + remainAfterExit: false # Whether to keep the service running after exit + env: + APP_ENV: "production" + messenger: + command: "./messenger.sh" + service_name_in_log: true + processNum: 1 + execTimeout: 0 # Execution timeout (0 for no timeout) + remainAfterExit: false # Whether to keep the service running after exit diff --git a/composer.json b/composer.json index ceacc41..a669a03 100644 --- a/composer.json +++ b/composer.json @@ -5,19 +5,32 @@ "prefer-stable": true, "require": { "php": ">=8.2", - "ext-ctype": "*", - "ext-iconv": "*", + "ext-amqp": ">=2.1", + "ext-ctype": ">=8.2", + "ext-dom": ">=20031129", + "ext-iconv": ">=8.2", + "ext-json": ">=8.2", + "ext-libxml": ">=8.2", + "ext-mbstring": "*", + "ext-phar": ">=8.2", + "ext-sockets": ">=8.2", + "ext-tokenizer": ">=8.2", + "ext-xml": ">=8.2", + "ext-xmlwriter": ">=8.2", "baldinof/roadrunner-bundle": "^3.2", "doctrine/dbal": "^3", "doctrine/doctrine-bundle": "^2.16", "doctrine/doctrine-migrations-bundle": "^3.4", "doctrine/orm": "^3.5", "spiral/roadrunner-cli": "^2.7", + "spiral/roadrunner-services": "^2.2", + "symfony/amqp-messenger": "7.3.*", "symfony/console": "7.3.*", "symfony/dotenv": "7.3.*", "symfony/filesystem": "7.3.*", "symfony/flex": "^2", "symfony/framework-bundle": "7.3.*", + "symfony/messenger": "7.3.*", "symfony/runtime": "7.3.*", "symfony/yaml": "7.3.*" }, diff --git a/composer.lock b/composer.lock index 447966c..9ab1c24 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f992818288ab4ae1df2320cfb4535432", + "content-hash": "bb0d5bf7c87274180bd50cc78054e5f0", "packages": [ { "name": "baldinof/roadrunner-bundle", @@ -1301,23 +1301,23 @@ }, { "name": "google/protobuf", - "version": "v4.32.1", + "version": "v3.25.8", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb" + "reference": "57d440fc54a00fda5b8781e8d9bf0140ea6d8e52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", - "reference": "c4ed1c1f9bbc1e91766e2cd6c0af749324fe87cb", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/57d440fc54a00fda5b8781e8d9bf0140ea6d8e52", + "reference": "57d440fc54a00fda5b8781e8d9bf0140ea6d8e52", "shasum": "" }, "require": { - "php": ">=8.1.0" + "php": ">=7.0.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0 <8.5.27" + "phpunit/phpunit": ">=5.0.0" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" @@ -1339,9 +1339,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.32.1" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v3.25.8" }, - "time": "2025-09-14T05:14:52+00:00" + "time": "2025-05-27T21:04:40+00:00" }, { "name": "psr/cache", @@ -1392,6 +1392,54 @@ }, "time": "2021-02-03T23:26:27+00:00" }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -1655,20 +1703,20 @@ }, { "name": "roadrunner-php/roadrunner-api-dto", - "version": "v1.13.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/roadrunner-php/roadrunner-api-dto.git", - "reference": "8a683f5057005bef742916847c0befbf9a00c543" + "reference": "45f5726c2a55e293c6604a233212b6394ef36e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/roadrunner-php/roadrunner-api-dto/zipball/8a683f5057005bef742916847c0befbf9a00c543", - "reference": "8a683f5057005bef742916847c0befbf9a00c543", + "url": "https://api.github.com/repos/roadrunner-php/roadrunner-api-dto/zipball/45f5726c2a55e293c6604a233212b6394ef36e2f", + "reference": "45f5726c2a55e293c6604a233212b6394ef36e2f", "shasum": "" }, "require": { - "google/protobuf": "^4.31.1", + "google/protobuf": "^3.22 || ^4.0", "php": "^8.1" }, "conflict": { @@ -1710,7 +1758,7 @@ "docs": "https://docs.roadrunner.dev", "forum": "https://forum.roadrunner.dev", "issues": "https://github.com/roadrunner-server/roadrunner/issues", - "source": "https://github.com/roadrunner-php/roadrunner-api-dto/tree/v1.13.0" + "source": "https://github.com/roadrunner-php/roadrunner-api-dto/tree/v1.12.0" }, "funding": [ { @@ -1718,7 +1766,7 @@ "type": "github" } ], - "time": "2025-08-12T14:04:38+00:00" + "time": "2025-05-05T14:38:45+00:00" }, { "name": "spiral/core", @@ -2313,6 +2361,77 @@ ], "time": "2025-08-31T12:42:23+00:00" }, + { + "name": "spiral/roadrunner-services", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/roadrunner-php/services.git", + "reference": "0a927163d9b7d6e665d442ffaeac7c276809f879" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/roadrunner-php/services/zipball/0a927163d9b7d6e665d442ffaeac7c276809f879", + "reference": "0a927163d9b7d6e665d442ffaeac7c276809f879", + "shasum": "" + }, + "require": { + "google/protobuf": "^3.7", + "php": ">=8.1", + "roadrunner-php/roadrunner-api-dto": "^1.4", + "spiral/goridge": "^4.0", + "spiral/roadrunner": "^2023.2 || ^2024.1 || ^2025.1" + }, + "require-dev": { + "mockery/mockery": "^1.5", + "phpunit/phpunit": "^10.0", + "vimeo/psalm": ">=5.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spiral\\RoadRunner\\Services\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Pavel Buchnev (butschster)", + "email": "pavel.buchnev@spiralscout.com" + }, + { + "name": "Aleksei Gagarin (roxblnfk)", + "email": "alexey.gagarin@spiralscout.com" + }, + { + "name": "Maksim Smakouz (msmakouz)", + "email": "maksim.smakouz@spiralscout.com" + }, + { + "name": "RoadRunner Community", + "homepage": "https://github.com/spiral/roadrunner/graphs/contributors" + } + ], + "description": "RoadRunner services manager", + "homepage": "https://roadrunner.dev/", + "support": { + "chat": "https://discord.gg/V6EK4he", + "docs": "https://docs.roadrunner.dev", + "forum": "https://forum.roadrunner.dev/", + "issues": "https://github.com/roadrunner-server/roadrunner/issues", + "source": "https://github.com/roadrunner-php/services/tree/2.2.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/roadrunner-server", + "type": "github" + } + ], + "time": "2025-06-23T08:23:32+00:00" + }, { "name": "spiral/roadrunner-worker", "version": "v3.6.2", @@ -2546,6 +2665,79 @@ ], "time": "2025-04-22T14:05:18+00:00" }, + { + "name": "symfony/amqp-messenger", + "version": "v7.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/amqp-messenger.git", + "reference": "0ed5f72c1d9bbfcfc751b3832939a00a3246fe98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/amqp-messenger/zipball/0ed5f72c1d9bbfcfc751b3832939a00a3246fe98", + "reference": "0ed5f72c1d9bbfcfc751b3832939a00a3246fe98", + "shasum": "" + }, + "require": { + "ext-amqp": "*", + "php": ">=8.2", + "symfony/messenger": "^7.3" + }, + "require-dev": { + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/property-access": "^6.4|^7.0", + "symfony/serializer": "^6.4|^7.0" + }, + "type": "symfony-messenger-bridge", + "autoload": { + "psr-4": { + "Symfony\\Component\\Messenger\\Bridge\\Amqp\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony AMQP extension Messenger Bridge", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/amqp-messenger/tree/v7.3.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-07-15T11:36:08+00:00" + }, { "name": "symfony/cache", "version": "v7.3.2", @@ -2724,6 +2916,80 @@ ], "time": "2025-03-13T15:25:07+00:00" }, + { + "name": "symfony/clock", + "version": "v7.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/clock.git", + "reference": "b81435fbd6648ea425d1ee96a2d8e68f4ceacd24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/clock/zipball/b81435fbd6648ea425d1ee96a2d8e68f4ceacd24", + "reference": "b81435fbd6648ea425d1ee96a2d8e68f4ceacd24", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/clock": "^1.0", + "symfony/polyfill-php83": "^1.28" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/now.php" + ], + "psr-4": { + "Symfony\\Component\\Clock\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Decouples applications from the system clock", + "homepage": "https://symfony.com", + "keywords": [ + "clock", + "psr20", + "time" + ], + "support": { + "source": "https://github.com/symfony/clock/tree/v7.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:21:43+00:00" + }, { "name": "symfony/config", "version": "v7.3.2", @@ -4231,6 +4497,99 @@ ], "time": "2025-08-29T08:23:45+00:00" }, + { + "name": "symfony/messenger", + "version": "v7.3.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/messenger.git", + "reference": "d9e04339404ba2dcd04c24172125516dc0e06c35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/messenger/zipball/d9e04339404ba2dcd04c24172125516dc0e06c35", + "reference": "d9e04339404ba2dcd04c24172125516dc0e06c35", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/log": "^1|^2|^3", + "symfony/clock": "^6.4|^7.0", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/console": "<7.2", + "symfony/event-dispatcher": "<6.4", + "symfony/event-dispatcher-contracts": "<2.5", + "symfony/framework-bundle": "<6.4", + "symfony/http-kernel": "<6.4", + "symfony/lock": "<6.4", + "symfony/serializer": "<6.4" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/console": "^7.2", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/property-access": "^6.4|^7.0", + "symfony/rate-limiter": "^6.4|^7.0", + "symfony/routing": "^6.4|^7.0", + "symfony/serializer": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/validator": "^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Messenger\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Samuel Roze", + "email": "samuel.roze@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Helps applications send and receive messages to/from other applications or via message queues", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/messenger/tree/v7.3.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-08-13T11:49:31+00:00" + }, { "name": "symfony/polyfill-intl-grapheme", "version": "v1.33.0", @@ -7935,8 +8294,18 @@ "prefer-lowest": false, "platform": { "php": ">=8.2", - "ext-ctype": "*", - "ext-iconv": "*" + "ext-amqp": ">=2.1", + "ext-ctype": ">=8.2", + "ext-dom": ">=20031129", + "ext-iconv": ">=8.2", + "ext-json": ">=8.2", + "ext-libxml": ">=8.2", + "ext-mbstring": "*", + "ext-phar": ">=8.2", + "ext-sockets": ">=8.2", + "ext-tokenizer": ">=8.2", + "ext-xml": ">=8.2", + "ext-xmlwriter": ">=8.2" }, "platform-dev": {}, "plugin-api-version": "2.6.0" diff --git a/config/packages/messenger.yaml b/config/packages/messenger.yaml new file mode 100644 index 0000000..8e70291 --- /dev/null +++ b/config/packages/messenger.yaml @@ -0,0 +1,22 @@ +framework: + messenger: + # Uncomment this (and the failed transport below) to send failed messages to this transport for later handling. + # failure_transport: failed + + transports: + # https://symfony.com/doc/current/messenger.html#transport-configuration + async: '%env(MESSENGER_TRANSPORT_DSN)%' + # failed: 'doctrine://default?queue_name=failed' + # sync: 'sync://' + + routing: + # Route your messages to the transports + # 'App\Message\YourMessage': async + +# when@test: +# framework: +# messenger: +# transports: +# # replace with your transport name here (e.g., my_transport: 'in-memory://') +# # For more Messenger testing tools, see https://github.com/zenstruck/messenger-test +# async: 'in-memory://' diff --git a/messenger.sh b/messenger.sh new file mode 100755 index 0000000..086d729 --- /dev/null +++ b/messenger.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sleep 5; php bin/console messenger:consume async diff --git a/shell.nix b/shell.nix index b8feed1..9cba915 100644 --- a/shell.nix +++ b/shell.nix @@ -16,6 +16,7 @@ let enabled ++ (with all; [ xdebug + amqp ]) ); } @@ -23,11 +24,13 @@ let in [ pkgs.postgresql_16 + pkgs.rabbitmq-server pkgs.nixfmt-rfc-style pkgs.gnumake phpForRuntimeWithXDebug pkgs.php82Extensions.curl - pkgs.php82Packages.composer + # composer check-platform-reqs + (pkgs.php82.withExtensions ({ enabled, all }: enabled ++ [ all.amqp ])).packages.composer ]; in pkgs.mkShell { @@ -35,6 +38,10 @@ pkgs.mkShell { shellHook = '' export COMPOSER_CACHE_DIR=$(pwd)/var/cache/composer + export RABBITMQ_CONFIG_FILE=$(pwd)/.dev/rabbitmq.conf + export RABBITMQ_MNESIA_BASE=$(pwd)/.data/rabbitmq + export RABBITMQ_LOGS=$(pwd)/var/log/rabbitmq.log + mkdir -p $(pwd)/var/cache/composer if [ ! -d $(pwd)/var/log ]; then diff --git a/src/Command/RrCommand.php b/src/Command/RrCommand.php new file mode 100644 index 0000000..26b5013 --- /dev/null +++ b/src/Command/RrCommand.php @@ -0,0 +1,54 @@ +manager = new Manager(RPC::create('tcp://127.0.0.1:6001')); + } + + public function __invoke(OutputInterface $output): int + { + $result = []; + $table = new Table($output); + + $table->setHeaders(['Command', 'Memory', 'Error']); + + foreach ($this->manager->list() as $serviceGroupName) { + foreach ($this->manager->statuses($serviceGroupName) as $serviceInstance) { + $result[] = [ + 'command' => $serviceGroupName, + 'memory' => $serviceInstance['memory_usage'], + + 'error' => $serviceInstance['error'] + ? $serviceInstance['error']['message'] + : null, + ]; + } + } + + $table->setRows($result); + $table->render(); + + return Command::SUCCESS; + } +} diff --git a/symfony.lock b/symfony.lock index b0c4d43..c442061 100644 --- a/symfony.lock +++ b/symfony.lock @@ -116,6 +116,18 @@ "ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f" } }, + "symfony/messenger": { + "version": "7.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.0", + "ref": "ba1ac4e919baba5644d31b57a3284d6ba12d52ee" + }, + "files": [ + "config/packages/messenger.yaml" + ] + }, "symfony/routing": { "version": "7.3", "recipe": {