AS AgentScopeAPI 手册 / API Reference

DingTalkChannelRegistry

public final class DingTalkChannelRegistry
源码Source io/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:33–73

DingTalk 渠道注册表,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.dingtalk 包。核心成员包括 instance、register、unregister、get。

Process-wide lookup table from channelId to DingTalkChannel instance. Used by DingTalkCallbackController to dispatch URL-routed requests onto the correct channel.

Channels running in http callback mode register themselves in DingTalkChannel#start() and remove on DingTalkChannel#stop(). The controller obtains the same singleton via #instance() (no Spring wiring required), since the channel is created by io.agentscope.harness.agent.gateway.channel.ChannelFactory's static factory and the controller by Spring's component scan — neither knows about the other ahead of time.

Thread-safe: backed by a ConcurrentHashMap.

方法摘要Method Summary

方法Method说明Description
public static DingTalkChannelRegistry instance()
static
返回实例。
Returns the process-wide singleton instance.
public void register(DingTalkChannel channel)
设置注册。
Registers a channel under its channel id.
public void unregister(String channelId, DingTalkChannel expected)
执行注销相关操作。
Removes the registration for `channelId` only when it currently maps to ` expected`, so a stale instance shutting down cannot detach a successor's registration.
public DingTalkChannel get(String channelId)
按条件读取数据。
Returns the channel registered for `channelId`, or `null` if none.

方法详情Method Detail

instance

public static DingTalkChannelRegistry instance()
static

返回实例。

Returns the process-wide singleton instance.

返回Returns DingTalkChannelRegistry
返回DingTalkChannelRegistry。Returns dingtalk channel registry.
源码Source io/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:42–44

register

public void register(DingTalkChannel channel)

设置注册。

Registers a channel under its channel id.

参数Parameters
名称Name类型Type说明Description
channelDingTalkChannel渠道(类型 `DingTalkChannel`)。The channel.
源码Source io/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:51–59

unregister

public void unregister(String channelId, DingTalkChannel expected)

执行注销相关操作。

Removes the registration for channelId only when it currently maps to expected, so a stale instance shutting down cannot detach a successor's registration.

参数Parameters
名称Name类型Type说明Description
channelIdString渠道标识(类型 `String`)。The channel id.
expectedDingTalkChannelexpected(类型 `DingTalkChannel`)。The expected.
源码Source io/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:65–67

get

public DingTalkChannel get(String channelId)

按条件读取数据。

Returns the channel registered for channelId, or null if none.

参数Parameters
名称Name类型Type说明Description
channelIdString渠道标识(类型 `String`)。The channel id.
返回Returns DingTalkChannel
返回DingTalkChannel。Returns dingtalk channel.
源码Source io/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:70–72
基于官方固定版本源码静态生成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.