> ## Documentation Index
> Fetch the complete documentation index at: https://abxbus.archivebox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# RedisEventBridge

> Forward events via Redis pub/sub channels.

`RedisEventBridge` publishes event payloads to a Redis channel and subscribes for inbound events on the same channel.

## Go support

<Tabs>
  <Tab title="Go">
    `RedisEventBridge` is not implemented in `abxbus-go` yet. Use [JSONLEventBridge](./bridge-jsonl) for the currently supported Go bridge.
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use typed event JSON serialization with an external transport for now.
    ```
  </Tab>
</Tabs>

## Optional dependencies

<Tabs>
  <Tab title="Python">
    Install the Redis extra (recommended):

    ```bash theme={null}
    pip install "abxbus[redis]"
    ```

    Equivalent direct dependency install:

    ```bash theme={null}
    pip install redis
    ```
  </Tab>

  <Tab title="TypeScript">
    Install the Redis client package:

    ```bash theme={null}
    npm install abxbus ioredis
    ```

    This bridge is Node.js-only.
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    // RedisEventBridge is not implemented in abxbus-go yet.
    // Use JSONLEventBridge for the currently supported Go bridge.
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use typed events plus EventBus JSON serialization with an external transport for now.
    ```
  </Tab>
</Tabs>

## Constructor params

* `redis_url`: redis URL in the form `redis://user:pass@host:6379/<db>/<optional_channel>`
* `channel`: optional channel override (defaults to URL channel segment or `abxbus_events`)
* `name`: optional bridge label

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from abxbus.bridges import RedisEventBridge

    bridge = RedisEventBridge(
        'redis://user:pass@localhost:6379/1/abxbus_events',
        name='RedisBridge',
    )
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    import { RedisEventBridge } from 'abxbus/bridges'

    const bridge = new RedisEventBridge(
      'redis://user:pass@localhost:6379/1/abxbus_events',
      undefined,
      'RedisBridge'
    )
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    // RedisEventBridge is not implemented in abxbus-go yet.
    // Use JSONLEventBridge for Go process-to-process bridge tests and deployments.
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use typed events plus EventBus JSON serialization with an external transport for now.
    ```
  </Tab>
</Tabs>

## Setup with a bus

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from abxbus import EventBus
    from abxbus.bridges import RedisEventBridge

    bus = EventBus('AppBus')
    bridge = RedisEventBridge('redis://localhost:6379/0/abxbus_events')

    bus.on('*', bridge.emit)
    bridge.on('*', bus.emit)
    ```
  </Tab>

  <Tab title="TypeScript">
    ```ts theme={null}
    import { EventBus } from 'abxbus'
    import { RedisEventBridge } from 'abxbus/bridges'

    const bus = new EventBus('AppBus')
    const bridge = new RedisEventBridge('redis://localhost:6379/0/abxbus_events')

    bus.on('*', bridge.emit)
    bridge.on('*', bus.emit)
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    // RedisEventBridge is not implemented in abxbus-go yet.
    // Use JSONLEventBridge for Go process-to-process bridge tests and deployments.
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use typed events plus EventBus JSON serialization with an external transport for now.
    ```
  </Tab>
</Tabs>

## Behavior

* `emit(...)` publishes serialized event JSON to the configured Redis channel.
* `on(...)` subscribes handlers for inbound messages and auto-starts the Redis subscriber.
* Incoming messages are parsed into events, reset, then emitted on the bridge's internal bus.
* `close()` unsubscribes and closes Redis clients.
* Runtime requirements: Python needs `redis` (`redis.asyncio`), TypeScript needs `ioredis` and Node.js.
