kunicmarko / jms-messenger-adapter
Use JMS Serializer with Symfony Messenger.
Installs: 85 346
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 2
Forks: 7
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.2 || ^8.0
- jms/serializer: ^2.3 || ^3.9
- symfony/messenger: ^4.4 || ^5.3
Requires (Dev)
- behat/behat: ^3.6
- behat/symfony2-extension: ^2.1
- jms/serializer-bundle: ^3.9
- matthiasnoback/symfony-dependency-injection-test: dev-master
- php-coveralls/php-coveralls: ^2.4
- phpunit/phpunit: ^8.5 || ^9.5
- symfony/config: ^4.4 || ^5.3
- symfony/debug: ^4.4 || ^5.3
- symfony/dependency-injection: ^4.4 || ^5.3
- symfony/framework-bundle: ^4.4 || ^5.3
- symfony/http-kernel: ^4.4 || ^5.3
README
Use JMS Serializer with Symfony Messenger.
Documentation
Installation
Add dependency with Composer:
composer require kunicmarko/jms-messenger-adapter
Symfony
Enable the bundle for all environments:
// bundles.php return [ //... KunicMarko\JMSMessengerAdapter\Bridge\Symfony\JMSMessengerAdapterBundle::class => ['all' => true], ];
Configuration
#config/packages/jms_messenger.yaml jms_messenger: format: json # xml, json serializer_id: messenger.transport.jms_serializer
Serialized id should be configured in the messenger config, in case you did not get the recipe, just add:
#config/packages/jms_messenger.yaml framework: messenger: enabled: true serializer: default_serializer: messenger.transport.jms_serializer
Stamps
This library provides additional stamps that will use JMS Deserialization/Serialization Context for serializing/deserializing messages.
use JMS\Serializer\SerializationContext; use KunicMarko\JMSMessengerAdapter\Stamp\SerializationContextStamp; $context = SerializationContext::create(); $context->setGroups(['foo']); $messageBus->dispatch(new Message(), [new SerializationContextStamp($context)]);