notifications

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package notifications provides webhook delivery with retry and delivery tracking. It demonstrates all plugin API patterns: host functions, HTTP routes, database migrations, and background workers.

Webhooks are HTTP POST deliveries with HMAC-SHA256 signing. Retries use exponential backoff (1m, 5m, 15m, 1h) up to 10 attempts, at which point the delivery is marked as failed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() plugin.Plugin

New creates a new Plugin instance.

Types

type Config

type Config struct {
}

Config controls notifications plugin behaviour.

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin implements webhook delivery with retry and delivery tracking.

func (*Plugin) Info

func (p *Plugin) Info() plugin.PluginInfo

Info returns plugin metadata for discovery and documentation.

func (*Plugin) Init

func (p *Plugin) Init(ctx context.Context, env *plugin.Environment) error

Init initializes the plugin with the given environment. It parses optional configuration and creates an HTTP client with a 30-second timeout.

func (*Plugin) Migrations

func (p *Plugin) Migrations() []plugin.Migration

Migrations returns the database schema for webhook storage and delivery tracking. Tables are idempotent (IF NOT EXISTS) and safe to run multiple times.

func (*Plugin) RegisterHostFunctions

func (p *Plugin) RegisterHostFunctions(scope plugin.FuncRegistry) error

RegisterHostFunctions registers workflow-callable functions on the scoped function registry. The plugin name is implicit -- each plugin gets its own scope, so function names need not be globally unique.

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(mux *http.ServeMux) error

func (*Plugin) Run

func (p *Plugin) Run(ctx context.Context) error

Run starts the delivery retry loop. It runs every 30 seconds, finding undelivered webhook deliveries whose next_attempt_at <= now() and attempting HTTP POST delivery. Returns when ctx is cancelled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL