Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Failed Message #3

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3a193d0
Reuse some GitHub CI config files from centralized spot
bocharsky-bw Mar 22, 2023
fe957b5
minor #48 Reuse some GitHub CI config files from centralized spot (bo…
weaverryan Mar 27, 2023
56a7880
Fix CI, test on php 8.2
bendavies May 25, 2023
020ae18
minor #51 Fix CI, test on php 8.2 (bendavies)
weaverryan Jun 13, 2023
ab8ad64
Adding note that this bundle is unstable & experimental
weaverryan Jun 22, 2023
1e60158
Merge pull request #52 from SymfonyCasts/weaverryan-patch-1
weaverryan Jun 22, 2023
39b4ed4
Convert note into GitHub note and minor formatting tweaks in README
bocharsky-bw Jun 23, 2023
e609929
Merge pull request #53 from SymfonyCasts/bocharsky-bw-patch-1
weaverryan Jun 23, 2023
8019794
Add PHP 8.3 support
bocharsky-bw Nov 28, 2023
a2656b6
minor #58 [ci] php-cs-fixer it up
jrushlow Apr 9, 2024
ffaf523
minor #57 [ci] use phpstan instead of psalm
jrushlow Apr 9, 2024
8ab1d7e
minor #59 [dx] keep tooling in one place
jrushlow Jun 12, 2024
3d35da3
fix: switch from Doctrine event subscriber to listener
kbond Jul 10, 2024
b7306a6
bug #61 fix: switch from Doctrine event subscriber to listener (kbond)
kbond Jul 10, 2024
a976318
Allow Symfony 7
bocharsky-bw Nov 22, 2023
2f224b7
[ci] php-cs-fixer it up
jrushlow Jul 30, 2024
a07e411
Fix CS
bocharsky-bw Jul 30, 2024
63d220d
Drop enable_authenticator_manager=true that by default since 5.4
bocharsky-bw Jul 30, 2024
29ede80
Return back enable_authenticator_manager for Sf < 6.0
bocharsky-bw Jul 30, 2024
4ad2d73
Merge pull request #55 from SymfonyCasts/sf7
bocharsky-bw Jul 30, 2024
9e013ca
Merge pull request #62 from jrushlow/ci/php-cs-fixer
bocharsky-bw Jul 30, 2024
59517d7
Merge branch 'main' of github.com:SymfonyCasts/messenger-monitor-bund…
bocharsky-bw Jul 30, 2024
4ea3db9
Merge pull request #56 from SymfonyCasts/php83
bocharsky-bw Jul 30, 2024
c410231
minor #63 [ci] php-cs-fixer it up
jrushlow Aug 31, 2024
abf875f
Add CI status badge
bocharsky-bw Oct 7, 2024
574d63a
Merge pull request #64 from SymfonyCasts/bocharsky-bw-patch-1
bocharsky-bw Oct 8, 2024
2be0ec4
use dashboard route so link is correct when template is used in sub-f…
rodnaph Jan 11, 2023
686caa9
allow customizing page header suffix
rodnaph Jan 11, 2023
85f2dec
allow customizing class of card
rodnaph Jan 12, 2023
d8489d3
add route for displaying information about failed message
rodnaph Jan 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 22 additions & 60 deletions .github/workflows/ci.yml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,64 +1,13 @@
name: MessengerMonitorBundle CI
name: CI

on:
pull_request: ~
push:
branches:
- "master"
branches: ['master']
schedule:
- cron: '0 */12 * * *'

jobs:
coding-standards:
name: "Coding Standards"

runs-on: "ubuntu-latest"

strategy:
matrix:
php:
- "8.0"

steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Set up PHP"
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.php }}

- name: "Install dependencies with composer"
uses: ramsey/composer-install@v2

- name: "Run friendsofphp/php-cs-fixer"
run: vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.dist.php --diff --dry-run --verbose

static-code-analysis:
name: "Static Code Analysis"

runs-on: "ubuntu-latest"

strategy:
matrix:
php:
- "8.0"

steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Set up PHP"
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: ${{ matrix.php }}

- name: "Install dependencies with composer"
uses: ramsey/composer-install@v2

- name: "Run vimeo/psalm"
run: vendor/bin/psalm --diff --show-info=false --stats --threads=4

tests-mariadb:
name: "Tests with MariaDB"

Expand All @@ -68,24 +17,24 @@ jobs:
fail-fast: false
matrix:
php:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
dependencies:
- "lowest"
- "highest"

services:
mariadb:
image: mariadb:latest
image: mariadb:10.11
ports:
- 3306
env:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: messenger_monitor_bundle_test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3

options: --health-cmd "mysqladmin ping --silent"
steps:
- name: "Checkout"
uses: actions/checkout@v3
Expand Down Expand Up @@ -115,8 +64,9 @@ jobs:
fail-fast: false
matrix:
php:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
postgres-version:
- "14"

Expand Down Expand Up @@ -148,3 +98,15 @@ jobs:
run: vendor/bin/simple-phpunit
env:
TEST_DATABASE_DSN: postgres://user:[email protected]:${{ job.services.postgres.ports[5432] }}/messenger_monitor_bundle_test

composer-validate:
uses: SymfonyCasts/.github/.github/workflows/composer-validate.yaml@main

cs:
uses: SymfonyCasts/.github/.github/workflows/php-cs-fixer.yaml@main

sca:
uses: SymfonyCasts/.github/.github/workflows/phpstan.yaml@main
with:
php: 8.1
install-phpunit-bridge: true
47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
Messenger Monitor
---
=================

[![CI](https://github.com/SymfonyCasts/messenger-monitor-bundle/actions/workflows/ci.yaml/badge.svg)](https://github.com/SymfonyCasts/messenger-monitor-bundle/actions/workflows/ci.yaml)

A Symfony Bundle to show you information about your Messenger queues/transports
> **Note**
> **THIS BUNDLE IS EXPERIMENTAL & UNSTABLE** and may not work and probably isn't ready for production.
> It's also super rough and currently is in a development phase.

This is in a development phase
A Symfony Bundle to show you information about your Messenger queues/transports.

### Implemented Features

Implemented Features
* Show queue length in console (configure interval)

Planned Features
### Planned Features

* Add admin route to see the queues in the browser
* Auto Refresh
* Refactor queue information to allow additional data
* Collect data (how? TBD)
* Show more queue information (avg time, ago, ...)

Phase 2
* Realtime updates in browser (use TURTED_reactphp)
### Phase 2

* Realtime updates in the browser (use TURTED_reactphp)

Installation
============
------------

Make sure Composer is installed globally, as explained in the
[installation chapter](https://getcomposer.org/doc/00-intro.md)
of the Composer documentation.

Applications that use Symfony Flex
----------------------------------
### Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

```console
$ composer require symfonycasts/messenger-monitor-bundle
```

Applications that don't use Symfony Flex
----------------------------------------
### Applications that don't use Symfony Flex

### Step 1: Download the Bundle
#### Step 1: Download the Bundle

Open a command console, enter your project directory and execute the
following command to download the latest stable version of this bundle:
Expand All @@ -47,7 +51,7 @@ following command to download the latest stable version of this bundle:
$ composer require symfonycasts/messenger-monitor-bundle
```

### Step 2: Enable the Bundle
#### Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles
in the `config/bundles.php` file of your project:
Expand All @@ -62,15 +66,10 @@ return [
```

Usage
=====

```bin/console messenger:monitor``` to refresh every 3 seconds (default)

```bin/console messenger:monitor -i 0``` to get the information only once
```bin/console messenger:monitor -i 1``` to refresh every second

Check ```bin/console help messenger:monitor``` for more information


-----

- `bin/console messenger:monitor` to refresh every 3 seconds (default)
- `bin/console messenger:monitor -i 0` to get the information only once
- `bin/console messenger:monitor -i 1` to refresh every second

Check `bin/console help messenger:monitor` for more information.
49 changes: 31 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,30 @@
"description": "Symfony bundle for information about your Messenger queues and transports",
"type": "symfony-bundle",
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-json": "*",
"symfony/config": "^5.4|^6.0",
"symfony/dependency-injection": "^5.4|^6.0",
"symfony/event-dispatcher": "^5.4|^6.0",
"symfony/framework-bundle": "^5.4|^6.0",
"symfony/http-foundation": "^5.4|^6.0",
"symfony/http-kernel": "^5.4|^6.0",
"symfony/messenger": "^5.4|^6.0",
"symfony/config": "^5.4|^6.0|^7.0",
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
"symfony/event-dispatcher": "^5.4|^6.0|^7.0",
"symfony/framework-bundle": "^5.4|^6.0|^7.0",
"symfony/http-foundation": "^5.4|^6.0|^7.0",
"symfony/http-kernel": "^5.4|^6.0|^7.0",
"symfony/messenger": "^5.4|^6.0|^7.0",
"symfony/polyfill-uuid": "^1.23",
"symfony/routing": "^5.4|^6.0",
"symfony/twig-bundle": "^5.4|^6.0",
"symfony/routing": "^5.4|^6.0|^7.0",
"symfony/twig-bundle": "^5.4|^6.0|^7.0",
"twig/twig": "^2.14.7|^3.0"
},
"require-dev": {
"doctrine/dbal": "^2.13.3",
"doctrine/doctrine-bundle": "^2.0",
"doctrine/orm": "^2.10",
"friendsofphp/php-cs-fixer": "^3.11",
"symfony/browser-kit": "^5.4|^6.0",
"symfony/css-selector": "^5.4|^6.0",
"symfony/doctrine-messenger": "^6.0",
"symfony/phpunit-bridge": "^5.4|^6.0",
"symfony/security-bundle": "^5.4|^6.0",
"vimeo/psalm": "^4.0"
"php-cs-fixer/shim": "^3.17",
"symfony/browser-kit": "^5.4|^6.0|^7.0",
"symfony/css-selector": "^5.4|^6.0|^7.0",
"symfony/doctrine-messenger": "^6.0|^7.0",
"symfony/phpunit-bridge": "^5.4|^6.0|^7.0",
"symfony/security-bundle": "^5.4|^6.0|^7.0"
},
"conflict": {
"symfony/doctrine-bridge": "<5.4"
Expand Down Expand Up @@ -56,5 +55,19 @@
"name": "Nicolas PHILIPPE",
"email": "[email protected]"
}
]
],
"scripts": {
"tools:upgrade": [
"@tools:upgrade:php-cs-fixer",
"@tools:upgrade:phpstan"
],
"tools:upgrade:php-cs-fixer": "composer upgrade -W -d tools/php-cs-fixer",
"tools:upgrade:phpstan": "composer upgrade -W -d tools/phpstan",
"tools:run": [
"@tools:run:php-cs-fixer",
"@tools:run:phpstan"
],
"tools:run:php-cs-fixer": "tools/php-cs-fixer/vendor/bin/php-cs-fixer fix",
"tools:run:phpstan": "tools/phpstan/vendor/bin/phpstan --memory-limit=1G"
}
}
26 changes: 26 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parameters:
ignoreErrors:
-
message: "#^Method SymfonyCasts\\\\MessengerMonitorBundle\\\\Exception\\\\ReceiverDoesNotExistException\\:\\:__construct\\(\\) has parameter \\$availableReceivers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Exception/ReceiverDoesNotExistException.php

-
message: "#^Method SymfonyCasts\\\\MessengerMonitorBundle\\\\Locator\\\\ReceiverLocator\\:\\:__construct\\(\\) has parameter \\$receiverLocator with generic interface Symfony\\\\Contracts\\\\Service\\\\ServiceProviderInterface but does not specify its types\\: T$#"
count: 1
path: src/Locator/ReceiverLocator.php

-
message: "#^Method SymfonyCasts\\\\MessengerMonitorBundle\\\\Locator\\\\ReceiverLocator\\:\\:__construct\\(\\) has parameter \\$receiverNames with no value type specified in iterable type array\\.$#"
count: 1
path: src/Locator/ReceiverLocator.php

-
message: "#^Method SymfonyCasts\\\\MessengerMonitorBundle\\\\Storage\\\\Doctrine\\\\Connection\\:\\:executeQuery\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#"
count: 1
path: src/Storage/Doctrine/Connection.php

-
message: "#^Method SymfonyCasts\\\\MessengerMonitorBundle\\\\Storage\\\\Doctrine\\\\Connection\\:\\:executeQuery\\(\\) has parameter \\$types with no value type specified in iterable type array\\.$#"
count: 1
path: src/Storage/Doctrine/Connection.php
12 changes: 12 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
includes:
- phpstan-baseline.neon

parameters:
level: 6
bootstrapFiles:
- vendor/autoload.php
paths:
- src
# - tests
excludePaths:
- tests/tmp/*
29 changes: 0 additions & 29 deletions psalm.xml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(
private Environment $twig,
private ReceiverLocator $receiverLocator,
private FailedMessageRepository $failedMessageRepository,
private StatisticsProcessorInterface $statisticsProcessor
private StatisticsProcessorInterface $statisticsProcessor,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Controller/RejectFailedMessageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class RejectFailedMessageController
public function __construct(
private FailedMessageRejecter $failedMessageRejecter,
private RequestStack $requestStack,
private UrlGeneratorInterface $urlGenerator
private UrlGeneratorInterface $urlGenerator,
) {
}

Expand All @@ -29,9 +29,9 @@ public function __invoke(int $id): RedirectResponse

try {
$this->failedMessageRejecter->rejectFailedMessage($id);
$sessionBag->add('messenger_monitor.success', sprintf('Message with id "%s" correctly rejected.', $id));
$sessionBag->add('messenger_monitor.success', \sprintf('Message with id "%s" correctly rejected.', $id));
} catch (\Exception $exception) {
$sessionBag->add('messenger_monitor.error', sprintf('Error while rejecting message with id "%s": %s', $id, $exception->getMessage()));
$sessionBag->add('messenger_monitor.error', \sprintf('Error while rejecting message with id "%s": %s', $id, $exception->getMessage()));
}

return new RedirectResponse($this->urlGenerator->generate('symfonycasts.messenger_monitor.dashboard'));
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/RetryFailedMessageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public function __invoke(int $id): RedirectResponse

try {
$this->failedMessageRetryer->retryFailedMessage($id);
$sessionBag->add('messenger_monitor.success', sprintf('Message with id "%s" correctly retried.', $id));
$sessionBag->add('messenger_monitor.success', \sprintf('Message with id "%s" correctly retried.', $id));
} catch (\Exception $exception) {
$sessionBag->add('messenger_monitor.error', sprintf('Error while retrying message with id "%s": %s', $id, $exception->getMessage()));
$sessionBag->add('messenger_monitor.error', \sprintf('Error while retrying message with id "%s": %s', $id, $exception->getMessage()));
}

return new RedirectResponse($this->urlGenerator->generate('symfonycasts.messenger_monitor.dashboard'));
Expand Down
Loading
Loading