retailcrm/symfony-beanstalkd-messenger

Symfony Beanstalkd Messenger Bridge

v1.0.2 2021-02-05 14:29 UTC

This package is auto-updated.

Last update: 2021-11-05 16:05:55 UTC


README

Build Status Coverage Latest stable PHP from Packagist

Symfony beanstalkd messenger

Beanstalkd transport for symfony messenger

Installation

composer require retailcrm/symfony-beanstalkd-messenger

Usage

  • in the .env config file add the connection credentials:

MESSENGER_TRANSPORT_DSN=beanstalkd://localhost:11300

  • create your messages and message handlers (about messages)

  • configure messenger in config/packages/messenger.yml, for example:

framework:
    messenger:
        transports:
            async:
                dsn: "%env(MESSENGER_TRANSPORT_DSN)%"
                options:
                    queue_name: async
        routing:
            'App\Message\MyMessage': async
  • add transport factory in config/services.yml
services:
# ...
    RetailCrm\Messenger\Beanstalkd\Transport\BeanstalkTransportFactory:
        tags: [messenger.transport_factory]

Allowed transport options

  • tube_name - tube name in beanstalkd

  • timeout - timeout for receiving jobs from tube. Default - 0

  • ttr - ttr value for jobs. Default - 60

  • not_send_if_exists - do not send a job to the queue only if such a job is already exist. Default - true

All options are optional, if tube_name not specified will be used default queue default