kunicmarko/jms-messenger-adapter

This package is abandoned and no longer maintained. No replacement package was suggested.

Use JMS Serializer with Symfony Messenger.

1.1.0 2021-06-16 09:55 UTC

This package is auto-updated.

Last update: 2022-03-16 11:26:25 UTC


README

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