Concurrent command handling
Closed this issue · 1 comments
bounoable commented
Add options to enable concurrent command handling.
Standalone command handler
package example
func example(bus command.Bus) {
h := command.NewHandler(bus)
h.Handle(context.TODO(), "foo", func(ctx command.Context) error { ... }, command.Workers(4))
}
Aggregate-based command handler
package example
type Foo struct {
*aggregate.Base
*handler.BaseHandler
}
func NewFoo(id uuid.UUID) *Foo { ... }
func example(bus command.Bus, repo aggregate.Repository) {
h := handler.New(NewFoo, repo, bus)
h.Handle(context.TODO(), command.Workers(4))
}
bounoable commented
Not needed until now..