> ## 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.

# JSONLEventBridge

> Forward events through newline-delimited JSON files.

`JSONLEventBridge` appends one event JSON payload per line and tails the file for inbound events.

## Constructor params

* `path`: JSONL file path
* `poll_interval`: tail polling interval in seconds (default `0.25`)
* `name`: optional bridge label

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

    bridge = JSONLEventBridge(
        '/tmp/abxbus_events.jsonl',
        poll_interval=0.25,
        name='JsonlBridge',
    )
    ```
  </Tab>

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

    const bridge = new JSONLEventBridge('/tmp/abxbus_events.jsonl', 0.25, 'JsonlBridge')
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    bridge := abxbus.NewJSONLEventBridge("/tmp/abxbus_events.jsonl", 0.25, "JsonlBridge")
    ```
  </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>

## Setup with a bus

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

    bus = EventBus('AppBus')
    bridge = JSONLEventBridge('/tmp/abxbus_events.jsonl')

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

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

    const bus = new EventBus('AppBus')
    const bridge = new JSONLEventBridge('/tmp/abxbus_events.jsonl')

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

  <Tab title="Go">
    ```go theme={null}
    bus := abxbus.NewEventBus("AppBus", nil)
    bridge := abxbus.NewJSONLEventBridge("/tmp/abxbus_events.jsonl", 0.25, "JsonlBridge")

    bus.OnEventName("*", "jsonl_emit", func(event *abxbus.BaseEvent) (any, error) {
    	return bridge.Emit(event)
    }, nil)
    bridge.OnEventName("*", "bus_emit", func(event *abxbus.BaseEvent) (any, error) {
    	return bus.Emit(event), nil
    }, nil)
    ```
  </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(...)` appends compact JSON payload + newline to the file.
* `on(...)` auto-starts a tail loop and registers inbound handlers.
* Start cursor is initialized at current EOF, so only newly appended lines are processed.
* Malformed lines are ignored; valid lines are parsed into events, reset, and emitted on the internal bus.
* Runtime note: TypeScript JSONL bridge is Node.js-only. Go's JSONL bridge uses local filesystem polling.
