# EventBridge

> Put events on EventBridge buses and check the events your services put there.

Source: https://axx.nimbusxr.us/references/steps/aws-eventbridge/

Put events on EventBridge buses and check the events your services put there.

The steps use the scenario's AWS account (`the {word} aws account with the following properties:`, from aws-core). An event has a detail type, a source and a JSON detail, as in `When a "DamageReported" event from carrier.kestrel is put on the carrier-events eventbridge bus:` with the detail as the doc string.

**Checking a bus** does not take events from anyone: for the buses a run checks, Axx adds a rule of its own (`axx-<run>-<bus>`, matching every event of the account) with a queue of its own as its target once the apps are up, and removes both when the run ends. The conditions are paths into the event as EventBridge delivers it: `detail-type`, `source`, and `detail.<field>` for the detail. A check only looks at the events received since its scenario started.

## `aws-eventbridge.put`

```gherkin
When a(n) {string} event from {word} is put on the {word} eventbridge bus:
  """
  ...
  """
```

Put an event with the detail type and source on a bus; the doc string is its JSON detail.

**Parameters:** `{string}` (text in single or double quotes; the quotes are removed), `{word}` (one word, no spaces)

**Example:**

```gherkin
When a "DamageReported" event from carrier.kestrel is put on the carrier-events eventbridge bus:
```

_Since 0.1.0._

## `aws-eventbridge.received`

```gherkin
Then [[within {duration} ]]the {word} eventbridge bus has an event where:
  | ... | ... |
```

Wait (10s, or the given time) until the bus has an event, put since the scenario started, that meets every row: `path | value` on the event (`detail-type`, `source`, `detail.<field>`), compared as text; `null` for null and `undefined` for absent. Axx adds a rule of its own to the bus for the run.

**Variants** (optional parts in `[[...]]` above):

- `the {word} eventbridge bus has an event where:`
- `within {duration} the {word} eventbridge bus has an event where:`

**Parameters:** `{duration}` (A duration in seconds or minutes, e.g. `5s` or `2m`), `{word}` (one word, no spaces)

**Example:**

```gherkin
Then within 30s the parcels eventbridge bus has an event where:
```

_Since 0.1.0._
