eventhandling

package
v0.0.0-...-3172301 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokenEchoCloudEventProcessor

type BrokenEchoCloudEventProcessor struct {
	EventSender EventSender
	Sleeper     Sleeper
}

BrokenEchoCloudEventProcessor is an implementation that does wrong event signalling. I.e., it sends a .finished event before a .started event. Useful for testing purposes.

func (BrokenEchoCloudEventProcessor) Process

Process processes a cloud event

type CloudEventProcessor

type CloudEventProcessor interface {
	Process(event cloudevents.Event) error
}

CloudEventProcessor defines a processor on cloud events

type ConfigurableSleeper

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

ConfigurableSleeper sleeps a configured amount of time

func (ConfigurableSleeper) GetSleepDuration

func (c ConfigurableSleeper) GetSleepDuration() time.Duration

func (ConfigurableSleeper) Sleep

func (c ConfigurableSleeper) Sleep()

Sleep pauses the execution

type EchoCloudEventProcessor

type EchoCloudEventProcessor struct {
	EventSender EventSender
	Sleeper     Sleeper
}

EchoCloudEventProcessor is the default implementation of a CloudEventProcessor that hhah

func (EchoCloudEventProcessor) Process

func (ep EchoCloudEventProcessor) Process(event cloudevents.Event) error

Process processes a cloud event

type EventSender

type EventSender interface {

	// SendEvent sends a cloud event
	SendEvent(event cloudevents.Event) error
}

EventSender defines a cloud event sender

func NewHTTPEventSender

func NewHTTPEventSender(svcEndpoint url.URL) EventSender

NewHTTPEventSender creates a new instance of a HTTP based cloud event sender

type HTTPEventSender

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

HTTPEventSender is a HTTP based implementation of a cloud event sender

func (HTTPEventSender) SendEvent

func (es HTTPEventSender) SendEvent(event cloudevents.Event) error

SendEvent sends a cloud event

type Sleeper

type Sleeper interface {
	// Sleep pauses execution
	Sleep()

	// GetSleepDuration returns the current configured sleep duration of the sleeper
	GetSleepDuration() time.Duration
}

Sleeper is responsible to pause execution

func NewConfigurableSleeper

func NewConfigurableSleeper(duration time.Duration, sleepFunc func(time.Duration)) Sleeper

NewConfigurableSleeper returns a new sleeper that will sleep for a specified duration

type TestSleeper

type TestSleeper struct {
}

TestSleeper is an implementation of a Sleeper which pretends to sleep

func (*TestSleeper) GetSleepDuration

func (s *TestSleeper) GetSleepDuration() time.Duration

func (*TestSleeper) Sleep

func (s *TestSleeper) Sleep()

Sleep pauses the execution

Jump to

Keyboard shortcuts

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