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

simplify task creation with Spring #322

Closed
gpicavet opened this issue Sep 15, 2022 · 3 comments
Closed

simplify task creation with Spring #322

gpicavet opened this issue Sep 15, 2022 · 3 comments

Comments

@gpicavet
Copy link

Hello,

I'm looking for a more resilient way than SpringBoot @async to execute tasks , while keeping task definition and execution easy.

My understanding is i have to create a Task Bean for each Async Job, but it's quite verbose and task must be configured in a separate class.

I think defining one task and executing arbitrary lambda, passing it as data, would come with Serialization problems .

Do you think it would be possible to scan annotations (here @MyAsync), creating one Task for each occurence , and passing them when initializing the scheduler ?

@MyAsync
public void myTask() {
...
}

...
myTask() -> trigger the task scheduling

@kagkarlsson
Copy link
Owner

kagkarlsson commented Sep 16, 2022

That sounds like a good feature. Scanning for annotations and setting up recurring tasks (or one time) for them automatically. And as a side-note, also interested in how easy it is to hook into the Spring @scheduled annotation.

I think defining one task and executing arbitrary lambda, passing it as data, would come with Serialization problems .

Yeah I am not a big fan of that approach if it can be avoided. (if there is a fixed set of tasks)

@kagkarlsson
Copy link
Owner

If this is the feature-request, the title should change :)

@gpicavet gpicavet changed the title executing arbitrary code with one-time Task ? simplify task creation with Spring Sep 17, 2022
@kagkarlsson
Copy link
Owner

Moved to issue #509

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants