redis

package
v0.0.0-...-1759ba1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCouldNotMarshalEvent = errors.New("could not marshal event")

ErrCouldNotMarshalEvent is when an event could not be marshaled into BSON.

View Source
var ErrCouldNotUnmarshalEvent = errors.New("could not unmarshal event")

ErrCouldNotUnmarshalEvent is when an event could not be unmarshaled into a concrete type.

View Source
var ErrEventNotRegistered = errors.New("event not registered")

ErrEventNotRegistered is when an event is not registered.

Functions

This section is empty.

Types

type EventBus

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

EventBus is an event bus that notifies registered EventHandlers of published events.

func NewEventBus

func NewEventBus(appID, server, password string) (*EventBus, error)

NewEventBus creates a EventBus for remote events.

func NewEventBusWithPool

func NewEventBusWithPool(appID string, pool *redis.Pool) (*EventBus, error)

NewEventBusWithPool creates a EventBus for remote events.

func (*EventBus) AddGlobalHandler

func (b *EventBus) AddGlobalHandler(handler eventhorizon.EventHandler)

AddGlobalHandler adds a handler for global (remote) events.

func (*EventBus) AddHandler

func (b *EventBus) AddHandler(handler eventhorizon.EventHandler, event eventhorizon.Event)

AddHandler adds a handler for a specific local event.

func (*EventBus) AddLocalHandler

func (b *EventBus) AddLocalHandler(handler eventhorizon.EventHandler)

AddLocalHandler adds a handler for local events.

func (*EventBus) Close

func (b *EventBus) Close()

Close exits the recive goroutine by unsubscribing to all channels.

func (*EventBus) PublishEvent

func (b *EventBus) PublishEvent(event eventhorizon.Event)

PublishEvent publishes an event to all handlers capable of handling it.

func (*EventBus) RegisterEventType

func (b *EventBus) RegisterEventType(event eventhorizon.Event, factory func() eventhorizon.Event) error

RegisterEventType registers an event factory for a event type. The factory is used to create concrete event types when receiving from subscriptions.

An example would be:

eventStore.RegisterEventType(&MyEvent{}, func() Event { return &MyEvent{} })

Jump to

Keyboard shortcuts

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