event
import { event } from '@routecraft/routecraft'
Produce exchanges from framework events. Use as the source with .from(event(filter)); the exchange body is the event payload.
// Single event
craft().from(event('route:started')).to(log())
// Multiple events
craft().from(event(['route:started', 'route:stopped'])).to(log())
Filter (EventFilter): an event name, an array of names, or a wildcard pattern.
*(single-level) matches exactly one colon-separated segment:route:*matchesroute:startedbut notroute:exchange:started.**(globstar) matches zero or more segments at any depth:route:**matches every route event;route:operation:**matches the choice, multicast, dispatch, sample, dedupe and debounce events. Wrapper and step events sit under their own prefixes (route:retry:*,route:step:*), soroute:**is the pattern that reaches all of them.*on its own matches all events.
Event names are a fixed set (identity such as the route id lives in the payload), so patterns match against the emitted name behind a single catch-all subscription; to scope to one route, filter on details.routeId in a downstream step. The event() adapter is the only place wildcard patterns survive; ctx.on() accepts exact names plus the catch-all '*'. See the Events reference for the full taxonomy.
A route is not delivered the events its own exchanges cause: their step, exchange, operation and error events, including context:error, and those of any route they call through direct(), which shares their correlation id. Every step it runs emits step events, so it would otherwise feed on itself. Its own lifecycle events that carry no exchange, such as route:started, are delivered. Two event() routes that each watch step or exchange events still feed each other, so point an observability route at the routes it observes rather than at another observer.