Class: A2A::Store::Webhooks

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/store/webhooks.rb

Overview

Async webhook delivery for A2A push notifications.

Following the gospel (async-http):

- Uses Async::HTTP::Internet for non-blocking HTTP requests
- Each delivery runs in its own Async task (fiber, not thread)
- Failures are logged but do not propagate

The A2A spec says:

- Push notification payloads use StreamResponse format
- Content-Type: application/a2a+json
- Authentication via scheme + credentials from the config
- Token header: X-A2A-Notification-Token
- Delivery is at-least-once with possible retries

Instance Method Summary collapse

Constructor Details

#initializeWebhooks

Returns a new instance of Webhooks.



25
26
27
# File 'lib/a2a/store/webhooks.rb', line 25

def initialize
  @internet = nil
end

Instance Method Details

#deliver(configs, payload) ⇒ Object

Deliver a payload to all push notification configs for a task.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/a2a/store/webhooks.rb', line 34

def deliver(configs, payload)
  return if configs.nil? || configs.empty?

  configs.each do |config|
    Async do
      deliver_single(config, payload)
    rescue => e
      Console.error(self) { "Webhook delivery failed for #{config["url"]}: #{e.message}" }
    end
  end
end