Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Latest commit

 

History

History
94 lines (63 loc) · 2.69 KB

installation.md

File metadata and controls

94 lines (63 loc) · 2.69 KB

Installation

This page explains how to install and configure SimpleBus and Enqueue with Symfony.

Composer

Install packages with composer:

$ composer require simple-bus/asynchronous-bundle enqueue/enqueue-bundle damax/enqueue-simple-bus-queue-interop

Don't forget to choose appropriate transport layer e.g. Redis:

$ composer require enqueue/redis

If you use Doctrine below bridge is recommended:

$ composer require simple-bus/doctrine-orm-bridge

To enable LongRunning integration you'll also need:

$ composer require long-running/long-running

And finally make sure symfony/serializer is present (in recent Symfony versions it is not installed by default):

$ composer require symfony/serializer

If you prefer jms/serializer over symfony/serializer, please do:

$ composer require simple-bus/jms-serializer-bundle-bridge

Bundles

With introduction of symfony/flex you don't have to worry about enabling relevant bundles, but make sure below is present in your configuration.

// Symfony v4.0 example, but v3.x is also supported.

// SimpleBus
SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle::class => ['all' => true],
SimpleBus\SymfonyBridge\SimpleBusEventBusBundle::class => ['all' => true],
SimpleBus\SymfonyBridge\DoctrineOrmBridgeBundle::class => ['all' => true],
SimpleBus\AsynchronousBundle\SimpleBusAsynchronousBundle::class => ['all' => true],

// Enqueue
Enqueue\Bundle\EnqueueBundle::class => ['all' => true],
Enqueue\SimpleBus\Bridge\Symfony\Bundle\EnqueueSimpleBusBundle::class => ['all' => true],

// Integrations
LongRunning\Bundle\LongRunningBundle\LongRunningBundle::class => ['all' => true],

Don't worry too much about missing out some bundle. EnqueueSimpleBusBundle will warn you about it.

Configuration

EnqueueBundle suggests the following config:

enqueue:
    transport:
        default: '%env(ENQUEUE_DSN)%'
    client: ~

In case of Redis the value could be ENQUEUE_DSN=redis://localhost:6379/0.

Commands and/or events are published through SimpleBus i.e. Enqueue client's features are not used. Unless you want to explicitly publish messages through Enqueue (without SimpleBus), the config could be trimmed down to the following:

enqueue:
    transport:
        default: '%env(ENQUEUE_DSN)%'

Above will reduce the amount of registered services in dependency injection container.

No other configuration is required. Asynchronous messages are turned off by default.

Next

Read next how to enable and configure asynchronous commands and events.