Download the PHP package bytespin/messenger-dedupe-bundle without Composer

On this page you can find all versions of the php package bytespin/messenger-dedupe-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 messenger-dedupe-bundle

Copyright (c) 2023 Greg LAMY [email protected]

This is a public project hosted on GitHub : https://github.com/ByteSpin/MessengerDedupeBundle

This was originally developed as part of an ETL project.

ByteSpin/MessengerDedupeBundle is a Symfony 6.3 bundle that tries to help managing messenger_messages unicity when used with Doctrine transport.

[!NOTE]

This project is still at alpha state and has not yet been fully tested outside its parent project.

Feel free to submit bug and/or pull requests!

You can check the CHANGELOG to see the latest improvements and fixes.

Just keep in mind that I want to keep it as simple as possible!

Requirements

Installation

First install the bundle:

Then updates the database schema:

Manual bundle registration

You will need to manually register the bundle in your application.

To do this, follow these steps:

  1. Open the file config/bundles.php in your Symfony application.

  2. Add the following line to the array returned by this file:

  3. Save the file. Your bundle is now registered and ready to be used in your application.

Make sure to perform this step after you have installed the bundle using Composer, but before you use any of its features in your application.

Configuration

You will have to configure the entity manager to be used with the ByteSpin\MessengerDedupeBundle entities. This has to be done once after installation. We provide a script to automatise this step ; please run :

If you prefer to do this by yourself, add the following lines just within your entity manager 'mappings:' key in doctrine.yaml :

[!IMPORTANT]

If your project contains entities mapped to multiple entity managers, be careful to not use the auto_mapping: true in your doctrine configuration.

This would prevent the getManagerForClass() function used in the bundle to get the correct entity manager to work properly!

This could happen if you decide to use the MessengerDedupeBundle with a shared messenger_messages table between multiple symfony projects.

In such case :

  • Choose the correct entity manager when you run the configuration script,
  • Be sure to remove the 'auto_mapping: true' key from your doctrine.yaml (or set it to false),
  • Be sure that ALL your entities are correctly mapped in the 'mappings:' sections of your doctrine.yaml

Message deduplication

This feature avoids same messages (YOU decide what is same in this case) accumulation in the messenger_messages table when Doctrine transport is used, with the help of a custom Middleware and Envelope Stamp.

Usage

You must enable the deduplication Middleware in your messenger.yaml config file :

[!NOTE]

The deduplication middleware must be executed before any other custom or standard symfony middleware

Put it first in the middleware list will do the trick

Don't forget to use the following class and initialize your message bus :

When you need to dispatch a message, you first have to calculate a hash of what makes this message unique

For example :

Then you can dispatch your message using the custom stamp :

[!NOTE] Any message dispatched without any HashStamp will be ignored by the middleware

That's all!

When a message is dispatched with the HashStamp stamp through the doctrine transport, the deduplication middleware will first check that a similar hash does not exist :

An event subscriber is in charge of removing the hash when the message has been processed

Usage between multiple Symfony Applications

In more complex architectures, a Symfony application (let's call it the Master App) can be used to generate some messages to some other remote Symfony applications (let's call them the Remote App). The DeduplicationHash is always stored on the Master App. The Remote App can consume the message but the DeduplicationHash is still stored on the Master App.

With the help of a simple EventSubscriber listening to WorkerMessageHandledEvent and/or WorkerMessageFailedEvent, a specific RemoveDedupeHash message can be dispatched by the Remote App to the correct Master App transport/queue for the DedupeHash to be removed.

In such case :

For example, the Master App generates a message :

On the Remote App, a simple EventSubscriber is in charge of dispatching the RemoveHash message to the Master App :

Licence

This project is licensed under the MIT License - see the LICENSE file for details.


All versions of messenger-dedupe-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/validator Version ^7.1
symfony/messenger Version ^7.1
symfony/doctrine-messenger Version ^7.1
doctrine/doctrine-bundle Version ^2.9
doctrine/orm Version ^2.10
symfony/flex Version ^2
symfony/framework-bundle Version ^7.1
ext-readline Version *
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 bytespin/messenger-dedupe-bundle contains the following files

Loading the files please wait ....