Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] RejectRedeliveredMessageMiddleware Causes Class Not Found Errors on the Full Stack Framework #45003

Closed
@chrisguitarguy

Description

@chrisguitarguy

Symfony version(s) affected

>=5.1

Description

When one uses "symfony/symfony": "^5.4" in their composer.json to get the full stack framework, the RejectRedeliveredMessageMiddleware causes errors because it's tightly coupled to Amqp classes.

The autoloader expected class "Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceivedStamp" to be defined in file "{redacted}". The file was found but the class was not in it, the class name or namespace probably has a typo. (500 Internal Server Error)

When requiring the messenger component directly, the amqp bridge is available:

"symfony/amqp-messenger": "^5.1|^6.0",

but that requirement is not explicit in the root composer.json:

symfony/composer.json

Lines 34 to 57 in bbe4105

"require": {
"php": ">=7.2.5",
"ext-xml": "*",
"friendsofphp/proxy-manager-lts": "^1.0.2",
"doctrine/event-manager": "~1.0",
"doctrine/persistence": "^2",
"twig/twig": "^2.13|^3.0.4",
"psr/cache": "^1.0|^2.0",
"psr/container": "^1.1.1",
"psr/event-dispatcher": "^1.0",
"psr/link": "^1.0",
"psr/log": "^1|^2",
"symfony/contracts": "^2.1",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-intl-grapheme": "~1.0",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/polyfill-intl-idn": "^1.10",
"symfony/polyfill-intl-normalizer": "~1.0",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php73": "^1.11",
"symfony/polyfill-php80": "^1.16",
"symfony/polyfill-php81": "^1.23",
"symfony/polyfill-uuid": "^1.15"
},

Feels like it should probably be there in the 5.4 release?

There is an open PR addressing the coupling issue targeting 6.1: #41749 but might be worth solving in 5.4 by making that depenency explicit for user of the full stack framework. I know that's frowned uppon now, but I suspect there's a lot of legacy apps out there with just symfony/symfony in their composer.json files.

How to reproduce

Try to use messenger with symfony full stack >= 5.1 with messenger and without having symfony/amqp-messenger installed

Possible Solution

Add symfony/amqp-messenger to the symfony/symfony composer.json.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions