# `Jido.Messaging.OutboundRouter`
[🔗](https://github.com/agentjido/jido_messaging/blob/v1.0.0/lib/jido_messaging/outbound_router.ex#L1)

Outbound bridge router for runtime-configurable adapter delivery.

Resolves `RoomBinding` + `BridgeConfig` + `RoutingPolicy`, then dispatches
through `Jido.Messaging.OutboundGateway`.

# `delivery_failure`

```elixir
@type delivery_failure() :: %{
  route: route(),
  reason: term(),
  error: Jido.Messaging.OutboundGateway.error_response() | term()
}
```

# `delivery_success`

```elixir
@type delivery_success() :: %{
  route: route(),
  result: Jido.Messaging.OutboundGateway.success_response()
}
```

# `delivery_summary`

```elixir
@type delivery_summary() :: %{
  room_id: String.t(),
  policy: Jido.Messaging.RoutingPolicy.t(),
  attempted: non_neg_integer(),
  delivered: [delivery_success()],
  failed: [delivery_failure()]
}
```

# `route`

```elixir
@type route() :: %{
  binding_id: String.t(),
  bridge_id: String.t(),
  adapter_module: module(),
  channel: atom(),
  external_room_id: String.t()
}
```

# `resolve_routes`

```elixir
@spec resolve_routes(module(), String.t(), keyword()) ::
  {:ok, [route()]} | {:error, term()}
```

Resolves outbound routes for a room from bindings + bridge configs.

The returned list is ordered according to routing policy fallback order.

# `route_outbound`

```elixir
@spec route_outbound(module(), String.t(), String.t(), keyword()) ::
  {:ok, delivery_summary()}
  | {:error, :no_routes | {:delivery_failed, delivery_summary()} | term()}
```

Routes an outbound text payload for a room.

## Options

  * `:gateway_opts` - options passed to `OutboundGateway.send_message/4`
  * `:bridge_id` - force a specific bridge id
  * `:routing_policy` - override stored routing policy (`RoutingPolicy` or map)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
