Package io.a2a.server.tasks
Class BasePushNotificationSender
java.lang.Object
io.a2a.server.tasks.BasePushNotificationSender
- All Implemented Interfaces:
PushNotificationSender
@ApplicationScoped
public class BasePushNotificationSender
extends Object
implements PushNotificationSender
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo-args constructor for CDI proxy creation.BasePushNotificationSender(PushNotificationConfigStore configStore) BasePushNotificationSender(PushNotificationConfigStore configStore, A2AHttpClient httpClient) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringextractTaskId(StreamingEventKind event) Extracts the task ID from a StreamingEventKind event.voidSends a push notification containing a streaming event.
-
Field Details
-
DEFAULT_PAGE_SIZE
public static final int DEFAULT_PAGE_SIZE- See Also:
-
-
Constructor Details
-
BasePushNotificationSender
protected BasePushNotificationSender()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. -
BasePushNotificationSender
-
BasePushNotificationSender
public BasePushNotificationSender(PushNotificationConfigStore configStore, A2AHttpClient httpClient)
-
-
Method Details
-
sendNotification
Description copied from interface:PushNotificationSenderSends a push notification containing a streaming event.Called after the event has been persisted to
TaskStore. The event is wrapped in a StreamResponse format (per A2A spec section 4.3.3) with the appropriate oneof field set (task, message, statusUpdate, or artifactUpdate).Retrieve push notification URLs or messaging configurations from
Supported event types:PushNotificationConfigStoreusing the task ID extracted from the event.Task- wrapped in StreamResponse.taskMessage- wrapped in StreamResponse.messageTaskStatusUpdateEvent- wrapped in StreamResponse.statusUpdateTaskArtifactUpdateEvent- wrapped in StreamResponse.artifactUpdate
Error Handling: Log errors but don't throw exceptions. Notifications are best-effort and should not fail the primary request.
- Specified by:
sendNotificationin interfacePushNotificationSender- Parameters:
event- the streaming event to send (Task, Message, TaskStatusUpdateEvent, or TaskArtifactUpdateEvent)
-
extractTaskId
Extracts the task ID from a StreamingEventKind event.- Parameters:
event- the streaming event- Returns:
- the task ID, or null if not available
-