Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
func (s *NotificationProjector) Execute(ctx context.Context, notification *driverSQL.ProjectionNotification) error
Execute triggers the projections for the notification
type ProcessHandler ¶
type ProcessHandler func(context.Context, *sql.ProjectionNotification, sql.ProjectionTrigger) error
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