Skip to content

Commit 75e0275

Browse files
Add missing docs for events
Signed-off-by: Peter Broadhurst <[email protected]>
1 parent bbe648c commit 75e0275

File tree

5 files changed

+62
-2
lines changed

5 files changed

+62
-2
lines changed

docs/reference/config.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,47 @@ nav_order: 2
531531
|default|The default event transport for new subscriptions|`string`|`<nil>`
532532
|enabled|Which event interface plugins are enabled|`boolean`|`<nil>`
533533

534+
## events.webhooks
535+
536+
|Key|Description|Type|Default Value|
537+
|---|-----------|----|-------------|
538+
|connectionTimeout|The maximum amount of time that a connection is allowed to remain with no data transmitted|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
539+
|expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s`
540+
|headers|Adds custom headers to HTTP requests|`map[string]string`|`<nil>`
541+
|idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms`
542+
|maxIdleConns|The max number of idle connections to hold pooled|`int`|`100`
543+
|requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
544+
|tlsHandshakeTimeout|The maximum amount of time to wait for a successful TLS handshake|[`time.Duration`](https://pkg.go.dev/time#Duration)|`10s`
545+
546+
## events.webhooks.auth
547+
548+
|Key|Description|Type|Default Value|
549+
|---|-----------|----|-------------|
550+
|password|Password|`string`|`<nil>`
551+
|username|Username|`string`|`<nil>`
552+
553+
## events.webhooks.proxy
554+
555+
|Key|Description|Type|Default Value|
556+
|---|-----------|----|-------------|
557+
|url|Optional HTTP proxy server to connect through|`string`|`<nil>`
558+
559+
## events.webhooks.retry
560+
561+
|Key|Description|Type|Default Value|
562+
|---|-----------|----|-------------|
563+
|count|The maximum number of times to retry|`int`|`5`
564+
|enabled|Enables retries|`boolean`|`false`
565+
|initWaitTime|The initial retry delay|[`time.Duration`](https://pkg.go.dev/time#Duration)|`250ms`
566+
|maxWaitTime|The maximum retry delay|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
567+
568+
## events.websockets
569+
570+
|Key|Description|Type|Default Value|
571+
|---|-----------|----|-------------|
572+
|readBufferSize|WebSocket read buffer size|[`BytesSize`](https://pkg.go.dev/github.com/docker/go-units#BytesSize)|`16Kb`
573+
|writeBufferSize|WebSocket write buffer size|[`BytesSize`](https://pkg.go.dev/github.com/docker/go-units#BytesSize)|`16Kb`
574+
534575
## histograms
535576

536577
|Key|Description|Type|Default Value|

docs/reference/types/_includes/subscription_description.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,12 @@ allowing you to customize your HTTP requests as follows:
167167

168168
- Set the HTTP request details:
169169
- Method, URL, query, headers and input body
170-
- Wait for a successful `2xx` HTTP code from the back-end service, before
171-
acknowledging (default).
170+
- Wait for a invocation of the back-end service, before acknowledging
171+
- To retry requests to your Webhook on a non-`2xx` HTTP status code
172+
or other error, then you should enable and configure
173+
[events.webhooks.retry](../../config.md#eventswebhooksretry)
174+
- The event is acknowledged once the request (with any retries), is
175+
completed - regardless of whether the outcome was a success or failure.
172176
- Use `fastack` to acknowledge against FireFly immediately and make multiple
173177
parallel calls to the HTTP API in a fire-and-forget fashion.
174178
- Set the HTTP request details dynamically from `message_confirmed` events:

internal/coremsgs/en_config_descriptions.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,4 +351,9 @@ var (
351351
ConfigPluginsAuth = ffc("config.plugins.auth", "Authorization plugin configuration", i18n.MapStringStringType)
352352
ConfigPluginsAuthName = ffc("config.plugins.auth[].name", "The name of the auth plugin to use", i18n.StringType)
353353
ConfigPluginsAuthType = ffc("config.plugins.auth[].type", "The type of the auth plugin to use", i18n.StringType)
354+
355+
ConfigPluginsEventSystemReadAhead = ffc("config.events.system.readAhead", "", i18n.IgnoredType)
356+
ConfigPluginsEventWebhooksURL = ffc("config.events.webhooks.url", "", i18n.IgnoredType)
357+
ConfigPluginsEventWebSocketsReadBufferSize = ffc("config.events.websockets.readBufferSize", "WebSocket read buffer size", i18n.ByteSizeType)
358+
ConfigPluginsEventWebSocketsWriteBufferSize = ffc("config.events.websockets.writeBufferSize", "WebSocket write buffer size", i18n.ByteSizeType)
354359
)

internal/events/eifactory/factory.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package eifactory
1919
import (
2020
"context"
2121

22+
"github.com/hyperledger/firefly-common/pkg/config"
2223
"github.com/hyperledger/firefly-common/pkg/i18n"
2324
"github.com/hyperledger/firefly/internal/coremsgs"
2425
"github.com/hyperledger/firefly/internal/events/system"
@@ -41,6 +42,12 @@ func init() {
4142
}
4243
}
4344

45+
func InitConfig(config config.Section) {
46+
for name, plugin := range pluginsByName {
47+
plugin.InitConfig(config.SubSection(name))
48+
}
49+
}
50+
4451
func GetPlugin(ctx context.Context, pluginType string) (events.Plugin, error) {
4552
plugin, ok := pluginsByName[pluginType]
4653
if !ok {

internal/namespace/manager.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ func NewNamespaceManager(withDefaults bool) Manager {
190190
tifactory.InitConfig(tokensConfig)
191191
authfactory.InitConfigArray(authConfig)
192192

193+
// Events still live at the root of the config
194+
eifactory.InitConfig(config.RootSection("events"))
195+
193196
return nm
194197
}
195198

0 commit comments

Comments
 (0)