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.
NewCommandProcessorandNewEventProcessornow return an error instead of panicDuplicateCommandHandlerErroris returned instead of panic when two handlers are handling the same commandCommandProcessor.routerHandlerFuncandEventProcessor.routerHandlerFuncare now private- using
GenerateCommandsTopicandGenerateEventsTopicfunctions 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"
}PoisonQueueis 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_stoppedtest)