You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When multiple applications use the ABP BackgroundJobs module and add jobs that are not shared between them, an application may encounter a job that does not belong to it. In such cases, it fails to process the job and marks it as IsAbandoned = true due to a ""Undefined background job for the job name" error. However, this causes the job to never be executed, even though it was never actually processed.
Proposed Solution:
To prevent this issue, filtering can be applied at the IBackgroundJobRepository level so that each application processes only the job types it recognizes. This way, applications will not mistakenly mark jobs as IsAbandoned just because they do not have access to them, preventing unnecessary job losses.
This improvement would ensure more consistent behavior, especially in multi-application scenarios where different applications share the same database but handle separate job processes.
The text was updated successfully, but these errors were encountered:
@maliming that is not similar to dynamic permissions. Here, the job executor is a class with its own code and it can only be executed in the application that has that class definition. So, no way to add a background job in a microservice and then execute it in the administration microservice.
Currently, we don't have a problem in a microservice solution since each microservice has its own database with its own background jobs table and execution queue. Actually, we are already using rabbitmq background job manager (which should also be thought if it has the similar problem @maliming ).
@salihozkara current solution should be using a different database for each application, so they execute only the jobs they queued.
If we want to share the database table between different applications that have different job definitions, then the only way is to add ApplicationName option to the AbpBackgroundJobWorkerOptions class, then use that value on saving and retrieving jobs in that application (so, we also add ApplicationName property to the BackgroundJobInfo class(. The default value can be null for backward compatibility.
Instead of manually setting AbpBackgroundJobWorkerOptions.ApplicationName, we can auto-get from the IApplicationInfoAccessor.ApplicationName by default, so most of the times we don't to set it manually. However, that won't be backward compatible.
So, we can implement like that for the default background job manager. However, we should also consider others (rabbitmq, hangfire), if it is a problem for those applications too.
Problem:
When multiple applications use the ABP BackgroundJobs module and add jobs that are not shared between them, an application may encounter a job that does not belong to it. In such cases, it fails to process the job and marks it as IsAbandoned = true due to a ""Undefined background job for the job name" error. However, this causes the job to never be executed, even though it was never actually processed.
Proposed Solution:
To prevent this issue, filtering can be applied at the IBackgroundJobRepository level so that each application processes only the job types it recognizes. This way, applications will not mistakenly mark jobs as IsAbandoned just because they do not have access to them, preventing unnecessary job losses.
This improvement would ensure more consistent behavior, especially in multi-application scenarios where different applications share the same database but handle separate job processes.
The text was updated successfully, but these errors were encountered: