Class BasePushNotificationSender

java.lang.Object
org.a2aproject.sdk.server.tasks.BasePushNotificationSender
All Implemented Interfaces:
PushNotificationSender

@ApplicationScoped public class BasePushNotificationSender extends Object implements PushNotificationSender
  • Field Details

  • Constructor Details

  • Method Details

    • sendNotification

      public void sendNotification(StreamingEventKind event, @Nullable Task taskSnapshot)
      Description copied from interface: PushNotificationSender
      Sends a push notification containing a streaming event.

      Called after the event has been persisted to TaskStore. The payload format depends on the protocol version used to register the push notification configuration.

      • v1.0 (default): 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).
      • v0.3: The payload is a v0.3 Task JSON object, using the provided taskSnapshot. Message events are skipped.

      Retrieve push notification URLs or messaging configurations from PushNotificationConfigStore using the task ID extracted from the event.

      Supported event types:

      Error Handling: Log errors but don't throw exceptions. Notifications are best-effort and should not fail the primary request.

      Specified by:
      sendNotification in interface PushNotificationSender
      Parameters:
      event - the streaming event to send.
      taskSnapshot - the current state of the task after the event has been applied. Used by formatters for older protocol versions that require the full task state in notifications.
    • extractTaskId

      protected @Nullable String extractTaskId(StreamingEventKind event)
      Extracts the task ID from a StreamingEventKind event.
      Parameters:
      event - the streaming event
      Returns:
      the task ID, or null if not available