Outbound webhooks: where subscriptions live, where attempts are recorded, how a request leaves the process, and what the rest of an application calls.
Outbound webhooks: where subscriptions live, where attempts are recorded, how a request leaves the process, and what the rest of an application calls.
One row per delivery attempt.
One row per delivery attempt.
(attempt-count this subscription-id event-id)How many attempts were recorded for this subscription and event.
How many attempts were recorded for this subscription and event.
(list-attempts this opts)Attempts, newest first. opts may carry :subscription-id, :event-id,
:limit and :offset.
Attempts, newest first. `opts` may carry `:subscription-id`, `:event-id`, `:limit` and `:offset`.
(record-attempt! this attempt)Insert attempt. Returns it.
Insert `attempt`. Returns it.
Webhook subscriptions. :secret is stored as given; the service encrypts it
before it gets here.
Webhook subscriptions. `:secret` is stored as given; the service encrypts it before it gets here.
(candidate-subscriptions this tenant-id)Active subscriptions that may receive an event of tenant-id: the tenant's
own and those with no tenant. nil tenant-id gives only the latter.
Active subscriptions that may receive an event of `tenant-id`: the tenant's own and those with no tenant. nil `tenant-id` gives only the latter.
(delete-subscription! this id)Delete subscription id. True when one was deleted.
Delete subscription `id`. True when one was deleted.
(find-subscription this id)Subscription id, or nil.
Subscription `id`, or nil.
(list-subscriptions this opts)Subscriptions, newest first. opts may carry :tenant-id (only that
tenant's), :active?, :limit and :offset.
Subscriptions, newest first. `opts` may carry `:tenant-id` (only that tenant's), `:active?`, `:limit` and `:offset`.
(save-subscription! this subscription)Insert subscription, a map with :id. Returns it.
Insert `subscription`, a map with `:id`. Returns it.
(update-subscription! this id changes)Apply changes to subscription id. Returns the updated subscription, or
nil when there is none.
Apply `changes` to subscription `id`. Returns the updated subscription, or nil when there is none.
The module's API.
The module's API.
(change-subscription! this id changes)Change :url, :event-pattern, :active? or :description. Returns
the subscription, nil when absent, or {:error ...}.
Change `:url`, `:event-pattern`, `:active?` or `:description`. Returns
the subscription, nil when absent, or `{:error ...}`.(create-subscription! this input)Validate and store a subscription. input: :url, :event-pattern, and
optionally :tenant-id, :description, :secret. Returns
{:subscription s :secret plaintext} — the only time the secret is
returned — or {:error {:type :validation-error ...}}.
Validate and store a subscription. `input`: `:url`, `:event-pattern`, and
optionally `:tenant-id`, `:description`, `:secret`. Returns
`{:subscription s :secret plaintext}` — the only time the secret is
returned — or `{:error {:type :validation-error ...}}`.(deliver! this args)Make one delivery attempt from a job's args. Returns a jobs handler
result: {:success? true ...} or {:success? false :error ...}, which
the queue retries.
Make one delivery attempt from a job's args. Returns a jobs handler
result: `{:success? true ...}` or `{:success? false :error ...}`, which
the queue retries.(dispatch! this topic event)Enqueue one delivery job per subscription that matches topic and the
event's tenant. Returns the number enqueued.
Enqueue one delivery job per subscription that matches `topic` and the event's tenant. Returns the number enqueued.
(remove-subscription! this id)Delete a subscription. True when one was deleted.
Delete a subscription. True when one was deleted.
(subscriptions this opts)As list-subscriptions, without secrets.
As `list-subscriptions`, without secrets.
Send one HTTP request.
Send one HTTP request.
(send-request! this request)POST request — {:url :headers :body}, and :addresses to connect to
those InetAddresses instead of resolving the host — and return
{:status int :body string :latency-ms long}, or
{:error {:type kw :message string} :latency-ms long} when no response
arrived. Never follows a redirect.
POST `request` — `{:url :headers :body}`, and `:addresses` to connect to
those InetAddresses instead of resolving the host — and return
`{:status int :body string :latency-ms long}`, or
`{:error {:type kw :message string} :latency-ms long}` when no response
arrived. Never follows a redirect.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |