event

package
v1.6.11 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: BSD-3-Clause Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	EnvKeyEventQueueSize  = "FLOGO_EVENT_QUEUE_SIZE"
	DefaultEventQueueSize = 100

	EnvKeyPublishAuditEvents  = "FLOGO_PUBLISH_AUDIT_EVENTS"
	DefaultPublishAuditEvents = true
)

Variables

This section is empty.

Functions

func GetEventQueueSize added in v1.1.0

func GetEventQueueSize() int

GetEventQueues returns the number of queues to buffer events

func HasListener

func HasListener(eventType string) bool

func Post

func Post(eventType string, event interface{})

Puts event with given type and data on the channel

func PublishEventEnabled added in v1.1.0

func PublishEventEnabled() bool

PublishEventEnabled indicate the publish event enabled or not

func RegisterListener

func RegisterListener(name string, listener Listener, eventTypes []string) error

Registers listener for given event types

func UnRegisterListener

func UnRegisterListener(name string, eventTypes []string)

Unregister event listener for given event types . To unregister from all event types, set eventTypes to nil

Types

type Context

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

Context is a wrapper over specific event

func (*Context) GetEvent

func (ec *Context) GetEvent() interface{}

Returns wrapped event data

func (*Context) GetEventType

func (ec *Context) GetEventType() string

Returns event type

type Emitter

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

func (*Emitter) HasListeners

func (te *Emitter) HasListeners() bool

func (*Emitter) Publish

func (te *Emitter) Publish(evtCtx *Context)

func (*Emitter) RegisterListener

func (te *Emitter) RegisterListener(name string, listener Listener) error

func (*Emitter) UnRegisterListener

func (te *Emitter) UnRegisterListener(name string) error

type Listener

type Listener interface {
	// Called when matching event occurs
	HandleEvent(*Context) error
}

Jump to

Keyboard shortcuts

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