Documentation
¶
Overview ¶
Package aggregate provides an adaptor that exposes Dogma aggregate message handlers as Verity handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶
type Adaptor struct {
// Identity is the handler's identity.
Identity *envelopespec.Identity
// Handler is the aggregate message handler that implements the
// application-specific message handling logic.
Handler dogma.AggregateMessageHandler
// Loader is used to load aggregate instances into memory.
Loader *Loader
// Cache is an in-memory cache of aggregate instances.
Cache cache.Cache
// Packer is used to create new parcels for events recorded by the
// handler.
Packer *parcel.Packer
// LoadTimeout is the timeout duration allowed while loading aggregate
// state.
LoadTimeout time.Duration
// Logger is the target for log messages produced within the handler.
// If it is nil, logging.DefaultLogger is used.
Logger logging.Logger
}
Adaptor exposes a dogma.AggregateMessageHandler as a handler.Handler.
func (*Adaptor) HandleMessage ¶
func (a *Adaptor) HandleMessage( ctx context.Context, w handler.UnitOfWork, p parcel.Parcel, ) (err error)
HandleMessage handles the message in p.
type Instance ¶
type Instance struct {
persistence.AggregateMetaData
Root dogma.AggregateRoot
}
Instance is an in-memory representation of the aggregate instance, as stored in the cache.
type Loader ¶
type Loader struct {
// AggregateRepository is the repository used to load an aggregate instance's
// revisions and snapshots.
AggregateRepository persistence.AggregateRepository
// EventRepository is the repository used to load an aggregate instance's
// historical events.
EventRepository persistence.EventRepository
// Marshaler is used to marshal/unmarshal aggregate snapshots and historical
// events,
Marshaler marshaler.Marshaler
}
Loader loads aggregate instances from their historical events.
Click to show internal directories.
Click to hide internal directories.