AS AgentScopeAPI 手册 / API Reference

InboundEventDeduplicator

public interface InboundEventDeduplicator
源码Source io/agentscope/extensions/channel/common/InboundEventDeduplicator.java:42–54

定义入站事件 Deduplicator契约的接口。位于 io.agentscope.extensions.channel.common 包。核心成员包括 firstSeen。

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

方法Method说明Description
public boolean firstSeen(String key)
设置该参数。
Records `key` and reports whether this is its first observation.

方法详情Method Detail

firstSeen

public boolean firstSeen(String key)

设置该参数。

Records key and reports whether this is its first observation.

参数Parameters
名称Name类型Type说明Description
keyString键(类型 `String`)。opaque deduplication key composed by the caller; `null` is treated as always first-seen
返回Returns boolean
返回布尔值,表示判断结果。`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
源码Source io/agentscope/extensions/channel/common/InboundEventDeduplicator.java:53
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.