Skip to content

chq81/jms-messenger-adapter

 
 

Repository files navigation

JMS Messenger Adapter

Use JMS Serializer with Symfony Messenger.

PHP Version Latest Stable Version Latest Unstable Version

Build Status Coverage Status

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)]);

About

Use JMS Serializer with Symfony Messenger.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 97.9%
  • Gherkin 1.2%
  • Makefile 0.9%