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

Multiple job groups in Quarkus Quartz #44800

Open
AbhishekImp opened this issue Nov 28, 2024 · 11 comments
Open

Multiple job groups in Quarkus Quartz #44800

AbhishekImp opened this issue Nov 28, 2024 · 11 comments
Labels

Comments

@AbhishekImp
Copy link

Description

When there are jobs with multiple groups. How can we run one group jobs on one instance and other group jobs on other instance.

Implementation ideas

No response

@AbhishekImp AbhishekImp added the kind/enhancement New feature or request label Nov 28, 2024
Copy link

quarkus-bot bot commented Nov 28, 2024

/cc @machi1990 (quartz), @manovotn (quartz), @mkouba (quartz)

@mkouba
Copy link
Contributor

mkouba commented Nov 28, 2024

Hi @AbhishekImp and thanks for the report. I wonder if this is even possible with "vanilla" Quartz? I do not think so.

The only workaround I can think of is something along these lines:

  1. Do not use the clustered mode,
  2. Use a config property to define "active" groups/jobs, and
  3. Use @Scheduled#skipExecutionIf() to skip execution for a job that does not match this config property.

(this should work with quarkus-scheduler too)

@AbhishekImp
Copy link
Author

@mkouba : Can we alter or customize the query that we fire to get eligible jobs to be executed

@manovotn
Copy link
Contributor

@mkouba : Can we alter or customize the query that we fire to get eligible jobs to be executed

Not sure I understand, Martin's suggestion should allow you to do just that?

Here's an example test using conditional execution. Yours would be similar except the condition would be based on a config property value which can differ in your deployment.

Or do you fire your jobs in some specific way that doesn't fit this?

@manovotn
Copy link
Contributor

Hi @AbhishekImp and thanks for the report. I wonder if this is even possible with "vanilla" Quartz? I do not think so.

FTR, I also went looking for this in Quartz docs and didn't find anything like it.

@mkouba
Copy link
Contributor

mkouba commented Nov 28, 2024

@mkouba : Can we alter or customize the query that we fire to get eligible jobs to be executed

Not sure I understand, Martin's suggestion should allow you to do just that?

I assume that @AbhishekImp is using persistent jobs (DB) and wants to modify the SQL query used to obtain the active triggers? I don't think that's possible.

The solution I proposed is a bit different in the sense that a job is triggered but the logic (e.g. @Scheduled method) is not executed.

@melloware
Copy link
Contributor

Another option is just separate your Quarkus into two Quarkus apps one that has one set of Quartz jobs and one with the other and it allows you to share the Quartz tables and they are identified by their Instance ID. Not great but its better than anything hacky if you truly want to run jobs on specific instances...

@AbhishekImp
Copy link
Author

AbhishekImp commented Nov 29, 2024 via email

@melloware
Copy link
Contributor

@AbhishekImp maybe you can start by clarifying WHAT you are trying to accomplish?

@AbhishekImp
Copy link
Author

@mkouba @melloware : I have different kinds of jobs of multiple tenants(company). I want to specific different threads for different tenants so that one tenant cannot create a bottleneck for other tenant jobs

@melloware
Copy link
Contributor

Ouch I do not think with Quartz you can do what you want to do. If they are separate tenants they should be seperate Quarkus apps with their own Quartz jobs

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

No branches or pull requests

4 participants