DingTalkChannelRegistry
public final class DingTalkChannelRegistry
io/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:33–73DingTalk 渠道注册表,把智能体接入外部消息渠道与企业平台。位于 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()
返回实例。
Returns the process-wide singleton instance.
DingTalkChannelRegistryio/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:42–44register
public void register(DingTalkChannel channel)
设置注册。
Registers a channel under its channel id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channel | DingTalkChannel | 渠道(类型 `DingTalkChannel`)。The channel. |
io/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:51–59unregister
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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
expected | DingTalkChannel | expected(类型 `DingTalkChannel`)。The expected. |
io/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:65–67get
public DingTalkChannel get(String channelId)
按条件读取数据。
Returns the channel registered for channelId, or null if none.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
DingTalkChannelio/agentscope/extensions/channel/dingtalk/DingTalkChannelRegistry.java:70–72