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

Add possibility to schedule jobs #466

Open
1 task
manisi opened this issue Nov 18, 2020 · 12 comments
Open
1 task

Add possibility to schedule jobs #466

manisi opened this issue Nov 18, 2020 · 12 comments
Labels

Comments

@manisi
Copy link
Contributor

manisi commented Nov 18, 2020

Overview of the feature request

for execute certain task in the background that should be executed at predefined intervals of time .

Motivation for or Use Case
Related issues or PR
  • Checking this box is mandatory (this is just to show you read everything)
@nicolas63
Copy link
Member

Do you need jhipster for that ? You can use https://www.hangfire.io/.

@manisi
Copy link
Contributor Author

manisi commented Nov 18, 2020

https://www.hangfire.io/

i think embed in jhipster generator like Quartz.net is simpler than hangfire. Thanks

@nicolas63
Copy link
Member

Yes maybe, but what is the added value of generating this part ? Add the nuget and expose the configuration ? If it's just for that I think developers can do it

@manisi
Copy link
Contributor Author

manisi commented Nov 18, 2020

some time the first generated jhipster app need to use execute jobs. for example : the not active user must be deleted before 2 days ago. and the other hand yes add nuget package and use it. Thanks

@nicolas63
Copy link
Member

If you need pre-made it's ok for me
Do you want work on it ?

@manisi
Copy link
Contributor Author

manisi commented Nov 18, 2020

If you need pre-made it's ok for me
Do you want work on it ?

ok ,i hope i can do it .

@nicolas63
Copy link
Member

If you need help, don't hesitate to ping me

@maznag
Copy link
Contributor

maznag commented Jan 21, 2021

We can use integrated .Net Core HostedService to implement background task rather than use of external package

And use of Cronos package to parse Cron expressions and calculating next occurrences.

@nicolas63
Copy link
Member

the main advantage of the hangfire is that you can also have an admin part with the cron states, monitoring etc...
The persistence of the jobs is also a good feature

@ivanmonteiro
Copy link
Contributor

ivanmonteiro commented Jan 21, 2021

It would be interesting if the job scheduler could work properly when we horizontally scale the application (running the app on 3 servers, as example). We don't want the same job running on all servers. That would waste resources and lead to problems.

It seems that hangfire.io supports this scenario: https://docs.hangfire.io/en/latest/background-processing/running-multiple-server-instances.html

What I have not liked about hangfire.io is that the supported storage options are MSSQL and Redis only (https://docs.hangfire.io/en/latest/#job-storage). But I'm not sure it is a problem. I have not used hangfire.io before.

Edit:
It seems that hangfire.io supports many persistent storage options (https://www.hangfire.io/extensions.html).

@ivanmonteiro
Copy link
Contributor

Quartz.Net also seems interesting and worth investigating. It supports job persistence (in memory and database by ado.net), fail retry and, clustering (multi-server).
See: https://www.quartz-scheduler.net/

@ivanmonteiro
Copy link
Contributor

ivanmonteiro commented Jan 22, 2021

My opinion is that the job shceduling solution should:

  • start simple (no need of dependency on redis or external server at first)

And allow more complex scenarios such as:

  • (optionally?) allow persistence - adds robustness tor the application and is useful for server reboots, failover and retry
  • (optionally?) work on multi-server applications. This is optional, but it is important for scalability.

Both hangfire.io and Quartz.Net seems to have its pros and cons.
Quartz.Net seems simple at first with in-memory persistence.
Hangfire.io has more features (dashboard, etc) but the basic setup seems more complex as it needs eiher Redis or database persistence.

@maznag @nicolas63 You both have interesting ideas, please share what you think.

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