Is your feature request related to a problem? Please describe.
We are trying to use Quartz in a multitenant application. I found this issue where there was already a request for running separate tenant aware instances of IScheduler.
I also tried overriding QuartzAutofacFactoryModule and using InstancePerTenant as the guy did in the pasted issue but I am getting TenantLifetimeScope errors. So do you have any idea around that?
This is how I tried it:
builder.Register(c =>
{
var ctx = c.Resolve<IComponentContext>();
var lifetimeScope = ctx.Resolve<ILifetimeScope>();
return new AutofacJobFactory(lifetimeScope, _lifetimeScopeTag, JobScopeConfigurator);
})
.AsSelf()
.As<IJobFactory>()
.InstancePerTenant();
builder.Register<ISchedulerFactory>(c => {
var cfgProvider = ConfigurationProvider;
var ctx = c.Resolve<IComponentContext>();
var autofacSchedulerFactory = cfgProvider != null
? new AutofacSchedulerFactory(cfgProvider(ctx), ctx.Resolve<AutofacJobFactory>())
: new AutofacSchedulerFactory(c.Resolve<AutofacJobFactory>());
return autofacSchedulerFactory;
})
.InstancePerTenant();
builder.Register(c => {
var ctx = c.Resolve<IComponentContext>();
var factory = ctx.Resolve<ISchedulerFactory>();
return factory.GetScheduler().ConfigureAwait(false).GetAwaiter().GetResult();
})
.As<IScheduler>()
.InstancePerTenant();
Describe the solution you'd like
It would be great if I get something that is tenant aware so that we could rely on Autofac for Quartz jobs registration. Do you have any suggestions for that?
Is your feature request related to a problem? Please describe.
We are trying to use Quartz in a multitenant application. I found this issue where there was already a request for running separate tenant aware instances of IScheduler. I also tried overriding QuartzAutofacFactoryModule and using InstancePerTenant as the guy did in the pasted issue but I am getting TenantLifetimeScope errors. So do you have any idea around that? This is how I tried it:
Describe the solution you'd like
It would be great if I get something that is tenant aware so that we could rely on Autofac for Quartz jobs registration. Do you have any suggestions for that?