You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue that is already proposing this?
I have searched the existing issues
Is your feature request related to a problem? Please describe it
I can't use just custom publisher, when I call commandBus.execute() it fails with the error CommandHandlerNotFoundException. So, it forces me to have some kind of mock for the command handler with empty execute method to bypass the previous logic and publish my command to external service
The API design won't be changed, the existing users will still use prior logic without any breaking changes, since all current logic will be moved to default command.
Here is my idea how it can be used. User will define command with custom decorators to reflect destination of command
That's all, under the hood, the user might opt-in any kind queue service, such as SQS, RabbitMQ, etc
What is the motivation / use case for changing the behavior?
I want to use custom publisher for command bus and skip default logic of command handlers with their execute method. As a custom publisher it could be whatever third party service such as bullmq, rabbitmq, etc. But before start implementation of suggested idea, I'd like to hear the idea behind the current implementation for command publisher. From my perspective it has no point where the custom command publisher might be useful. And if I want to fully migrate all my commands to external service, the current implementation forces me to follow only their design. Maybe I didn't catch the idea and considering command publisher in the wrong way, otherwise how I can use external service such as RabbitMQ for my commands?
The text was updated successfully, but these errors were encountered:
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
I can't use just custom publisher, when I call
commandBus.execute()
it fails with the errorCommandHandlerNotFoundException
. So, it forces me to have some kind of mock for the command handler with emptyexecute
method to bypass the previous logic and publish my command to external serviceDescribe the solution you'd like
I think we can refactor
CommandBus.execute
methodcqrs/src/command-bus.ts
Line 57 in 4707341
EventBus.publish
cqrs/src/event-bus.ts
Line 76 in 4707341
execute
method to default command publisher, and inexecute
method just callthis._publisher.publish(command)
Teachability, documentation, adoption, migration strategy
The API design won't be changed, the existing users will still use prior logic without any breaking changes, since all current logic will be moved to default command.
Here is my idea how it can be used. User will define command with custom decorators to reflect destination of command
Then the existing
commandBus
API will be used, but custom publisher will reflect all required metadata from passed commandThe user can define any shape of their handler according to publisher, as an example we can use
@nestjs/microservices
packageThat's all, under the hood, the user might opt-in any kind queue service, such as SQS, RabbitMQ, etc
What is the motivation / use case for changing the behavior?
I want to use custom publisher for command bus and skip default logic of command handlers with their
execute
method. As a custom publisher it could be whatever third party service such as bullmq, rabbitmq, etc. But before start implementation of suggested idea, I'd like to hear the idea behind the current implementation for command publisher. From my perspective it has no point where the custom command publisher might be useful. And if I want to fully migrate all my commands to external service, the current implementation forces me to follow only their design. Maybe I didn't catch the idea and considering command publisher in the wrong way, otherwise how I can use external service such as RabbitMQ for my commands?The text was updated successfully, but these errors were encountered: