AWS MARKETPLACE PUBLISHER

Testing design

Testing Duplicate, Delayed, and Out-of-Order Marketplace Events

Published:

Key takeaways

Check event receipt separately from applying the correct state to the correct tenant, including retries and interrupted side effects.

Editorial information. This article was translated into English by AI from Deshima’s Japanese article; it has not been reviewed or certified by AWS. The linked AWS documentation is current as of November 10, 2026.

Scope: Teams implementing and maintaining AWS Marketplace SaaS integrations. The article distinguishes Contract, Subscription, and Contract with Consumption where applicable. Design examples and proposed tests are Deshima’s own recommendations, not AWS guidance. Confirm actual event delivery with a test purchase of your own product in Limited visibility, the listing state in which only your seller account and allowlisted AWS accounts can view the product (see AWS’s SaaS product settings page).

Suppose sales planning cancels an analytics SaaS purchased through the procurement AWS account it shares with R&D. After sales planning's license A is stopped, an older update arrives. If the handler simply saves the notification's contents, it could reactivate A. Processing events in receipt order does not establish which business state is newer.

A test can create this case by changing the input order. In addition to processing one normal notification, test duplicates, delays, and interrupted processing separately, then inspect persisted state and outbound notifications. The input sequences below are Deshima’s test design for your application. Amazon EventBridge’s retry policy page describes retrying failed deliveries with backoff, and AWS’s EventBridge integration page for SaaS products lists the event types without stating a delivery order, so test duplicates, delays, and reordering instead of assuming one order. If your design depends on a particular order, ask AWS Marketplace Seller Operations, AWS’s support team for sellers, before relying on it.

Reconcile after an older notification

For Contract-based products, a handler can retrieve current entitlements from GetEntitlements after a notification. In the example, rereading current entitlements avoids reactivating A solely from the old notification. For Subscription products, AWS’s subscription integration guide excludes that API; use the start/end notifications and verification approach applicable to that model.

However, adding a reread does not by itself resolve update races. Two workers can retrieve results from different moments and save the older result last. Choose a way to control retrieval and application order, such as serializing work per license, and test that race too.

AWS’s EventBridge integration page for SaaS products distinguishes commercial agreement notifications from license notifications. Separating agreement-record updates from access-right updates makes it explicit which state each notification prompts you to reconcile.

Processing stops after the database update

Recording received event IDs may not be sufficient for duplicate handling. Consider a handler that updates the database and then emails the customer. If the worker stops before sending, skipping the entire replay as “already processed” loses the email. Sending on every replay can instead produce duplicates.

Inspect database state and email progress separately. An outbox that records intended delivery alongside the database update is one design option. The process that sends from the outbox needs its own duplicate handling, because it can stop after sending but before recording the send; include that step in the interruption tests. The test should identify which interruption points your chosen design can recover from.

Input order and interruption cases

Input or injected failureState to inspectSide effects to inspect
Send the same event ID twiceSame as one deliveryNo duplicate creation, notification, or entitlement addition
Send the same business content with another IDSame state after reconciliationDoes not rely solely on ID deduplication
Send an old update after terminationReconcile current entitlementsNo invalid reactivation notification
Time out state retrievalDo not confuse retrieval failure with no entitlementsRetain retry or pending-review work
Stop the worker immediately after the DB updateConsistency after recoveryDetect omissions and duplicates
Interleave A's termination and B's updateIndependent assignmentsNo impact on another tenant

Record the expected license and tenant separately from the target actually updated. Successful handler completion does not satisfy the test if it modified the wrong target. Design logs around the identifiers needed for comparison, without saving complete registration tokens or personal data.

Replay after delivery failure

Amazon EventBridge provides retry policies and dead-letter queues when delivery to a target fails with a retryable error. A DLQ stores events that could not be delivered. A recovery test should verify that an event reaches it, fix the cause, replay the event, and check that the business state becomes correct.

An operator might have repaired state manually before replay. Reconcile against current state during replay so an old event does not undo that repair. Evaluate recovery using both the queue backlog and database/outbound-notification results.

The CI sample covers duplicates, stale updates (an older revision number in the sample’s teaching model, a small stand-in for application logic), and license isolation. It does not cover real delivery, database races, or DLQ recovery; add those as tests connected to your application. See Concurrent Agreements and tenant mapping for identifiers, and the regression matrix for case management.