Package org.a2aproject.sdk.server.events
Interface MainEventBusProcessorCallback
public interface MainEventBusProcessorCallback
Callback interface for MainEventBusProcessor events.
This interface is primarily intended for testing, allowing tests to synchronize with the asynchronous MainEventBusProcessor. Production code should not rely on this.
Usage in tests:
@Inject
MainEventBusProcessor processor;
@BeforeEach
void setUp() {
CountDownLatch latch = new CountDownLatch(3);
processor.setCallback(new MainEventBusProcessorCallback() {
public void onEventProcessed(String taskId, Event event) {
latch.countDown();
}
});
}
@AfterEach
void tearDown() {
processor.setCallback(null); // Reset to NOOP
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MainEventBusProcessorCallbackNo-op implementation that does nothing. -
Method Summary
Modifier and TypeMethodDescriptionvoidonEventProcessed(String taskId, Event event) Called after an event has been fully processed (persisted, notification sent, distributed to children).voidonTaskFinalized(String taskId) Called when a task reaches a final state (COMPLETED, FAILED, CANCELED, REJECTED).
-
Field Details
-
NOOP
No-op implementation that does nothing. Used as the default callback to avoid null checks.
-
-
Method Details
-
onEventProcessed
Called after an event has been fully processed (persisted, notification sent, distributed to children).- Parameters:
taskId- the task IDevent- the event that was processed
-
onTaskFinalized
Called when a task reaches a final state (COMPLETED, FAILED, CANCELED, REJECTED).- Parameters:
taskId- the task ID that was finalized
-