AgentProtocolTaskEventBus
public final class AgentProtocolTaskEventBus implements AgentProtocolEventBus
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:31–91智能体协议任务事件总线,为框架提供通用类型与基础能力。位于 io.agentscope.extensions.agentprotocol 包,实现 AgentProtocolEventBus。核心成员包括 publish、subscribe、complete、AgentProtocolTaskEventBus。
Per-task event bus for Agent Protocol SSE streaming. Uses a replay buffer so late subscribers /
reconnects can catch up from fromSeq.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public AgentProtocolTaskEventBus() | 初始化 `AgentProtocolTaskEventBus` 实例。 Creates a new instance. |
public AgentProtocolTaskEventBus(int replayBufferSize) | 初始化 `AgentProtocolTaskEventBus` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public RemoteAgentEvent publish(String taskId, RemoteAgentEvent event) | 执行发布相关操作。 Publishes an event, assigning a monotonic `seq`. |
public Flux<RemoteAgentEvent> subscribe(String taskId, long fromSeq) | 执行订阅相关操作。 Subscribes to events for `taskId`, optionally skipping those with `seq <=
fromSeq`. |
public void complete(String taskId) | 设置该参数。 Completes and removes the channel after a terminal event has been published. |
构造器详情Constructor Detail
AgentProtocolTaskEventBus
public AgentProtocolTaskEventBus()
初始化 AgentProtocolTaskEventBus 实例。
Creates a new instance.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:38–40AgentProtocolTaskEventBus
public AgentProtocolTaskEventBus(int replayBufferSize)
初始化 AgentProtocolTaskEventBus 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
replayBufferSize | int | replay Buffer 大小(类型 `int`)。The replay buffer size. |
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:42–44方法详情Method Detail
publish
public RemoteAgentEvent publish(String taskId, RemoteAgentEvent event)
执行发布相关操作。
Publishes an event, assigning a monotonic seq.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
event | RemoteAgentEvent | 事件(类型 `RemoteAgentEvent`)。The event. |
RemoteAgentEvent返回RemoteAgentEvent。Returns remote agent event.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:47–58subscribe
public Flux<RemoteAgentEvent> subscribe(String taskId, long fromSeq)
执行订阅相关操作。
Subscribes to events for taskId, optionally skipping those with seq <= fromSeq.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
fromSeq | long | 来自 Seq(类型 `long`)。The from seq. |
Flux<RemoteAgentEvent>返回Flux。Returns flux.
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:64–72complete
public void complete(String taskId)
设置该参数。
Completes and removes the channel after a terminal event has been published.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
taskId | String | 任务标识(类型 `String`)。The task id. |
源码Source
io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:75–81