If you are using metrics component, you may want to keep backward capability with handler names. In other cases, you can implement your own method of generating handler name.
Keeping backward capability for event handlers:
func (h CommandHandler) HandlerName() string {
return fmt.Sprintf("command_processor-%s", h)
}
Keeping backward capability for command handlers:
func (h EventHandler) HandlerName() string {
return fmt.Sprintf("event_processor-%s", ObjectName(h))
}
From now on, CommandsSubscriberConstructor
and EventsSubscriberConstructor
are passed to constructors in CQRS component.
They allow creating customized subscribers for every handler. For usage examples please check _examples/cqrs-protobuf.
Added missing context, which is passed to Publish function and handlers.
NewCommandProcessor
andNewEventProcessor
now return an error instead of panicDuplicateCommandHandlerError
is returned instead of panic when two handlers are handling the same commandCommandProcessor.routerHandlerFunc
andEventProcessor.routerHandlerFunc
are now private- using
GenerateCommandsTopic
andGenerateEventsTopic
functions instead of constant topic to allow more flexibility
For backward compatibility, when using the constant value you should use a function:
func(topic string) string {
return "routing_key"
}
PoisonQueue
is nowPoisonQueue(pub message.Publisher, topic string) (message.HandlerMiddleware, error)
, not a struct
- From now on, when all handlers are stopped, the router will also stop (
TestRouter_stop_when_all_handlers_stopped
test)