start_route
Create and run a message route that moves data from a source endpoint to a sink endpoint. Supports middlewares, batching, and concurrency, and returns a route name for status, wait, and stop calls.
Instructions
Create and run a route that moves messages from its input (source) endpoint to its output (sink) endpoint, each keyed by connector type. Supports route options like concurrency, batch_size, and exit_on_empty (drain the source then exit; otherwise the route runs continuously until stopped). Either endpoint may carry a middlewares array — retry, dlq, deduplication, limiter, transform, compression, encryption, pack/unpack, buffer, delay, timeout, weak_join, cookie_jar, metrics — e.g. {"sqlx": {...}, "middlewares": [{"retry": {"max_attempts": 3}}]}. concurrency/batch_size may be given inside route or as top-level arguments — the top-level argument wins, and an unset value becomes the app default (4 / 1024, or the batch size the output endpoint's schema declares). Returns the route name for use with wait_route / route_status / stop_route, plus the tuning that took effect.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Optional unique route name (auto-generated if omitted). | |
| route | Yes | The route to run: an `input` (source) endpoint and an `output` (sink) endpoint — each keyed by connector type, e.g. `{"input": {"nats": {"url": "localhost:4222", "subject": "orders"}}, "output": {"file": {"path": "/tmp/out.jsonl"}}}` — plus route options such as `exit_on_empty` (drain the source then exit), `concurrency` and `batch_size`. Use `{"null": null}` as the `output` to discard messages. A `file`/`object_store` source must repeat the `compression`/`encryption` its data was written with — neither is auto-detected, and a mismatch ends the route as `completed` having moved few or no messages rather than failing, so check the moved-message count. | |
| batch_size | No | Batch size. Overrides `batch_size` inside `route` if both are given; if neither is given, the output endpoint's own schema default applies if it declares one, else the app default (1024), not the library's 512. | |
| concurrency | No | Route concurrency. Overrides `concurrency` inside `route` if both are given; if neither is given the app default (4) applies, not the library's 1. Higher values parallelize sink writes; sources that read serially do not speed up. | |
| capture_last | No | Keep the last N messages that flow through this route, readable with `route_messages`. Omit (or 0) to capture nothing, which is the default — captured payloads are held in memory and returned to the model verbatim. |