publisher

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Publisher

type Publisher interface {
	// Publish a request to a "target". Target's meaning depends on the
	// publisher: it's a URL in the case of a webhook publisher, or a queue
	// name in a queue-based publisher such as NATS.
	Publish(ctx context.Context, body string, headers map[string]string, target string)
}

Publisher interface wraps the Publish method that publishes an request with given "body" and "headers" to given "target"

type WebhookPublisher

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

WebhookPublisher for a single URL. Satisfies the Publisher interface.

func MakeWebhookPublisher

func MakeWebhookPublisher(logger *zap.Logger, baseURL string) *WebhookPublisher

MakeWebhookPublisher creates a WebhookPublisher object for the given baseURL

func (*WebhookPublisher) Publish

func (p *WebhookPublisher) Publish(ctx context.Context, body string, headers map[string]string, target string)

Publish sends a request to the target with payload having given body and headers

Jump to

Keyboard shortcuts

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