Interface InboundEventDeduplicator

All Known Implementing Classes:
IdempotencyStore

public interface InboundEventDeduplicator
Deduplicates inbound platform events across redeliveries.

Channel adapters consult this before processing an inbound event: delivery platforms (WeCom, DingTalk, GitHub, GitLab, ...) redeliver the same event when no timely acknowledgment is received, and each redelivery must execute at most once.

Keys are opaque and caller-composed — typically channelId + "|" + platformEventId. Implementations backed by shared storage should namespace keys per deployment (for example with an environment or application prefix): platform event ids are only unique within one channel deployment, and a key shared by two deployments silently drops live traffic.

The default IdempotencyStore keeps state in the JVM heap, which only deduplicates within a single process: a redelivery that lands on another instance, or after a restart, is not recognized. Deployments running multiple channel instances should provide an implementation backed by shared storage (for example a Redis SET ... NX EX keyed by channel and platform event id). Injection today is programmatic: channels expose a fromProperties(channelId, routing, rawProperties, InboundEventDeduplicator) factory overload for hand-wired setups, while the config-driven path (agentscope.json resolved through the harness ChannelFactory) constructs channels with the default process-local store.

Implementations must be thread-safe: channels invoke firstSeen(String) from concurrent callback threads.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Records key and reports whether this is its first observation.
  • Method Details

    • firstSeen

      boolean firstSeen(String key)
      Records key and reports whether this is its first observation.
      Parameters:
      key - opaque deduplication key composed by the caller; null is treated as always first-seen
      Returns:
      true when key has not been observed within the implementation's retention horizon and the caller should process the event; false when it is a redelivery and must be dropped