-
Notifications
You must be signed in to change notification settings - Fork 412
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
Support task custom arguments #65
Comments
Found another way around it for my application, however this would be a very good feature. |
I'm putting this on "on hold" (for comments and opinions from others). Increasing flexibility may also increase complexity (the more options you give less abstraction you do). |
Please consider supporting 'JobId' which is super useful to identify jobs during schedules. We currently use another scheduler which supports this feature. |
You can assign a name to your schedule, does that work out for you? // Assigning a name in your registry:
Schedule(() => { }).WithName("MySchedule");
// Getting the schedule somewhere else:
var mySchedule = JobManager.GetSchedule("MySchedule"); |
@tallesl, I am afraid, it won't work for us. What we have is a multi-tenant web application which allows you to create a new tenant (website) when you visit the installation page-->"anydomain.com/install". The page would schedule the installation job with a key (or JobId) |
I see. If I change the library to support the following would it work for you? public class WebsiteJob : IJob
{
public string Domain { get; set; }
public void Execute()
{
// do something with the domain
}
}
// somewhere in your running code
var job = new WebsiteJob { Domain = "anydomain.com" };
JobManager.AddJob(job, s => s.ToRunOnceAt(date)); |
@tallesl, this is perfect! |
Implemented on version 4.1.0. Thank you for suggesting the feature guys 👍 |
Amazing job, kudos to you @tallesl! This solution feels better than what I have been using on another library. I am migrating Frapid to CoreCLR. I want to replace the existing task scheduler with FluentScheduler. What is the ETA of this feature to arrive in nuget package? Thanks a million again! |
@frapid It's already on NuGet |
Would be useful to be able to add parameters to a job AND use IoC JobManager.AddJob(s => s.WithParameter("Param1", myParam).ToRunOnceAt(date)); |
I want to dynamically schedule a task with custom arguments.
I was hoping I could do something like below:
However, I found out that this is not valid.
The text was updated successfully, but these errors were encountered: