sender

package
v0.43.3 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Name = "wathola-sender"
)

Variables

View Source
var (
	// ErrEndpointTypeNotSupported is raised if configured endpoint isn't
	// supported by any of the event senders that are registered.
	ErrEndpointTypeNotSupported = errors.New("given endpoint isn't " +
		"supported by any registered event sender")
)

Functions

func NewCloudEvent

func NewCloudEvent(data interface{}, typ string) cloudevents.Event

NewCloudEvent creates a new cloud event

func NewEventID

func NewEventID() string

NewEventID creates new event ID

func PopulateSpanWithEvent added in v0.29.2

func PopulateSpanWithEvent(ctx context.Context, ce cloudevents.Event, spanName string) (context.Context, *trace.Span)

func RegisterEventSenderWithContext added in v0.29.2

func RegisterEventSenderWithContext(es EventSenderWithContext)

RegisterEventSenderWithContext will register EventSenderWithContext to be used.

func ResetEventSenders added in v0.24.0

func ResetEventSenders()

ResetEventSenders will reset configured event senders to defaults.

func SendEvent

func SendEvent(ctx context.Context, ce cloudevents.Event, endpoint interface{}) error

SendEvent will send cloud event to given url

func Shutdown added in v0.34.0

func Shutdown()

Types

type EndpointSupporter added in v0.29.2

type EndpointSupporter interface {
	// Supports will check given endpoint definition and decide if it's valid for
	// this sender.
	Supports(endpoint interface{}) bool
}

type EventSenderWithContext added in v0.29.2

type EventSenderWithContext interface {
	EndpointSupporter
	// SendEventWithContext will send event to the given endpoint and pass context.
	SendEventWithContext(ctx context.Context, ce cloudevents.Event, endpoint interface{}) error
}

EventSenderWithContext will be used to send events to configured endpoint, passing a context.

type Sender

type Sender interface {
	SendContinually()
}

Sender will send messages continuously until process receives a SIGINT

func New

func New() Sender

New creates new Sender

Jump to

Keyboard shortcuts

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