rabbitevents/redis-transport

Redis Streams transport for RabbitEvents

Maintainers

Package info

github.com/rabbitevents/redis-transport

pkg:composer/rabbitevents/redis-transport

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.2 2026-08-20 15:01 UTC

This package is auto-updated.

Last update: 2026-08-20 15:15:35 UTC


README

Unit tests Coverage Static code analysis Total Downloads Latest Version License

Redis Streams transport driver for RabbitEvents.

This package enables RabbitEvents to publish events to and consume events from Redis Streams, providing durable event streaming, consumer groups, acknowledgement (XACK), and retry handling.

Requirements

  • PHP >= 8.4
  • ext-redis (recommended) or compatible client
  • rabbitevents/foundation >= 9.1

Installation

composer require rabbitevents/redis-transport

Configuration

Add the redis connection to your config/rabbitevents.php:

return [
    'default' => env('RABBITEVENTS_CONNECTION', 'redis'),

    'connections' => [
        'redis' => [
            'driver' => 'redis',
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'port' => env('REDIS_PORT', 6379),
            'password' => env('REDIS_PASSWORD', null),
            'database' => env('REDIS_DB', 0),
            'timeout' => env('REDIS_TIMEOUT', 3.0),
            'stream' => env('RABBITEVENTS_REDIS_STREAM', 'events'),
            'consumer' => env('RABBITEVENTS_REDIS_CONSUMER', gethostname() ?: 'default'),
        ],
        // ...
    ],
];

Configuration Options

Option Type Default Description
driver string redis The connection driver.
host string 127.0.0.1 Redis server hostname or IP.
port int 6379 Redis server port.
password string|null null Authentication password (if configured).
database int 0 Redis logical database index (0-15). Default is 0.
timeout float 3.0 Connection timeout in seconds.
stream string events The Redis Stream key name used as the event topic.
consumer string hostname Unique consumer identifier within the consumer group.

Usage

Publishing Events

Publishing events remains identical to standard RabbitEvents:

use App\Events\UserRegistered;

event(new UserRegistered($user));
// or
publish('user.registered', ['user_id' => $user->id]);

Listening to Events

Run the RabbitEvents worker with the Redis connection:

php artisan rabbitevents:listen --connection=redis

Or specify events directly:

php artisan rabbitevents:listen user.registered,order.* --connection=redis

Architecture & Guarantees

  • Topic: Mapped to a Redis Stream key (events).
  • Queue: Mapped to a Redis Stream Consumer Group (XGROUP).
  • Reliability: Uses XADD for publishing, XREADGROUP for receiving, and XACK on successful message processing.
  • Wildcards: Supports AMQP-style routing key wildcards (user.*, order.#).

License

The MIT License (MIT). Please see License File for more information.