Home > Net >  Quartz in the JobDataMap how to add custom object?
Quartz in the JobDataMap how to add custom object?

Time:11-07

 
Class Program
{
The static void Main (string [] args)
{
StdSchedulerFactory factory=new StdSchedulerFactory ();
IScheduler scheduler=factory. GetScheduler (). The Result;
IJobDetail job=JobBuilder. Create ()
WithIdentity (" jobname1 ", "group1")
WithDescription (" a simple task ")
The Build ();
ITrigger trigger=TriggerBuilder. The Create ()
StartNow ()
. ForJob (job)
UsingJobData (" aaa ", new List {1, 5, 6, 8})//how to add
collection types?WithIdentity (" tname1 ", "group1")
WithSimpleSchedule (x=& gt; X.W ithIntervalInSeconds (1)
WithRepeatCount (3)
The Build ())
The Build ();
The scheduler. The Start ();
The trigger, scheduler. ScheduleJob (job) Wait ();
Console.ReadKey();
}
}
Public class MyJob: IJob
{
Public async Task Execute (IJobExecutionContext context)
{
Await Task. Run (()=& gt;
{
.
Console. WriteLine ();
});
}
}


There is a problem:
1, in the above plan task, how to add a collection type?

CodePudding user response:

CodePudding user response:

No one know?

CodePudding user response:

Does anyone know?

CodePudding user response:

https://blog.csdn.net/qq_38846242/article/details/88650112
  •  Tags:  
  • C#
  • Related