webhook

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package webhook posts an arbitrary JSON envelope to a configured URL. Used when the consumer side is another HTTP service (an internal scoreboard, a downstream worker) rather than a person.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL        string
	Headers    map[string]string
	HTTPClient *http.Client // optional
}

Config configures the outbound POST.

type Recipient

type Recipient struct {
	URL string
}

Recipient lets the caller override the URL per-call. URL == "" means "use the config URL".

type Sink

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

Sink posts to a webhook endpoint.

func New

func New(cfg Config) (*Sink, error)

New constructs a Sink. URL is required.

func NewNamed

func NewNamed(name string, cfg Config) (*Sink, error)

NewNamed constructs a Sink with a custom name. Used by the factory.

func (*Sink) DecodeRecipient

func (s *Sink) DecodeRecipient(raw []byte) (sinks.Recipient, error)

DecodeRecipient round-trips a persisted DLQ recipient back into the typed Recipient. Used by RedisDLQ.Replay.

func (*Sink) Name

func (s *Sink) Name() string

Name returns the registry key.

func (*Sink) Send

func (s *Sink) Send(ctx context.Context, to sinks.Recipient, m sinks.Message) error

Send posts m as JSON. If to is a Recipient with a non-empty URL, that URL overrides the configured one.

Jump to

Keyboard shortcuts

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