Class ReplicatedQueueManager
java.lang.Object
io.a2a.extras.queuemanager.replicated.core.ReplicatedQueueManager
- All Implemented Interfaces:
QueueManager
@ApplicationScoped
@Alternative
@Priority(50)
public class ReplicatedQueueManager
extends Object
implements QueueManager
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo-args constructor for CDI proxy creation.ReplicatedQueueManager(ReplicationStrategy replicationStrategy, TaskStateProvider taskStateProvider, MainEventBus mainEventBus) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(String taskId, EventQueue queue) voidawaitQueuePollerStart(EventQueue eventQueue) voidcreateOrTap(String taskId) intgetActiveChildQueueCount(String taskId) getEventQueueBuilder(String taskId) voidonReplicatedEvent(ReplicatedEventQueueItem replicatedEvent) voidObserves task finalization events fired AFTER database transaction commits.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.a2a.server.events.QueueManager
createBaseEventQueueBuilder
-
Constructor Details
-
ReplicatedQueueManager
protected ReplicatedQueueManager()No-args constructor for CDI proxy creation. CDI requires a non-private constructor to create proxies for @ApplicationScoped beans. All fields are initialized by the @Inject constructor during actual bean creation. -
ReplicatedQueueManager
@Inject public ReplicatedQueueManager(ReplicationStrategy replicationStrategy, TaskStateProvider taskStateProvider, MainEventBus mainEventBus)
-
-
Method Details
-
add
- Specified by:
addin interfaceQueueManager
-
get
- Specified by:
getin interfaceQueueManager
-
tap
- Specified by:
tapin interfaceQueueManager
-
close
- Specified by:
closein interfaceQueueManager
-
createOrTap
- Specified by:
createOrTapin interfaceQueueManager
-
awaitQueuePollerStart
- Specified by:
awaitQueuePollerStartin interfaceQueueManager- Throws:
InterruptedException
-
onReplicatedEvent
-
onTaskFinalized
Observes task finalization events fired AFTER database transaction commits. This guarantees the task's final state is durably stored before replication. Sends TaskStatusUpdateEvent (not full Task) FIRST, then the poison pill (QueueClosedEvent), ensuring correct event ordering across instances and eliminating race conditions where the poison pill arrives before the final task state. IMPORTANT: We send TaskStatusUpdateEvent instead of full Task to maintain consistency with local event distribution. Clients expect TaskStatusUpdateEvent for status changes, and sending the full Task causes issues in remote instances where clients don't handle bare Task objects the same way they handle TaskStatusUpdateEvent.- Parameters:
event- the task finalized event containing the task ID and final Task
-
getEventQueueBuilder
- Specified by:
getEventQueueBuilderin interfaceQueueManager
-
getActiveChildQueueCount
- Specified by:
getActiveChildQueueCountin interfaceQueueManager
-