I have a job which needs to kick off some methods on another object. I\'d like to be able to pass these into the job in its constructor.
Looking around, it seems tha
You need to use JobFactory:
internal sealed class IntegrationJobFactory : IJobFactory
{
private readonly IUnityContainer _container;
public IntegrationJobFactory(IUnityContainer container)
{
_container = container;
}
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var jobDetail = bundle.JobDetail;
var job = (IJob)_container.Resolve(jobDetail.JobType);
return job;
}
public void ReturnJob(IJob job)
{
}
}
And use it:
var _scheduler = schedulerFactory.GetScheduler();
var _scheduler.JobFactory = new IntegrationJobFactory(container);