Skip to content

EventSource

Source: src/AWS/EventBridge/EventSource.ts

Event source connecting an EventBridge EventBus to the hosting compute (Lambda function or ServerHost process). Matching events invoke the host with a stream of EventRecords.

Use it through the consumeBusEvents helper; the host-specific implementation layer (e.g. AWS.Lambda.EventSource) creates the rule, grants EventBridge invoke permission, and dispatches events at runtime.

// init — subscribe to matching events (provide AWS.Lambda.EventSource on the Function)
yield* AWS.EventBridge.consumeBusEvents(
bus,
{ source: ["my.app"] },
(events: Stream.Stream<AWS.EventBridge.EventRecord>) =>
events.pipe(
Stream.runForEach((event) =>
Effect.log(event["detail-type"], event.detail),
),
),
);