-
Notifications
You must be signed in to change notification settings - Fork 37
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
AspNetCore extensions #28
Comments
I've done as the code example before. Is this approach bad? |
I think you would do it like this: public static class QuartzConfiguratorExtensions
{
// Or you can just use this SchedulerBuilder.PersistentStoreOptions if you really want to use it
// inside UsePersistentStore
public static void UseMongoDbStore(this IServiceCollectionQuartzConfigurator cfg, string connectionString, string collectionPrefix)
{
cfg.SetProperty(StdSchedulerFactory.PropertyJobStoreType, typeof (MongoDbJobStore).AssemblyQualifiedName!);
cfg.SetProperty(
$"{StdSchedulerFactory.PropertyJobStorePrefix}.{StdSchedulerFactory.PropertyDataSourceConnectionString}",
connectionString);
// optional prefix
cfg.SetProperty($"{StdSchedulerFactory.PropertyJobStorePrefix}.collectionPrefix", collectionPrefix);
}
}
// Using it
services.AddQuartz(cfg =>
{
// This library will create it's own MongoClient instance inside
cfg.UseMongoDbStore("mongodb://localhost/quartz", collectionPrefix: "quartz");
});
services.AddQuartzHostedService(); I'm not sure if trying to integrate it with
I'm currently not using Quartz.NET but Hangfire, as I like to test and compare different libraries and Hangfire, has a slightly easier to use API but it can be more limited. Azure functions can also be a good choice but I think can be more costly. Refer to the documentation for property descriptions |
Hi!
Is it possible to use this together with the
Quartz.Extensions.DependencyInjection
?I was thinking of something like this:
How would the extensionmethod UseMongoDb look like?
The text was updated successfully, but these errors were encountered: