---
title: DispatchDefinition
description: The definition of a `dispatch` Effect (ADR-0071).
---

# `DispatchDefinition`

Type, in `@jr2/orchestrator/src/dispatch-effect.ts`. The signature of an export, or a type that it names, names this type. The [Authoring surface](../authoring-surface.md) page lists each export. This type is not an export of `@jr2/orchestrator`, so a workflow module does not import it by name.

```ts
type DispatchDefinition<S extends z.ZodObject | undefined = undefined> = {
  input?: S;
  wait?: boolean;
  timeout?: Duration;
  target?: { url: string; token: NamedSecret } | typeof open;
};
```

The definition of a `dispatch` Effect ([ADR-0071](../decisions/0071-a-run-starts-a-run-through-a-dispatch-effect.md)). Every field is optional.

**Fields**

- `input` (optional): `S`

  A zod schema of the run input of the Workflow. It types the `input` of the invoke and
  `fromPick`, and `jr2 up` compares it with the input that the Workflow declares. Without it,
  only the Workflow checks the input.
- `wait` (optional): `boolean`

  `true`: end when the new run ends (`settled`). `false`, the default: end when the
  Orchestrator accepts the run (`started`).
- `timeout` (optional): [`Duration`](type-duration.md)

  How long the Effect waits: by default 30s for the start, and 10m with `wait`.
- `target` (optional): `{ url: string; token: NamedSecret; } | typeof open`

  A different Orchestrator: `url` is its origin, and `token` is the secret that holds its
  Instance token. Or `open`, which the composer binds with `customize(<import>, { effects: {
  <slot>: { target: { url, token } } } })`. Without it, the run starts in this Orchestrator.
