PlatformEventRule
EventBridge rule with shorthands for the platform event envelope.
Defaults
- Attached to the environment platform bus unless
eventBusis given eventNamesmap todetail-type(the runtime publishesDetailType = event name,Source = service name);sourceanddetailTypeadd to the pattern;eventPatternis merged- Targets (
IFunction | IQueue | IStateMachine | ITopic) are wired with the right EventBridge target class deadLetterQueue: truecreates<name>-dlq;retryAttemptsandmaxEventAgeapply to every target
Alarms
alarms.failedInvocations(), alarms.deadLetter().
Example
ts
new PlatformEventRule(this, "OnOrderEvents", {
eventNames: ["order.created", "order.updated"],
source: "checkout",
targets: [worker, flow],
deadLetterQueue: true,
}).alarms.failedInvocations();