chore: add context and error handling
This commit is contained in:
+5
-4
@@ -1,6 +1,8 @@
|
||||
package graph
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/apex/log"
|
||||
"gitlab.com/unboundsoftware/eventsourced/eventsourced"
|
||||
|
||||
@@ -14,8 +16,7 @@ import (
|
||||
// It serves as dependency injection for your app, add any dependencies you require here.
|
||||
|
||||
type Publisher interface {
|
||||
Publish(event eventsourced.Event) error
|
||||
Stop() error
|
||||
Publish(ctx context.Context, event eventsourced.Event) error
|
||||
}
|
||||
|
||||
type Resolver struct {
|
||||
@@ -25,6 +26,6 @@ type Resolver struct {
|
||||
Cache *cache.Cache
|
||||
}
|
||||
|
||||
func (r *Resolver) handler(aggregate eventsourced.Aggregate) (eventsourced.CommandHandler, error) {
|
||||
return eventsourced.NewHandler(aggregate, r.EventStore, eventsourced.WithEventPublisher(r.Publisher))
|
||||
func (r *Resolver) handler(ctx context.Context, aggregate eventsourced.Aggregate) (eventsourced.CommandHandler, error) {
|
||||
return eventsourced.NewHandler(ctx, aggregate, r.EventStore, eventsourced.WithEventPublisher(r.Publisher))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user