-
Notifications
You must be signed in to change notification settings - Fork 14
[WIP] Make NCronJobOptionBuilder expose a fluent interface for untyped job #297
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
c43eebe to
0f1df3a
Compare
|
@linkdotnet Although not 100% ready, I'd be a taker for a first pass of review please.
|
|
@nulltoken I am fine as long as this version still works: public NCronJobOptionBuilder AddJob(
Delegate jobDelegate,
string cronExpression,I think the docs should showcase both and why both versions exist (simplicty over configurability and vice-versa). Currently, it only uses the above version. |
@linkdotnet I understand the need for simplicity. However, both the docs and the README demonstrate Minimal API usage through something like builder.Services.AddNCronJob((ILogger<Program> logger, TimeProvider timeProvider) =>
{
logger.LogInformation("Hello World - The current date and time is {Time}", timeProvider.GetLocalNow());
}, "*/5 * * * * *");How would you feel to keep allowing this inline usage through the Relevant: |
|
That is fair if we keep both of them. I would be not onboard to drop the "string cron" version given that we want to give users the easiest setup possible to do something. Using an options builder already means the user has to know about some defaults (maybe). Whether it is an extension or not is a different topic. I don't see the necessity here, given that everything is in one project anyway. It might make sense to "refactor" them out into a separate package. That said, can you add some docs around the new builder. When to use (aka if you need more fine-grained control). |
0f1df3a to
750a1b2
Compare
|
@linkdotnet I've dropped the deprecations in AddNCronJob() extension and NCronJobBuilder.AddJob(). |
|
@linkdotnet Can we at least deprecate and only keep the following one? I understand the need for simplicity. But once one need a name for a job, I believe the simplicity is done and Thoughts? |
But the jobName is optional, isn't it? The idea behind the job name is solely that users have a way of disabling or re-enabling them later during runtime. Dees the Removing it would not only mean a major breaking change API-wise but also from a feature-set point of view. |
Indeed, so for people not using it, there wouldn't be any change.
I understand that. And the
Deprecating its usage for this overload would raise a warning directing the user to the recommended overload.
Not really as the feature would still exist through the AddJob(Delegate, Action) overload. |
@linkdotnet Have you had the time to gather your thoughts about this deprecation proposal? 😉 |
|
Hey hey @nulltoken - sure I did have some time but also totally forgot about that :D I am still not a fan of forcing users to supply a If the user just needs a way of triggering a job on a frequent base but don't do anything else, why having a name? That we need this internally, might make things easier and we can add some random string, I am fair with that, but don't see much value forcing the user.
That is, to some extent true - but more because of the way the library works. For example quartz returns an object (a trigger) which you can just "disable" easily. |
Pull request description
PR meta checklist
mainbranch for codeCode PR specific checklist