Open Closed

Issues with IBackgroundJobManager #3157


User avatar
0
PSTEELNZ created
  • ABP Framework version: v5.3.0-rc.1
  • UI type: Angular
  • DB provider: EF Core
    • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

When Injecting IBackgroundManager into an AppService as per the documentation I receive the following Exception:

Error [10:48:53 ERR] ---------- RemoteServiceErrorInfo ---------- { "code": null, "message": "An internal error occurred during your request!", "details": null, "data": { "ActivatorChain": "Castle.Proxies.AchievementRegistersAppServiceProxy" }, "validationErrors": null }

[10:48:53 ERR] An exception was thrown while activating Castle.Proxies.AchievementRegistersAppServiceProxy. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Castle.Proxies.AchievementRegistersAppServiceProxy. ---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Castle.Proxies.AchievementRegistersAppServiceProxy' can be invoked with the available services and parameters: Cannot resolve parameter 'Abp.BackgroundJobs.IBackgroundJobManager backgroundJobManager' of constructor 'Void .ctor(Castle.DynamicProxy.IInterceptor[], ePlus.Achievements.AchievementRegisters.IAchievementRegisterRepository, Abp.BackgroundJobs.IBackgroundJobManager)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.GetAllBindings(ConstructorBinder[] availableConstructors, IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Builder.RegistrationBuilder3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) --- End of inner exception stack trace --- at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action1 next) at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass6_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) [10:48:53 ERR] ---------- Exception Data ---------- ActivatorChain = Castle.Proxies.AchievementRegistersAppServiceProxy

Code

    public class AchievementRegistersAppService : ApplicationService, IAchievementRegistersAppService
    {
        private readonly IAchievementRegisterRepository _achievementRegisterRepository;
        private readonly IBackgroundJobManager _backgroundJobManager;

        public AchievementRegistersAppService(IAchievementRegisterRepository achievementRegisterRepository, IBackgroundJobManager backgroundJobManager)
        {
            _achievementRegisterRepository = achievementRegisterRepository;
            _backgroundJobManager = backgroundJobManager;


        }

Also when defining a Job I receive the following error unless I derive it from Abp.BackgroundJobs.IBackgroundJobBase<NZQAUnitsImportArgs>

'IBackgroundJobManager.EnqueueAsync<TJob, TArgs>(TArgs, BackgroundJobPriority, TimeSpan?)'. There is no implicit reference conversion from 'ePlus.BackgroundJobs.NZQAUnitsImportJob' to 'Abp.BackgroundJobs.IBackgroundJobBase<ePlus.BackgroundJobs.NZQAUnitsImportArgs>'.

Job Definition

public class NZQAUnitsImportJob : AsyncBackgroundJob<NZQAUnitsImportArgs>, ITransientDependency

**Enqueue**
 var Args = new NZQAUnitsImportArgs
            { ......... }
await _backgroundJobManager.EnqueueAsync<NZQAUnitsImportJob, NZQAUnitsImportArgs>(Args);

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    HI,

    Is your problem solved? I see the question closed.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11