Skip to content

resolvePlatformEventDistribution

resolvePlatformEventDistribution(input, records): PlatformEventDistributionResult

Defined in: packages/simply-aep-core/src/at4dxPlatformEventSubscriptionResolve.ts:375

Simulate PlatformEventDistributor’s consumer resolution for one hypothetical event, reimplementing its decision sequence exactly: restrict to subscriptions on the event’s bus, drop IsActive__c: false records (the distributor’s own static SOQL never loads them), apply triggerHandler’s pre-filter, then the matcherRule branch — surfacing the matcher-rule-missing-field NullPointerException hazard as a miss reason rather than throwing, since this is a simulation, not a real invocation.

This is the CLI analogue of resolveBindings — see docs/design/0025’s “The simulator is the reason this family is worth building” section. It shares its field-presence and pre-filter-reachability logic with validatePlatformEventSubscriptions’s matcher-rule-missing-field/unreachable-subscription rules via isMissingMatcherField/hasPreFilterMatchField, so both stay derived from one implementation of the distributor’s control flow rather than two that can drift apart.

There is no priority/sequence field on this CMDT (see docs/design/0025’s “What makes this family shaped differently” section), so matches is returned in scan order — the same flat, unordered-by- design posture list takes, not a resolved winner order.

PlatformEventDistributionInput

The simulated event: which bus it’s on, and its category/eventName values.

RawPlatformEventSubscriptionRecord[]

The scanned subscription records to evaluate, as returned by scanOrgPlatformEventSubscriptions/scanLocalPlatformEventSubscriptions.

PlatformEventDistributionResult

Every subscription on input.eventBus that would receive the event, in scan order, plus every one that wouldn’t and the structured reason why.