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

Skip to content

[Messenger] BC break when merging headers for amqp messages #35439

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

Closed
mleczakm opened this issue Jan 22, 2020 · 3 comments Β· Fixed by symfony/symfony-docs#12989
Closed

[Messenger] BC break when merging headers for amqp messages #35439

mleczakm opened this issue Jan 22, 2020 · 3 comments Β· Fixed by symfony/symfony-docs#12989

Comments

@mleczakm
Copy link
Contributor

mleczakm commented Jan 22, 2020

Symfony version(s) affected: 4.3.7, 5.0.3

Description
Changing order of array_merge parameters made overriding type header in AMQP impossible and hardcoded it to FQCN of message, which is not nice for interoperability.

How to reproduce
Before this change, overriding header for envelope was simple like that:

/** @var Symfony\Component\Messenger\Envelope $envelope */
$envelope = $envelope->with(
                new AmqpStamp(
                    null, AMQP_NOPARAM, [
                        'headers' => [
                            'type' => 'CUSTOM_MESSAGE_TYPE',
                        ],
                    ]
                )
            );

Possible Solution
Parameters order should be reverted, as it is BC change, or HeaderStamp PR should be merged to reenable overriding headers - it is must-have for sharing messages between codebases.

@Nyholm
Copy link
Member

Nyholm commented Jan 26, 2020

You should select a different serializer. I created an implementation that may be overkill https://github.com/Happyr/message-serializer

I will send a PR to the docs to show this feature better.

@Tobion
Copy link
Contributor

Tobion commented Jan 26, 2020

The type header is a requirement by the serializer. If you don't want the type header, change the serializer and you can return any headers you want.

@Tobion Tobion closed this as completed Jan 26, 2020
@mleczakm
Copy link
Contributor Author

@Nyholm @Tobion are you aware that overriding type header works before update to 4.3.7 and is not possible anymore? It is BC break, it is bug, it can't be closed because it works for you...

javiereguiluz added a commit to symfony/symfony-docs that referenced this issue Feb 17, 2020
This PR was submitted for the master branch but it was merged into the 4.4 branch instead (closes #12989).

Discussion
----------

[Messenger] Note about serializer

The issue is that I've multiple times heard people saying:

> I like Messenger component, but it does not work if you send messages from one app to another.

First I wanted to solve this issue by adding a new page just saying "YES YOU CAN".

But for now, I settle with a small note and a link to Symfony Cast explaining this.

There is also a great over engineered package that I believe everybody should use... but I dont feel link symfony docs is a place to promote a package like this, or is it? https://github.com/Happyr/message-serializer

I think this will fix symfony/symfony#35439

Commits
-------

09d4c7a [Messenger] Note about serializer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants