https://github.com/handcraftedinthealps/redistransportbundle
[DEPRECATED] Now part of symfony/messenger since 4.3. Use that implementation instead!
https://github.com/handcraftedinthealps/redistransportbundle
message-bus php redis symfony symfony-bundle symfony-messenger
Last synced: about 1 year ago
JSON representation
[DEPRECATED] Now part of symfony/messenger since 4.3. Use that implementation instead!
- Host: GitHub
- URL: https://github.com/handcraftedinthealps/redistransportbundle
- Owner: handcraftedinthealps
- License: mit
- Created: 2018-11-20T13:42:55.000Z (over 7 years ago)
- Default Branch: 1.2
- Last Pushed: 2024-01-17T13:53:19.000Z (over 2 years ago)
- Last Synced: 2025-04-11T07:23:26.031Z (about 1 year ago)
- Topics: message-bus, php, redis, symfony, symfony-bundle, symfony-messenger
- Language: PHP
- Homepage:
- Size: 50.8 KB
- Stars: 6
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RedisTransportBundle ⛰
[](https://github.com/handcraftedinthealps/RedisTransportBundle/blob/master/LICENSE)
[](https://github.com/handcraftedinthealps/RedisTransportBundle/releases)
[](https://circleci.com/gh/handcraftedinthealps/RedisTransportBundle/tree/master)
A symfony messenger transport implementation for redis streams.
> **NOTE: Most of the logic has moved to the Core Symfony Messenger component in 4.3. So this bundle is not longer a requirement to use messenger with redis streams. You can now use the `redis://` instead of `redis-stream://` and remove this bundle from your requirements.**
## Requirements
- PHP: **`^7.1`**
- Redis Extension: **`^4.2`**
- Redis Server: **`^5.0`**
## Symfony compatibility
| Symfony Messenger Version | Bundle Version
|---------------------------|------------------
| 4.2 | 1.0
| 4.3 | 1.1
When upgrading to symfony 4.3 you should replace this bundle
with the symfony `redis://` transport and remove the bundle
from your requirements.
## Installation
You need [composer](https://getcomposer.org) to install this bundle to your symfony application.
```bash
composer require handcraftedinthealps/redis-transport-bundle
```
## Configuration
### Symfony
When using the **symfony/framework-bundle** you can configure the following:
```yaml
# config/packages/framework.yaml
framework:
messenger:
routing:
'HandcraftedInTheAlps\Bundle\RedisTransportBundle\Message\DomainEventMessage':
senders: ['redis_stream']
transports:
redis_stream: 'redis-stream://127.0.0.1:6379/my_stream/my_group/my_consumer'
```
You can then send a DomainEventMessage or your custom Message over the redis stream:
```php
use HandcraftedInTheAlps\Bundle\RedisTransportBundle\Message\DomainEventMessage;
$this->messageBus->dispatch(
new DomainEventMessage(
'mountain.modified', // the custom event action
'mountain', // the model which has been changed
'1', // the model id or uuid
[ // the model payload
'id' => '1',
'name' => 'Piz Buin',
'height' => 3312,
]
)
);
```
And you can consume the messages with:
```bash
bin/console messenger:consume-messages redis_stream
```
Have also a look at the [messenger component documentation](https://symfony.com/doc/current/components/messenger.html) and [messenger usage documentation](https://symfony.com/doc/current/messenger.html).
## Commands
Messages in streams won't be removed by default. Therefor this bundle provides a command:
```
bin/console redis-transport:trim --maxlen 1000
```