Versions in this module Expand all Collapse all v0 v0.0.21 Jul 27, 2021 Changes in this version type EventState + func InitializeUnhandledEventState(e *es.Event, bs *es.AggregateBaseSetter, o *Options) (*EventState, error) + func (s *EventState) ResetFailures(handlerName string) error v0.0.20 Jul 16, 2021 Changes in this version + const AggregateType + const EventHandlingFailedTopic + const EventHandlingFailedType + const EventHandlingFinishedTopic + const EventHandlingFinishedType + const EventHandlingStartedTopic + const EventHandlingStartedType + const EventUnhandledTopic + const EventUnhandledType + const FailureCountResetTopic + const FailureCountResetType + var File_eventstate_eventstate_proto protoreflect.FileDescriptor + type EventHandlingFailed struct + Err string + ErrCode int32 + HandlerName string + func (*EventHandlingFailed) Descriptor() ([]byte, []int) + func (*EventHandlingFailed) ProtoMessage() + func (x *EventHandlingFailed) GetErr() string + func (x *EventHandlingFailed) GetErrCode() int32 + func (x *EventHandlingFailed) GetHandlerName() string + func (x *EventHandlingFailed) MessageTopic() string + func (x *EventHandlingFailed) MessageType() string + func (x *EventHandlingFailed) ProtoReflect() protoreflect.Message + func (x *EventHandlingFailed) Reset() + func (x *EventHandlingFailed) String() string + func (x *EventHandlingFailed) Validate() error + type EventHandlingFinished struct + HandlerName string + func (*EventHandlingFinished) Descriptor() ([]byte, []int) + func (*EventHandlingFinished) ProtoMessage() + func (x *EventHandlingFinished) GetHandlerName() string + func (x *EventHandlingFinished) MessageTopic() string + func (x *EventHandlingFinished) MessageType() string + func (x *EventHandlingFinished) ProtoReflect() protoreflect.Message + func (x *EventHandlingFinished) Reset() + func (x *EventHandlingFinished) String() string + func (x *EventHandlingFinished) Validate() error + type EventHandlingStarted struct + HandlerName string + func (*EventHandlingStarted) Descriptor() ([]byte, []int) + func (*EventHandlingStarted) ProtoMessage() + func (x *EventHandlingStarted) GetHandlerName() string + func (x *EventHandlingStarted) MessageTopic() string + func (x *EventHandlingStarted) MessageType() string + func (x *EventHandlingStarted) ProtoReflect() protoreflect.Message + func (x *EventHandlingStarted) Reset() + func (x *EventHandlingStarted) String() string + func (x *EventHandlingStarted) Validate() error + type EventState struct + func InitializeEventState(e *es.Event, bs *es.AggregateBaseSetter, o *Options) (*EventState, error) + func NewEventState(e *es.Event, bs *es.AggregateBaseSetter, o *Options) *EventState + func (s *EventState) AggBase() *es.AggregateBase + func (s *EventState) Apply(e *es.Event) (err error) + func (s *EventState) FinishHandling(handlerName string) error + func (s *EventState) HandlingFailed(handlerName string, handlingErr error) error + func (s *EventState) Reset() + func (s *EventState) SetBase(base *es.AggregateBase) + func (s *EventState) StartHandling(handlerName string) error + type EventStore interface + ChangeTypeOptions func(eventType string, options *Options) + FindFailures func(ctx context.Context, query FindFailureQuery) ([]HandleFailure, error) + FindUnhandled func(ctx context.Context, query FindUnhandledQuery) ([]Unhandled, error) + FinishHandling func(ctx context.Context, e *es.Event, handlerName string) error + HandlingFailed func(ctx context.Context, e *es.Event, handlerName string, handleErr error) error + ListHandlers func(ctx context.Context) ([]Handler, error) + RegisterHandlers func(ctx context.Context, eventHandlers ...Handler) error + StartHandling func(ctx context.Context, e *es.Event, handlerName string) error + type EventUnhandled struct + EventType string + MaxFailures int32 + MaxHandlingTime int64 + MinFailInterval int64 + Timestamp int64 + func (*EventUnhandled) Descriptor() ([]byte, []int) + func (*EventUnhandled) ProtoMessage() + func (x *EventUnhandled) GetEventType() string + func (x *EventUnhandled) GetMaxFailures() int32 + func (x *EventUnhandled) GetMaxHandlingTime() int64 + func (x *EventUnhandled) GetMinFailInterval() int64 + func (x *EventUnhandled) GetTimestamp() int64 + func (x *EventUnhandled) MessageTopic() string + func (x *EventUnhandled) MessageType() string + func (x *EventUnhandled) ProtoReflect() protoreflect.Message + func (x *EventUnhandled) Reset() + func (x *EventUnhandled) String() string + func (x *EventUnhandled) Validate() error + type FailureCountReset struct + HandlerName string + func (*FailureCountReset) Descriptor() ([]byte, []int) + func (*FailureCountReset) ProtoMessage() + func (x *FailureCountReset) GetHandlerName() string + func (x *FailureCountReset) MessageTopic() string + func (x *FailureCountReset) MessageType() string + func (x *FailureCountReset) ProtoReflect() protoreflect.Message + func (x *FailureCountReset) Reset() + func (x *FailureCountReset) String() string + func (x *FailureCountReset) Validate() error + type FindFailureQuery struct + HandlerNames []string + type FindUnhandledQuery struct + HandlerNames []string + type HandleFailure struct + Err string + ErrCode cgerrors.ErrorCode + Event *es.Event + HandlerName string + RetryNo int + Timestamp time.Time + type Handler struct + EventTypes []string + Name string + type Options struct + MaxFailures int + MaxHandlingTime time.Duration + MinFailInterval time.Duration + func DefaultOptions() *Options + func (o *Options) Validate() error + type State int + const StateFailed + const StateFinished + const StateStarted + const StateUndefined + const StateUnhandled + type Storage interface + BeginTx func(ctx context.Context) (TxStorage, error) + type StorageBase interface + FindFailures func(ctx context.Context, query FindFailureQuery) ([]HandleFailure, error) + FindUnhandled func(ctx context.Context, query FindUnhandledQuery) ([]Unhandled, error) + FinishHandling func(ctx context.Context, e *es.Event, handlerName string, timestamp int64) error + HandlingFailed func(ctx context.Context, failure *HandleFailure) error + ListHandlers func(ctx context.Context) ([]Handler, error) + MarkUnhandled func(ctx context.Context, events ...*es.Event) error + RegisterHandlers func(ctx context.Context, eventHandler ...Handler) error + StartHandling func(ctx context.Context, e *es.Event, handlerName string, timestamp int64) error + type Store struct + func NewStore(cfg *es.Config, eventCodec es.EventCodec, snapCodec es.SnapshotCodec, ...) (*Store, error) + func (s *Store) ChangeTypeOptions(eventType string, options *Options) + func (s *Store) Commit(ctx context.Context, aggregate es.Aggregate) error + func (s *Store) FindFailures(ctx context.Context, query FindFailureQuery) ([]HandleFailure, error) + func (s *Store) FindUnhandled(ctx context.Context, query FindUnhandledQuery) ([]Unhandled, error) + func (s *Store) FinishHandling(ctx context.Context, e *es.Event, handlerName string) error + func (s *Store) HandlingFailed(ctx context.Context, e *es.Event, handlerName string, handleErr error) error + func (s *Store) ListHandlers(ctx context.Context) ([]Handler, error) + func (s *Store) RegisterHandlers(ctx context.Context, eventHandlers ...Handler) error + func (s *Store) StartHandling(ctx context.Context, e *es.Event, handlerName string) error + type TxStorage interface + Commit func(ctx context.Context) error + Rollback func(ctx context.Context) error + type Unhandled struct + Event *es.Event + HandlerName string