Documentation ¶
Index ¶
- func NewCommandHandlerMiddleware() eh.CommandHandlerMiddleware
- func NewEventHandlerMiddleware() eh.EventHandlerMiddleware
- func RegisterContext()
- type EventBus
- type EventStore
- type Outbox
- type Repo
- func (r *Repo) Find(ctx context.Context, id uuid.UUID) (eh.Entity, error)
- func (r *Repo) FindAll(ctx context.Context) ([]eh.Entity, error)
- func (r *Repo) InnerRepo(ctx context.Context) eh.ReadRepo
- func (r *Repo) Remove(ctx context.Context, id uuid.UUID) error
- func (r *Repo) Save(ctx context.Context, entity eh.Entity) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommandHandlerMiddleware ¶
func NewCommandHandlerMiddleware() eh.CommandHandlerMiddleware
NewCommandHandlerMiddleware returns a new command handler middleware that adds tracing spans.
func NewEventHandlerMiddleware ¶
func NewEventHandlerMiddleware() eh.EventHandlerMiddleware
NewEventHandlerMiddleware returns an event handler middleware that adds tracing spans.
func RegisterContext ¶
func RegisterContext()
RegisterContext registers the tracing span to be marshaled/unmarshaled on the context. This enables propagation of the tracing spans for backends that supports it (like Jaeger).
For usage with Elastic APM which doesn't support submitting of child spans for the same parent span multiple times outside of a single transaction don't register the context. This will provide a new context upon handling in the event bus or outbox, which currently is the best Elastic APM can support.
Types ¶
type EventBus ¶
EventBus is an event bus wrapper that adds tracing.
func (*EventBus) AddHandler ¶
func (b *EventBus) AddHandler(ctx context.Context, m eh.EventMatcher, h eh.EventHandler) error
AddHandler implements the AddHandler method of the eventhorizon.EventBus interface.
type EventStore ¶
type EventStore struct {
eh.EventStore
}
EventStore is an eventhorizon.EventStore that adds tracing with Open Tracing.
func NewEventStore ¶
func NewEventStore(eventStore eh.EventStore) *EventStore
NewEventStore creates a new EventStore.
type Outbox ¶
Outbox is an event bus wrapper that adds tracing.
func (*Outbox) AddHandler ¶
func (b *Outbox) AddHandler(ctx context.Context, m eh.EventMatcher, h eh.EventHandler) error
AddHandler implements the AddHandler method of the eventhorizon.Outbox interface.
type Repo ¶
type Repo struct {
eh.ReadWriteRepo
}
Repo is a ReadWriteRepo that adds tracing.
func IntoRepo ¶
IntoRepo tries to convert a eh.ReadRepo into a Repo by recursively looking at inner repos. Returns nil if none was found.
func (*Repo) FindAll ¶
FindAll implements the FindAll method of the eventhorizon.ReadRepo interface.
func (*Repo) InnerRepo ¶
InnerRepo implements the InnerRepo method of the eventhorizon.ReadRepo interface.