quartznet / quartznet

Quartz Enterprise Scheduler .NET
http://www.quartz-scheduler.net/
Apache License 2.0
6.5k stars 1.69k forks source link

Feature Request: Built-in Recurrence Rule Trigger #1259

Open tommasopeduzzi opened 3 years ago

tommasopeduzzi commented 3 years ago

Problem I am trying to scheduled tasks, but I only have iCalendar recurrence rules describing how they repeat. Quartz.NET currently doesn't support these rules. This is especially frustrating as there are lots of patterns that can't be expressed as CRON expression but can be expressed as recurrence rules. I have tried writing a converter that goes from recurrence rule to cron, but as stated above there are loads of cases where you just can't express the pattern as a CRON expression.

Solution It would be nice to have a simple trigger like where you could just pass in a recurrence rule and it just works. There was a pull request for the regular Java Quartz Scheduler that wanted to add support for RRules, but is has been closed a while ago.

lahma commented 3 years ago

So would this be something that you would like to champion and possibly implement? If third-party library is needed I guess a separate project/NuGet package would be in order.

tommasopeduzzi commented 3 years ago

I could take a look at it and see if I could implement it, but I think it's possible. I will fork the repo and check it asap. I'll keep you updated!

tommasopeduzzi commented 3 years ago

So I took a look at it and I think this shouldn't be too hard. I was wondering though I could use an existing RecurrenceRule class so I don't have to fight with the parsing. I could use this class by @EWSoftware. But if you prefer I implement this from scratch, I could also do that.

lahma commented 3 years ago

Existing work is OK as it seems that it has permissive license, as long as headers maintained (I'm not a lawyer though) - probably should be internal classes on Quartz side if brought as source. Source files has the benefit of now having dependency which would require separate NuGet package.

EWSoftware commented 3 years ago

My PDI project is licensed using Ms-PL so you can reuse the code here if you like. Just keep the header comments intact with the license notice and link to the original project. I don't have any problems with that.

lahma commented 3 years ago

@EWSoftware thank you for the clarification, great to hear that this is something that we can do. Copyright headers and attributions will be intact if used. Great work by the way 👍🏻

tommasopeduzzi commented 3 years ago

I took a look at the codebase and I will implement it asap (probably in the course of the next week). Thanks to both for the input!