From 66c0d6b22da536ffcefb16dbd65a8d1216c49e94 Mon Sep 17 00:00:00 2001 From: Enrique Lacal Date: Wed, 12 Jul 2023 14:03:58 +0100 Subject: [PATCH 1/3] docs: Add webhook batching and update retry Signed-off-by: Enrique Lacal --- .../types/_includes/subscription_description.md | 17 +++++++++++++++-- docs/reference/types/subscription.md | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/reference/types/_includes/subscription_description.md b/docs/reference/types/_includes/subscription_description.md index 90bcc7cd1..dd1abd2bf 100644 --- a/docs/reference/types/_includes/subscription_description.md +++ b/docs/reference/types/_includes/subscription_description.md @@ -169,8 +169,8 @@ allowing you to customize your HTTP requests as follows: - Method, URL, query, headers and input body - Wait for a invocation of the back-end service, before acknowledging - To retry requests to your Webhook on a non-`2xx` HTTP status code - or other error, then you should enable and configure - [events.webhooks.retry](../../config.html#eventswebhooksretry) + or other error, you should enable and configure + [options.retry](#webhookretryoptions) - The event is acknowledged once the request (with any retries), is completed - regardless of whether the outcome was a success or failure. - Use `fastack` to acknowledge against FireFly immediately and make multiple @@ -186,3 +186,16 @@ allowing you to customize your HTTP requests as follows: based on a field in the input request data. +#### Batching events + +Webhooks have the ability to batch events into a single HTTP request instead of sending an event per HTTP request. The interface will be a JSON array of events instead of a top level JSON object with a single event. The size of the batch will be set by the `readAhead` limit and an optional timeout can be specified to send the events when the batch hasn't filled. + +To enable this set the following configuration under [SubscriptionOptions](#SubscriptionOptions) + +`batch` | Events are delivered in batches in an ordered array. The batch size is capped to the readAhead limit. The event payload is always an array even if there is a single event in the batch. Commonly used with Webhooks to allow events to be delivered and acknowledged in batches. | `bool` | + +`batchTimeout` | When batching is enabled, the optional timeout to send events even when the batch hasn't filled. Defaults to 2 seconds | `string` + + +**NOTE**: When batch is enabled, `withData` cannot be used as these may alter the HTTP request based on a single event and in batching it does not make sense for now. + diff --git a/docs/reference/types/subscription.md b/docs/reference/types/subscription.md index 0a7717fad..3e07c5c6a 100644 --- a/docs/reference/types/subscription.md +++ b/docs/reference/types/subscription.md @@ -20,7 +20,7 @@ nav_order: 3 {% include_relative _includes/subscription_description.md %} -### Example +### Example Subscription ```json { From 57b1233d07700273ea8c97f18d3f20cf0fc98c55 Mon Sep 17 00:00:00 2001 From: SamMayWork Date: Thu, 22 Feb 2024 10:39:48 +0000 Subject: [PATCH 2/3] fix: fix broken links Signed-off-by: SamMayWork --- docs/reference/types/_includes/subscription_description.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/types/_includes/subscription_description.md b/docs/reference/types/_includes/subscription_description.md index dd1abd2bf..f28893f00 100644 --- a/docs/reference/types/_includes/subscription_description.md +++ b/docs/reference/types/_includes/subscription_description.md @@ -170,7 +170,7 @@ allowing you to customize your HTTP requests as follows: - Wait for a invocation of the back-end service, before acknowledging - To retry requests to your Webhook on a non-`2xx` HTTP status code or other error, you should enable and configure - [options.retry](#webhookretryoptions) + [options.retry](../subscription.html#webhookretryoptions) - The event is acknowledged once the request (with any retries), is completed - regardless of whether the outcome was a success or failure. - Use `fastack` to acknowledge against FireFly immediately and make multiple @@ -190,7 +190,7 @@ allowing you to customize your HTTP requests as follows: Webhooks have the ability to batch events into a single HTTP request instead of sending an event per HTTP request. The interface will be a JSON array of events instead of a top level JSON object with a single event. The size of the batch will be set by the `readAhead` limit and an optional timeout can be specified to send the events when the batch hasn't filled. -To enable this set the following configuration under [SubscriptionOptions](#SubscriptionOptions) +To enable this set the following configuration under [SubscriptionOptions](../subscription.html#subscriptionoptions) `batch` | Events are delivered in batches in an ordered array. The batch size is capped to the readAhead limit. The event payload is always an array even if there is a single event in the batch. Commonly used with Webhooks to allow events to be delivered and acknowledged in batches. | `bool` | From ad8a6f55eeacd6e4dd478d6089cb2085241589b6 Mon Sep 17 00:00:00 2001 From: Enrique Lacal Date: Tue, 9 Apr 2024 16:11:40 +0100 Subject: [PATCH 3/3] fix: make reference Signed-off-by: Enrique Lacal --- docs/reference/types/subscription.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/types/subscription.md b/docs/reference/types/subscription.md index 3bf709bf9..584fb45c5 100644 --- a/docs/reference/types/subscription.md +++ b/docs/reference/types/subscription.md @@ -20,7 +20,7 @@ nav_order: 3 {% include_relative _includes/subscription_description.md %} -### Example Subscription +### Example ```json {