Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 06:22
    devbased review_requested #1710
  • Aug 15 23:21
    devbased commented #1709
  • Aug 15 23:20
    devbased opened #1710
  • Aug 15 17:49
    lahma commented #1709
  • Aug 15 16:48
    devbased opened #1709
  • Aug 15 10:30
    Sicos1977 commented #511
  • Aug 15 10:30
    Sicos1977 commented #511
  • Aug 15 10:23
    adurmus commented #511
  • Aug 15 10:10
    Sicos1977 commented #511
  • Aug 15 10:08
    Sicos1977 commented #511
  • Aug 15 10:07
    Sicos1977 commented #511
  • Aug 15 08:51
    adurmus commented #511
  • Aug 11 14:27
    lahma commented #1453
  • Aug 11 14:26
    lahma commented #1453
  • Aug 11 13:57
    kolpav commented #1453
  • Aug 11 13:56
    kolpav commented #1453
  • Aug 10 23:56
    rogierpennink commented #1453
  • Aug 10 23:52
    rogierpennink commented #1453
  • Aug 09 07:58
    ZLVincent edited #1696
  • Aug 09 07:57
    ZLVincent opened #1696
Marko Lahma
@lahma
Have you tried the MyGet feed for quick remedy?
sylvaingir
@sylvaingir
I didn't know about that, I'll give it a shot. thanks for pointing me to it! :)
Michael
@michaellwest
Thanks for such a great product!
Marko Lahma
@lahma
Glad that you enjoy it :thumbsup:
Michael
@michaellwest
I have a cron trigger scheduled for weekends. If I provide a startat time which is in the past and then run the service, should the weekend schedule fire once?
Marko Lahma
@lahma
Depends. Cannot know if it misfired without persistence
Michael
@michaellwest
Looks like the docs say FireOnceNow is the default which likely applies in my case.
MikoĊ‚aj Kalwa
@mikolajkalwa

Hello, I'll be pretty straightforward. How do I setup Quartz.Net with DI?
I'm trying to follow the docs
https://www.quartz-scheduler.net/documentation/quartz-3.x/packages/hosted-services-integration.html
https://www.quartz-scheduler.net/documentation/quartz-3.x/packages/microsoft-di-integration.html
but I can't manage to make it work.

I added the following piece of code into ConfigureServices method

services.AddQuartz(q =>
                {
                    q.UseMicrosoftDependencyInjectionScopedJobFactory();

                    var jobKey = new JobKey("awesome job", "awesome group");

                    q.AddJob<ExampleJob>(j => j
                        .StoreDurably()
                        .WithIdentity(jobKey)
                        .WithDescription("my awesome job")
                    );

                    q.AddTrigger(t => t
                        .WithIdentity("Simple Trigger")
                        .ForJob(jobKey)
                        .StartNow()
                        .WithSimpleSchedule(x => x.WithInterval(TimeSpan.FromSeconds(10)).RepeatForever())
                        .WithDescription("my awesome simple trigger")
                    );
                })
                .AddQuartzHostedService(options =>
                {
                    options.WaitForJobsToComplete = true;

                })
                .AddTransient<ExampleJob>();

It doesn't throw any exception, the job just never runs. I'm struggeling with it for a few hours.
I'm clearly missing something.

Albert Hives
@ahives
hi I have the same question as @mikolajkalwa
I don't see any examples where it shows setting up the scheduler from the container, etc.
I'm using the following code but it doesn't seem to work
var factory = new StdSchedulerFactory();
var scheduler = await factory.GetScheduler();

await scheduler.Start();

Thread.Sleep(5000);

scheduler.Shutdown(true);
Albert Hives
@ahives
I solved it
@mikolajkalwa just write the following code in your Program.cs
static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .UseSerilog()
                .ConfigureServices((hostContext, services) =>
                {
                    services.AddQuartz(q =>
                    {
...
                    });

                    services.AddTransient<>();

                    services.AddQuartzHostedService(q =>
                    {
                        q.WaitForJobsToComplete = true;
                    });
                });
Reference the following NuGet packages
Microsoft.Extensions.Hosting
Serilog.Extensions.Hosting
Quartz.Extensions.Hosting
then add this line of code in your Main.cs
await CreateHostBuilder(args).Build().RunAsync();
thats it
startewho
@startewho
Hi, i used the quartznet in ioc mode.and when i dynimic add the Job using the refletion. and i found there is only one AddJob<T> method.
so i did a pull requst ,add a method AddJob(Type jobType). becasue my poor English.
and i do not know is my fomart is right?
And aslo it ci in linux test seems wrong,but i check the error message.it seems not my change result the error. and i 'm not sure .so need a helper maybe
Marko Lahma
@lahma
thanks for the the PR! I'd like to see a small tweak to it, otherwise all good. the linux test seems a bit flaky, don't mind about that
startewho
@startewho
hi,may be i found a bug in quartz.net.when i use the msft's di .and i can add job on the startup .when i want to dynimic add a job
it shows add successs,and when it run the job .it show the the error ERROR|Quartz.Core.ErrorLogger|An error occurred instantiating job to be executed. job= 'JG_1.J_2'
it seems that the add normal scheduler does not conisder the di. so there is no info to invoke a instance of job
startewho
@startewho
and i found it maybe a di 's limit .it can not dynimic add JobType
so i fix it like this:when a job type doen't should start ,and i also reg it in the di.when i want it run .it works.
Marko Lahma
@lahma
Akshansh Jain
@akshanshjain95
Hi, while deleting a job using scheduler.deleteJob(jobDetails.getKey());, it takes from 1 sec to 6 sec sometimes. Is this normal? I'm using JobStoreTX and number of rows in JOB_DETAILS and TRIGGERS tables are around 1.5 million only.
Marko Lahma
@lahma
Which database, have you created indexes in the DDL scripts?
Your syntax looks almost like the Java version (this channel is about the .NET version, but same principles apply)
Akshansh Jain
@akshanshjain95

I'm using MySQL db, I don't see any DDL scripts, but from DB i can tell -

PRIMARY KEY (`SCHED_NAME`,`TRIGGER_NAME`,`TRIGGER_GROUP`), KEY `SCHED_NAME` (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`), on QRTZ_TRIGGERS

and

PRIMARY KEY (`SCHED_NAME`,`JOB_NAME`,`JOB_GROUP`) on QRTZ_JOB_DETAILS.

I'm assuming that the tables must have been created initially without the scripts. Not very sure about it as the people worked on it are no longer in contact with us :D

Yes, this is Java code, but couldn't find a Java gitter so asking here.

NirajBhattarai
@NirajBhattarai
Hey guys i am using quartz 3.0 and default dependency injection
i can run services code but having issue when i try to access database
is there any external configuration i need to do for database accesss
Marko Lahma
@lahma
You need create schema at least using the db scripts inder database folder, enable logging to get more info
NirajBhattarai
@NirajBhattarai
can you specify some resource
i wan to save my jobs on ram but want to fetch data from external source and save on db
if i call api from postman its able to save on db
but not with quartnet
Marko Lahma
@lahma
Well if it's just your code accessing db, nothing quartz specific should be needed
Just enable logging if suspect exceptions
NirajBhattarai
@NirajBhattarai
    StackTrace    "   at Quartz.Impl.JobExecutionContextImpl.get_RecoveringTriggerKey()"    string
what does this mean
Marko Lahma
@lahma
impossible to say, that's like 1% of some stack trace