Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Messenger] [AMQP] Support “content encoding” property#47545

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
glengemann wants to merge0 commits intosymfony:6.2fromglengemann:6.2

Conversation

glengemann
Copy link

@glengemannglengemann commentedSep 11, 2022
edited
Loading

QA
Branch?6.2
Bug fix?no
New feature?yes
Deprecations?no
Tickets
LicenseMIT
Doc PRTODO

When I send a message using the AMQP transport together with theAmqpStamp and thecontent-encoding property, the message is not compressed.

TheAMQP protocol, allow through thecontent-encoding property, to “indicate what additional content encodings have been applied to theapplication-data, and thus what decoding mechanisms need to be applied in order to obtain the media-type referenced by the content-type header field”.

The values admitted according to the protocol are:gzip, compress, deflate, identity, etc.

I expect that the body of the message will be compressed and decompressed respectively by the publisher
and the subscriber.

For example, we can send a messages:

$bus->dispatch(newDummyMessage('Foo bar'), [newAmqpStamp(attributes: ['content_encoding' =>'gzip'    ]),]);

and, With the current code the body message (payload) is not compress using gzip:

$ rabbitmqadmin get queue=messages -f pretty_json [  {"exchange":"messages","message_count": 0,"payload":"{\"name\":\"Foo bar\"}","payload_bytes": 18,"payload_encoding":"string","properties": {"content_encoding":"gzip","content_type":"application/json","delivery_mode": 2,"headers": {"X-Message-Stamp-Symfony\\Component\\Messenger\\Stamp\\BusNameStamp":"[{\"busName\":\"messenger.bus.default\"}]","type":"App\\Message\\DummyMessage"      },"timestamp": 1662922329    },"redelivered": true,"routing_key":""  }]

but, if we are aware of the value of thecontent_encoding property we should compress the body message.

$ rabbitmqadmin get queue=messages -f pretty_json [  {"exchange":"messages","message_count": 0,"payload":"H4sIAAAAAAAAA6tWysxNTE8NyC8u8UxRsrI0qwUAri6HchIAAAA=","payload_bytes": 38,"payload_encoding":"base64","properties": {"content_encoding":"gzip","content_type":"application/json","delivery_mode": 2,"headers": {"X-Message-Stamp-App\\Messenger\\UniqueIdStamp":"[{\"uniqueId\":\"631e4bdc3ad3b\"}]","X-Message-Stamp-Symfony\\Component\\Messenger\\Stamp\\BusNameStamp":"[{\"busName\":\"messenger.bus.default\"}]","type":"App\\Message\\AddPonkaToImage"      },"timestamp": 1662929884    },"redelivered": true,"routing_key":""  }]

Finally, the subscriber must be able to uncompressed the body message. I made some changes in order to figure out how
this can be accomplished.

Thanks!, I should be grateful for any comments.

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.2 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbotcarsonbot changed the title[Messenger][AMQP] Support **content encoding** property[Messenger] [AMQP] Support **content encoding** propertySep 11, 2022
@glengemannglengemann changed the title[Messenger] [AMQP] Support **content encoding** property[Messenger] [AMQP] Support content encoding propertySep 11, 2022
@glengemannglengemann changed the title[Messenger] [AMQP] Support content encoding property[Messenger] [AMQP] Support “content encoding” propertySep 11, 2022
@@ -18,6 +18,7 @@
"require": {
"php": ">=8.1",
"ext-amqp": "*",
"ext-zlib": "*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

As this is optional, it should be moved torequire-dev instead.


class Gzip implements CompressorInterface
{

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

extra blank line

@fabpot
Copy link
Member

You should also rebase to get rid of the merge commit.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot left review comments

@lyrixxlyrixxAwaiting requested review from lyrixx

@ycerutoycerutoAwaiting requested review from yceruto

@wouterjwouterjAwaiting requested review from wouterj

@chalasrchalasrAwaiting requested review from chalasr

@dunglasdunglasAwaiting requested review from dunglas

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@jderussejderusseAwaiting requested review from jderusse

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees
No one assigned
Projects
None yet
Milestone
6.2
Development

Successfully merging this pull request may close these issues.

3 participants
@glengemann@carsonbot@fabpot

[8]ページ先頭

©2009-2025 Movatter.jp