Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep only async flow (suspend fun) by removing sync code #26

Closed
osoykan opened this issue Sep 22, 2022 · 4 comments
Closed

Keep only async flow (suspend fun) by removing sync code #26

osoykan opened this issue Sep 22, 2022 · 4 comments
Labels
breaking-change enhancement New feature or request
Milestone

Comments

@osoykan
Copy link
Collaborator

osoykan commented Sep 22, 2022

No description provided.

@CanerPatir
Copy link
Contributor

Hello Oğuzhan,
Sync command bus behaviors had been located to support places where don't supply async manner like Spring Boot @KafkaListener. However, we can handle sync command bus calls over Kotlin's out of the box runSync dispatcher. So It would be great enhancement @osoykan

@bilal-kilic
Copy link
Contributor

I aggre this is a great suggestion to declutter the project.
Maybe we can leave sync implementations on CommandBusImpl to provide an easy way to run sync commands.

override fun <TCommand : Command> executeCommandSync(command: TCommand) = processPipeline(registry.getPipelineBehaviors(), command) {
    runBlocking {
        registry.resolveCommandHandler(command.javaClass).handle(command)
    }
}

@osoykan
Copy link
Collaborator Author

osoykan commented Sep 22, 2022

@CanerPatir 👍

@bilal-kilic The idea of removing the sync implementation is to offload the burden of the runBlocking call to the user; since Kotlin provides that functionality by nature, there is no need to keep/maintain such behavior in the codebase. So, the users can still do what you suggest in your code block.

@osoykan osoykan added this to the 2.0.0 milestone Sep 22, 2022
@osoykan
Copy link
Collaborator Author

osoykan commented Oct 19, 2022

Implemented in v2.0

@osoykan osoykan closed this as completed Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants