# Package subscribers and recipes in `sample/`

What a package's own subscribers hear and emit, and how
`jadpo package check` compiles a package's recipes in its `sample/` app.

- **What a package's subscriber hears.** A subscriber in a package's
  `subscribers/` listens with `on:` for an event its webhooks bring: one
  of the package's events with `wire_name:`, its provider declaring
  `webhooks:`, public or not. Any other event, the package's own events
  among them, is `subscriber.event_invalid`, so what a package makes of a
  webhook is for the app's subscribers. Its `run:` calls one of the
  package's own actions with the event or its fields
  (`subscriber.run_invalid` otherwise); `retry:` is as any subscriber's.
- **Through the connection it came in on.** A package's subscriber hears
  each connection that gives its package `webhooks: { secret: }`, and
  only the events that came in on that connection: one delivery each,
  named `subscriber <Package>.<name> <connection>` (`subscriber
  AcmePay.renewal payments`), so a package connected twice runs its
  subscriber once per webhook, through the connection the webhook named.
  Its action's operations go through that connection, with its
  credential, host, timeout and fake; its changing calls are the
  delivery's steps, keyed by the delivery, as a subscriber's action's
  are; and a delivery is held while that connection's circuit breaker is
  open.
- **What a package's action emits.** An action without `public`, which
  only the package's subscribers run, emits the package's own events. An
  event a package's action emits and that gives no `wire_name:` is the
  package's own, and needs neither `wire_name:` nor `occurred_at`;
  `wire_name:` marks an event the provider sends, and emitting one is
  `package.action_invalid`, since only a signed webhook brings it. An
  event with neither `wire_name:` nor an action emitting it is still
  `package.wire_name_invalid` in a package that receives webhooks. What
  it emits is kept where the package's webhooks are, `events: { store:
  }` or the only store of the app's records, and reaches the app's
  subscribers of its public events; a package's subscriber never hears
  it, and one without `public` reaches no one.
- **Recipes in `sample/`.** `jadpo package check` compiles each recipe on
  its own, copied into the one domain of the package's `sample/` app
  (its `app.jadpo` and `domains/`), with the package placed as the
  sample's own integration, as the bar places it for its own compile, so a
  recipe names the package as an app's own integration does; the
  migrations and records a recipe would need aren't asked for, since an
  app writes its own once it copies the recipe. The `recipes` row reads
  `1 recipe compiles in sample/`, or which didn't; a recipe's problem is
  shown at `recipes/<recipe>/<file>` and a problem of the sample's own at
  `sample/<file>`, once. A package with recipes and no `sample/app.jadpo`,
  or a sample with no domain or several, is `publish.sample_missing`.
  The row isn't shown for a package with no recipes, and waits when the
  package has errors. A recipe's own tests run in `sample/` once a recipe
  has some.
