Skip to content

[Feature] Automatically create jobs if Spring Bean is annotated with @Job annotation #977

Open
@rdehuyss

Description

Is your feature request related to a problem? Please describe.
I'm always frustrated when I need to write boilerplate code. I'm not a fan of always repeating:

jobScheduler.enqueue(() -> emailClient.send(to));

Describe the solution you'd like
The idea would be that you could annotate an interface and spring could create a proxy so that when you invoke a method on an implementation of that interface it schedules a job for you (to be run).

@JobGateway // or @Async
interface EmailClient {
 @Job(name =“sendEmail”) 
 void send(String to); 
}

Describe alternatives you've considered
🤔 can't think of anything else...

Additional context
Reported by @joshlong

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions