Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNilEventProcessorField = errors.New("Registered event processor with one or more nil fields.")
var ErrNoEventProcessorsRegistered = errors.New("No event processors registered - exiting event processing loop")
var ErrNotConnected = errors.New("Not connected to database - call connect first")
Functions ¶
func ClearRegisteredEventProcessors ¶
func ClearRegisteredEventProcessors()
ClearRegisteredEventProcessors clears out the registered event processors. This is useful when testing.
func RegisterEventProcessor ¶
func RegisterEventProcessor(name string, eventProcessor EventProcessor) error
RegisterEventProcessor registers an event processor with OraPub. Event processors registered with OraPub are initialized then receive events when processing the events in the event table.
Types ¶
type EventProcessor ¶
type EventProcessor struct {
Initialize func(*sql.DB) error
Processor func(db *sql.DB, e *goes.Event) error
}
EventProcessor is implemented for hooking into the processing of the events in the event store publish table
type OraPub ¶
type OraPub struct {
LoopExitError error
// contains filtered or unexported fields
}
OraPub provides the ability to process the events in the event store publish table.
func (*OraPub) Connect ¶
Connect creates the database connection with the given connection string and max connection retrys.
func (*OraPub) InitializeProcessors ¶
InitializeProcessors initializes all the processors for registered event handlers.
func (*OraPub) ProcessEvents ¶
ProcessEvents processes the events in the publish table, sending each event to the registered event processors. Event processing is done within a transaction, which is used to isolate the processing of events amidst concurrent event processors. The transaction does not extend to the event processors - if they return errors they will not get another shot at processing the event. Also, if an error occurs causing the transaction to rollback, it is possible the event processor could be invoked with the same event at a later time.