Download the PHP package tourze/async-service-call-bundle without Composer
On this page you can find all versions of the php package tourze/async-service-call-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package async-service-call-bundle
Async Service Call Bundle
中文
An asynchronous service call bundle built on Symfony Messenger, supporting complex object parameter serialization and retry mechanisms.
Table of Contents
- Dependencies
- Package Dependencies
- Installation
- Quick Start
- 1. Register Bundle
- 2. Configure Messenger
- 3. Create Service Call Message
- Features
- Complex Object Parameter Serialization
- Retry Mechanism
- Error Handling
- Usage Examples
- Basic Usage
- Complex Object Parameters
- Enum Parameters
- Advanced Usage
- Custom Service Call Handler
- Advanced Serialization
- Error Handling Strategies
- Configuration Options
- Service Configuration
- Custom Serializer
- Notes
- License
Dependencies
This package requires:
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Doctrine ORM 3.0 or higher
- Symfony Messenger component
Package Dependencies
tourze/async-contracts: Provides interface contracts for async operationstourze/doctrine-helper: Helper utilities for Doctrine integration
Installation
Quick Start
1. Register Bundle
Register in config/bundles.php:
2. Configure Messenger
Configure in config/packages/messenger.yaml:
3. Create Service Call Message
Features
Complex Object Parameter Serialization
The bundle includes an advanced serializer that supports:
- Basic data types (string, int, float, bool, array)
- Objects (including Doctrine entities)
- Enum types (BackedEnum)
- DateTime objects
Retry Mechanism
- Support for setting maximum retry count
- Exponential backoff delay (maximum 1 hour)
- Complete error logging
Error Handling
- Detailed error logging
- Exception retry support
- Graceful degradation
Usage Examples
Basic Usage
Complex Object Parameters
Enum Parameters
Advanced Usage
Custom Service Call Handler
You can extend the default handler to add custom logic:
Advanced Serialization
The bundle provides a custom ObjectNormalizer that implements NormalizerInterface and DenormalizerInterface to handle entity serialization. It automatically converts entities to their IDs during serialization and loads them back during deserialization.
For complex custom objects, you can create your own normalizers:
Error Handling Strategies
Configure custom error handling for specific services:
Configuration Options
Service Configuration
The bundle automatically registers the following services:
Tourze\AsyncServiceCallBundle\MessageHandler\ServiceCallHandlerTourze\AsyncServiceCallBundle\Service\Serializer
Custom Serializer
If you need custom serialization behavior, you can extend the Serializer class:
Notes
- Parameter Limitations: Does not support array parameters containing objects
- Dependency Injection: Ensure target services are properly registered in the container
- Error Handling: Configure appropriate log levels for debugging
- Performance Considerations: Complex object serialization may impact performance
License
MIT License
All versions of async-service-call-bundle with dependencies
ext-spl Version *
doctrine/common Version ^3.5
doctrine/orm Version ^3.0
monolog/monolog Version ^3.1
psr/container Version ^1.1|^2.0
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/console Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-kernel Version ^7.3
symfony/messenger Version ^7.3
symfony/property-access Version ^7.3
symfony/property-info Version ^7.3
symfony/serializer Version ^7.3
symfony/yaml Version ^7.3
tourze/async-contracts Version 1.0.*
tourze/bundle-dependency Version 1.*
tourze/doctrine-helper Version 1.0.*