Download the PHP package mhujer/rabbit-mq-consumer-handler-bundle without Composer

On this page you can find all versions of the php package mhujer/rabbit-mq-consumer-handler-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package rabbit-mq-consumer-handler-bundle

RabbitMQ Consumer Handler Bundle

This package is a fork of vasek-purchart/rabbit-mq-consumer-handler-bundle maintained for newer PHP and Symfony versions.


Handle messages in RabbitMQ consumers in a safe and effective way

Note: This bundle expects you are using RabbitMqBundle

Message queue consumers require usually long running processes, which should process many different messages, before they are terminated. In an ideal scenario, they will be running indefinitely. But since we are not living in an ideal world, errors will inevitably occur. These can be typically:

The purpose of this bundle is to encapsulate handling of these states, automate the ones, which can be automated and provide comfortable ways to handle the remaining ones.

This bundle can automatically handle:

Usage

In order to receive all the benefits of automated handling you need only to run the message processing through the ConsumerHandler, so standard consumer could look something like this:

This bundle will create ConsumerHandler instance for every one of your consumers, because it needs to access specific instance of OldSound\RabbitMqBundle\RabbitMq\DequeuerInterface, which it needs to control consuming messages from the configured queue.

Assuming your consumer is called example in the old_sound_rabbit_mq configuration, vasek_purchart.rabbit_mq_consumer_handler.consumer_handler.id.example service will be prepared, so you can just pass this instance to your consumer:

Restarting consumers

With consumers you will generaly need something to keep them running in case they fail. This is achieved usually with some kind of daemon (for example supervisord), which will run the consumers for you, watch them if they are running and start them again if not (based on your configuration).

In order for the tool to be able to restart the consumer reliably, it first needs to be able to tell, whether the consumer has even started, so that it would just not get stuck in booting cycle. The usual configuration is to not start the program again after several retries when it cannot start properly. In suprvisord the program is considered to be started after startsecs number of seconds.

This bundle is making sure, that always, when the consumer is shutting down due to an uncaught exception or error, the consumer has been running at least this amount of time by sleeping for stop_consumer_sleep_seconds, which should be configured to the same value as startsecs. This means that the behavior can be handled correctly by supervisord - restarting the consumer when it fails due to processing a message, but not restarting it indefinitely if the application cannot even start.

Handling exceptions

In the example below, there are some examples of the most common situations you will encounter:

Configuration

Configuration structure with listed default values:

Installation

Install package mhujer/rabbit-mq-consumer-handler-bundle with Composer:

Register the bundle in your application kernel:


All versions of rabbit-mq-consumer-handler-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ~7.4 || ~8.0
consistence-community/consistence Version ~2.1
doctrine/orm Version ~2.6
php-amqplib/rabbitmq-bundle Version ~2.2
psr/log Version ~1.0
symfony/config Version ~4.4|^5.4|^6.0
symfony/dependency-injection Version ~4.4|^5.4|^6.0
symfony/http-kernel Version ~4.4|^5.4|^6.0
symfony/yaml Version ~4.4|^5.4|^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mhujer/rabbit-mq-consumer-handler-bundle contains the following files

Loading the files please wait ....