internal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBackgroundWorkStopped occurs when queueing a notification when the BackgroundProcessor was stopped
	ErrBackgroundWorkStopped = errors.New("goengine: unable to queue notification because the processor was stopped")
)

Functions

func AcquireConn

func AcquireConn(ctx context.Context, db *sql.DB) (*sql.Conn, error)

AcquireConn will return a new connection

Types

type BackgroundProcessor

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

BackgroundProcessor provides a way to Trigger a notification using a set of background processes.

func NewBackgroundProcessor

func NewBackgroundProcessor(queueProcessors, queueBuffer int, logger goengine.Logger) (*BackgroundProcessor, error)

NewBackgroundProcessor create a new BackgroundProcessor

func (*BackgroundProcessor) Execute

func (b *BackgroundProcessor) Execute(ctx context.Context, handler ProcessHandler, notification *sql.ProjectionNotification) error

Execute starts the background worker and wait for the notification to be executed

func (*BackgroundProcessor) Queue

func (b *BackgroundProcessor) Queue(ctx context.Context, notification *sql.ProjectionNotification) error

Queue puts the notification on the queue to be processed

func (*BackgroundProcessor) Start

func (b *BackgroundProcessor) Start(ctx context.Context, handler ProcessHandler) func()

Start starts the background processes that will call the ProcessHandler based on the notification queued by Exec

type NotificationProjector

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

NotificationProjector contains the logic for transforming a notification into a set of events and projecting them.

func NewNotificationProjector

func NewNotificationProjector(
	db *sql.DB,
	storage driverSQL.ProjectionStorage,
	projectionStateInit driverSQL.ProjectionStateInitializer,
	projectionStateDecode driverSQL.ProjectionStateDecoder,
	eventHandlers map[string]goengine.MessageHandler,
	eventLoader driverSQL.EventStreamLoader,
	resolver goengine.MessagePayloadResolver,
	logger goengine.Logger,
) (*NotificationProjector, error)

NewNotificationProjector returns a new NotificationProjector

func (*NotificationProjector) Execute

Execute triggers the projections for the notification

type ProcessHandler

ProcessHandler is a func used to trigger a notification but with the addition of providing a Trigger func so the original notification can trigger other notifications

Jump to

Keyboard shortcuts

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