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

Quartz Scheduler is not working in v3 #4818

Closed
NightWuYo opened this issue Jan 20, 2024 · 8 comments · Fixed by #4926
Closed

Quartz Scheduler is not working in v3 #4818

NightWuYo opened this issue Jan 20, 2024 · 8 comments · Fixed by #4926
Assignees
Labels
elsa 3 This issue is specific to Elsa 3
Milestone

Comments

@NightWuYo
Copy link
Contributor

In Elsa v3.0.3, I added below code, but the Timer is never triggered.

For Hangire, we have runtime.UseHangfireBackgroundActivityScheduler(), which uses Hangfire to schedule background activities.
But I did not find a similar funciton for Quartz.

// Use timers. elsa.UseQuartz(); elsa.UseScheduling(scheduling => scheduling.UseQuartzScheduler());

@sfmskywalker sfmskywalker added the elsa 3 This issue is specific to Elsa 3 label Jan 20, 2024
@sfmskywalker sfmskywalker added this to the Elsa 3.1 milestone Jan 20, 2024
@stevetayloruk
Copy link
Contributor

+1 on this for us too.

@sfmskywalker sfmskywalker self-assigned this Jan 23, 2024
@sfmskywalker
Copy link
Member

It seems you're trying to use Quartz.NET for scheduling background activities in Elsa 3, similar to what Hangfire offers. You're looking to replace Hangfire's background activity scheduling with Quartz.NET, but facing the fact that there is no such implementation for IBackgroundActivityScheduler. Is that right?

@NightWuYo
Copy link
Contributor Author

@sfmskywalker
Basically, it's right.
The main issue is, with Quartz.NET, the timer is not triggered at all.

I tried Quartz.NET because Hangfire is not working (every instance will trigger timer even the Hangfire is configured to use Redis). Maybe it's because I did not configure it correctly.

The key requirement is, when we have multiple Elsa Server instances, the timers/scheduler can be triggered correctly. Providing working samples would be great.

@NightWuYo
Copy link
Contributor Author

NightWuYo commented Jan 23, 2024

Sorry, I'm not trying to "use Quartz.NET for scheduling background activities".
I have created some workflows through Studio, and these workflows start with a Timer.
I want those Timers/Workflows to be scheduled correctly, when multiple Elsa Servers are deployed.

@NightWuYo
Copy link
Contributor Author

Either Hangfire or Quartz, I just want the scheduler to work correctly (for workflows created in Studio, and starts with a Timer), when multiple instances are running. So Each single workflow will be run exact once at certain time (based on the Timer).

Currently neither of them are working:

  1. With hangfire, the Timer is triggered from all the instances, although I have configured to use the Redis storage.
  2. For Quartz, Timer is never triggered, check Quartz Scheduler is not working in v3 #4818, I guess it's because we lack of UseQuartzBackgroundActivityScheduler (which is not implemented), but not sure.

@sfmskywalker
May I request to prioritize this issue? Providing a working sample project would be good enough.

Otherwise we have to implement an indenpendant service as a Timer and then trigger workflows by HttpEndPoint or MassTransit Message.

@sfmskywalker
Copy link
Member

Thank you for highlighting the issue with Quartz and Hangfire schedulers. I understand the critical nature of this problem for running workflows reliably across multiple instances. While I'd like to address this promptly, my current workload, primarily from commitments to paying customers, limits my immediate availability to tackle this issue in-depth.

I recognize the importance of a working scheduler and will aim to revisit this as soon as possible. In the meantime, I encourage community contributions and discussions for potential workarounds or solutions. Thanks for understanding.

@mohdali
Copy link
Member

mohdali commented Feb 17, 2024

Either Hangfire or Quartz, I just want the scheduler to work correctly (for workflows created in Studio, and starts with a Timer), when multiple instances are running. So Each single workflow will be run exact once at certain time (based on the Timer).

Currently neither of them are working:

  1. With hangfire, the Timer is triggered from all the instances, although I have configured to use the Redis storage.
  2. For Quartz, Timer is never triggered, check Quartz Scheduler is not working in v3 #4818, I guess it's because we lack of UseQuartzBackgroundActivityScheduler (which is not implemented), but not sure.

@sfmskywalker
May I request to prioritize this issue? Providing a working sample project would be good enough.

Otherwise we have to implement an indenpendant service as a Timer and then trigger workflows by HttpEndPoint or MassTransit Message.

When you have multiple servers and want Quartz to work properly you should add some persitence to elsa.UseQuartz() call using the database of your preferences. There were some issue with MySQL/Postgres/SQLServer but those should be already fixed in recent previews.

@NightWuYo
Copy link
Contributor Author

Just got a chance to test, the Quartz scheduler is working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elsa 3 This issue is specific to Elsa 3
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants