# `Cucumber.Messages.Emitter`
[🔗](https://github.com/huddlz-hq/cucumber/blob/main/lib/cucumber/messages/emitter.ex#L1)

Drives Cucumber Messages emission through the `Cucumber.RunCoordinator`
sink.

Two roles:

  * **Configuration** — `configure/6` (deprecated) builds the run's static envelopes
    (meta, sources, gherkin documents, pickles, step definitions, hooks,
    parameter types) plus the id maps run-time messages reference, and
    hands them to the coordinator. Called by
    `Cucumber.compile_features!/1` when
    `config :cucumber, messages: path` is set.
  * **Run-time sessions** — the scenario runner opens a session per
    scenario (`open_test_case/2` emits the `testCase` envelope),
    starts one attempt at a time (`start_attempt/2` emits
    `testCaseStarted`), brackets steps and scenario hooks with
    started/finished events, and closes each attempt
    (`close_test_case/2`).

Every session function is nil-safe: when the sink is disabled the session
is nil and all of this is a no-op, so the runner carries no conditionals.

> #### Deprecated {: .warning}
>
> This module is driven by the compiler and will become internal in 2.0.
> Enable Cucumber Messages with `config :cucumber, messages: path`
> instead of calling it directly.

# `configure`

> This function is deprecated. Configure messages with `config :cucumber, messages: path`; removed in 2.0.

```elixir
@spec configure(
  String.t(),
  [{map(), Gherkin.Pickles.Compilation.t()}],
  Cucumber.StepRegistry.t(),
  [tuple()],
  map(),
  non_neg_integer()
) :: :ok
```

Builds the run's static envelopes and id maps and configures the
coordinator's message sink.

`features_with_compilations` pairs each discovered feature with its
`Gherkin.Pickles.Compilation`; `next_id` continues the compilation id
sequence so every id in the stream is run-unique.

`step_registry` is the `Cucumber.StepRegistry` discovery builds; it
carries the run's parameter types, so `parameter_types` is ignored.

---

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