event

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 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 EventHandler

type EventHandler interface {
	HandleEvent(*api.EventMsg)
	GetHandlerType() string
	GetClient() EventHandlerClient
}

type EventHandlerClient

type EventHandlerClient interface {
	// TODO: CallOption?
	HandleEvent(ctx context.Context, in *api.EventMsg, opts ...grpc.CallOption) (*api.EventResponse, error)
}

type Events

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

Type Events is responsible for event publishing and processing. Currently, it has a hard-coded map of events to event handlers. When an event is published, Events gets the event off its input channel and matches the event with the correct handler function. Handler functions are started in their own goroutines.

func NewEvents

func NewEvents(cfg *config.EventConfig, cf *secureconn.Factory) *Events

func (Events) Publish

func (svc Events) Publish(event *api.EventMsg)

Other services call publish on the event service api in order to notify the rest of the system of an event. Services should fire events in their own goroutines so that they are not blocked if the event input queue is full.

func (Events) Start

func (svc Events) Start(r map[string][]string)

Listen for events on the input channel until event-service is terminated.

func (Events) Stop

func (svc Events) Stop()

Jump to

Keyboard shortcuts

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