Giter Club home page Giter Club logo

laminas-messenger's Introduction

Mezzio/Laminas Factories for Symfony Messenger

Stand With Ukraine

Continuous Integration Type Coverage

Introduction

This library aims to provide a way of getting Symfony Messenger up and running in a Laminas/Mezzio application with minimum fuss.

Portions of this library borrow heavily from xtreamwayz/expressive-messenger

These docs assume that you are familiar with Symfony Messenger and the conventions associated with setting up a Mezzio application.

Package Dependencies/Suggestions

Because Messenger provides Symfony cli commands to consume queues and process messages amongst other things, this package suggests laminas/laminas-cli. This Symfony CLI integration works on a convention that commands are available in your DI container configuration as a hash map under config.laminas-cli.commands using the command name as the key and the container identifier as the value. If that's not how you roll, then you'll still be able to benefit from the command factories, you'll just have to wire them up how you like. If you choose to install laminas/laminas-cli, then you'll be able to issue a vendor/bin/laminas messenger:consume [options] without much trouble.

If you want to use a transport not shipped by default with Symfony Messenger, such as AMQP, then you'll need to composer require symfony/amqp-messenger for example.

Installation & Configuration

composer require netglue/laminas-messenger

During installation, you will be asked if you want to inject the main config provider ConfigProvider::class. This configures the 'consume' and 'debug' cli tools and factories for retry strategies and transport factories. Without further configuration, you still won't have any usable message buses, so there are 3 more config providers available:

  • FailureCommandsConfigProvider::class configures cli tools that allow you to inspect and manipulate the failure transport/queue and as such require that a failure transport is configured. Manually add this config provider to your setup if you want to configure a failure transport/queue.

  • DefaultCommandBusConfigProvider::class provides a typical setup for a single command bus retrievable from the container with the key command_bus.

  • DefaultEventBusConfigProvider::class provides a typical setup for an event bus retrievable with event_bus

None of those config providers assume anything about your transport setup so in order to get up and running, you should also see the annotated example configurations in ./docsโ€ฆ

Upgrading from 1.x to 2.x

  • SigTerm Listener

    Version 2 automatically attaches the SIGTERM listener to the consume command. This means that if you were previously doing this yourself, you should probably remove that listener.

  • Internal helper traits removed

    If you had been writing your own factories and making use of the previously shipped traits, these are all replaced with a collection of static utility methods which are also all now marked as internal.

  • Inheritance and general BC breaks

    If you were extending any of the shipped factories or classes or factories, you'll get runtime errors due to pretty much everything gaining the final keyword - previously, everything was marked soft @final so your SA tools should have warned you about that anyhow.

    There are likely many subtle BC breaks that should generally not affect you if you were using this lib with a configuration only approach (its intended usage). Configuration remains largely unchanged with optional additions only.

  • Symfony 6.x Compatibility

    Version 2 remains compatible with symfony/messenger@^5.3 and gains compatibility with ^6 - v5 support is not likely to remain for very long though.

  • Multiple Failure Transports

    V2 comes with support for failure transports assigned to specific receivers along with the existing default failure transport. This means that you can have different failure queues for different message types. You can find example config here.

  • Static Analysis and Test Coverage Improvements

    Types are more refined across the board and the baseline is looking good. A number of psalm types are defined on the main ConfigProvider that you might find useful for annotating your configuration structures.

fin.

laminas-messenger's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar gsteel avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

laminas-messenger's Issues

Missing factory for StopWorkers

Hey,

I noticed that the messenger:stop-workers command is not implemented. This is not a problem however i am struggling a but to implement the factory myself where the command requires a CacheItemPoolInterface

Any guide on how to handle this? It would be a good addition to add the factory to this lib i suppose.

Thanks!

Automatically add Sigterm Listener

Currently, in order to gracefully stop a consumer, you must manually issue a stop-worker command on the cli. In order to stop gracefully in Docker for example, the StopWorkerOnSigtermSignalListener should be attached to the consume-messages command.

This listener also depends on the pcntl extension

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

composer
composer.json
  • php ~8.1 || ~8.2 || ~8.3
  • gsteel/dot ^1.6
  • laminas/laminas-stdlib ^3.6
  • psr/container ^1.0 || ^2.0
  • psr/log ^2 || ^3
  • symfony/console ^6.0 || ^7.0
  • symfony/dependency-injection ^6.0 || ^7.0
  • symfony/event-dispatcher ^6.0 || ^7.0
  • symfony/messenger ^6.4 || ^7.0
  • symfony/serializer ^6.0 || ^7.0
  • symfony/service-contracts ^2 || ^3
  • doctrine/coding-standard ^12.0
  • doctrine/orm ^2.17.3
  • laminas/laminas-cli ^1.10
  • laminas/laminas-config-aggregator ^1.14
  • laminas/laminas-servicemanager ^3.22.1
  • lctrs/psalm-psr-container-plugin ^1.10
  • phpunit/phpunit ^10.5.8
  • psalm/plugin-phpunit ^0.19.0
  • squizlabs/php_codesniffer ^3.8.1
  • symfony/amqp-messenger ^6.4 || ^7.0
  • symfony/doctrine-messenger ^6.4.2 || ^7.0
  • symfony/redis-messenger ^6.4.2 || ^7.0
  • vimeo/psalm ^5.20.0
github-actions
.github/workflows/continuous-integration.yml
  • actions/checkout v4.1.7
  • shivammathur/setup-php 2.31.1
  • ramsey/composer-install 3.0.0
.github/workflows/release-on-milestone-closed.yml

  • Check this box to trigger a request for Renovate to run again on this repository

Doctrine Transport Factory has no tests

The doctrine transport factory lacks any tests at all - they're also pretty necessary considering that the factory relies on Symfony classes that are marked as @internal

Resolve new Symfony Deprecations in 6.3

At least these two need resolving:

  • Symfony\Component\Messenger\Transport\InMemoryTransportFactory
  • Symfony\Component\Messenger\EventListener\StopWorkerOnSigtermSignalListener

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.