Skip to main content

Deduplication

EDS guarantees at-least-once delivery — duplicates can occur; your client must handle them safely.

Visibility Timeout​

EDS uses a 30-second visibility timeout. When an event is delivered to your client, the underlying message becomes temporarily invisible. If your client does not acknowledge the event within 30 seconds, the message becomes visible again and is redelivered with the same eventId but a new receiptId.

eventId vs receiptId​

Two identifiers appear on every EVENT frame:

FieldStable?Purpose
eventIdYes — same across all redeliveriesUse this to detect duplicates
receiptIdNo — changes on every delivery attemptUse this in the ack frame

To deduplicate: maintain a set of eventId values your client has already processed. Before acting on an event, check whether its eventId is in the set. If it is, skip the business logic but still send an ack (see below).

const seenEventIds = new Set()

function handleEvent(payload) {
const { eventId, receiptId, eventType } = payload

const isDuplicate = seenEventIds.has(eventId)

if (!isDuplicate) {
seenEventIds.add(eventId)
processEvent(eventType, payload) // your business logic
}

// Always ack, even for duplicates
sendAck(receiptId)
}

Always Acknowledge Duplicates​

Even when you detect a duplicate, you must send an ACK_EVENT with the receiptId. Failing to acknowledge leaves the message in the queue, which causes it to be redelivered again after the visibility timeout expires — creating an infinite loop of duplicates.

The rule is: acknowledge the receiptId, deduplicate on the eventId.

Best Practices​

  • Acknowledge promptly — send ACK_EVENT once the event is durably recorded, not after downstream processing.
  • Decouple receiving from processing — buffer events locally and process asynchronously to stay well within the 30-second window.
  • Expect redeliveries on reconnect — unacknowledged in-flight events are redelivered; use eventId deduplication.