best-it/commercetools-message-serializer

Serializer for CommerceTools messages

0.0.11 2020-08-10 14:43 UTC

This package is auto-updated.

Last update: 2024-10-11 19:59:02 UTC


README

Just an very simple serializer for symfony messenger and CommerceTools messages.

Step 1: Add package

$ composer require best-it/commercetools-message-serializer

Step 2: Create service

# services.yaml

services:
    BestIt\Messenger\CommerceToolsSerializer:
        class: BestIt\Messenger\CommerceToolsSerializer

Step 3: Use service

# messenger.yaml

framework:
    messenger:
        serializer:
            default_serializer: 'BestIt\Messenger\CommerceToolsSerializer'

Every message has a header parameter X-CommerceTools-Message which contains the full qualified class name of the CommerceTools message (e.g.: Commercetools\Core\Model\Message\OrderCreatedMessage).