Menu

7.7x Smaller and Encrypted at Rest: Compressing Symfony Messenger Payloads Without Touching a Handler
📰

7.7x Smaller and Encrypted at Rest: Compressing Symfony Messenger Payloads Without Touching a Handler

DEV Community: security·Matt Mochalkin·8 days ago
#pPIay0er
#devtosecurity#devto#dev#message#enter
Reading 0:00
15s threshold

Symfony Messenger serializes a message, hands the bytes to a transport and forgets about them. Two things routinely go wrong with those bytes:

They are too big. A bulk export, a sync job with a few thousand rows, a report with embedded data, and you're past SQS's 256 KB limit or your Redis memory is going somewhere it shouldn't.

They are readable. Names, emails, IBANs sit in plain text in messenger_messages , in a Redis RDB dump, on a RabbitMQ disk and in the dead-letter queue nobody has looked at since March.

mattleads/messenger-compress-bundle fixes both at the transport-serializer layer. You opt in per message with a stamp or enforce a policy per transport, and your handlers receive the same plain PHP objects they always did. We'll walk through the whole thing on a small Doctrine (SQLite) transport, because then the queue is a table you can SELECT from and see what changed.

Prerequisites

PHP 8.2 or newer.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.