Skip to content

Latest commit

 

History

History
74 lines (54 loc) · 2.16 KB

README.md

File metadata and controls

74 lines (54 loc) · 2.16 KB

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