I have background jobs which enqueued by user, how to let user to see all their jobs, and what are their statuses?
4 Answer(s)
-
0
Hi,
ABP framework has not such a feature since ABP's implementation is very simple. There are really good background job frameworks like HangFire. You can check them if they have such a feature. If not, you should implement your own solution for that.
-
0
Since ABP have no such feature, I wish to implement it myself by creating an Entity[TenantId, UserId, Log, JobId] to log those processes. I wish to link the created object with the enqueued job(JobId property) but BackgroundJobManager.Enqueu() method was not returning enqueued job(return type is void), any advice to get the enqueued job?
-
0
protected abstract void DoJob(); [UnitOfWork] public override void Execute(T args) { UserEnqueuedJob userEnqueuedJob = UserEnqueuedJobRepository.Get(args.UserEnqueuedJobId); userEnqueuedJob.Status = Entity.Enum.JobStatus.Executing; try { DoJob(); } finally { userEnqueuedJob.Status = Entity.Enum.JobStatus.Executed; } }
Can I create a new UnitOfWork to set UserEnqueuedJob status to Executing?
-
0
Since UOW is transactional, setting status to executing will not be written to database until your method ends. so, it has no meaning. I haven't understand your goal, but as a formal review, you should set status to executing in a different uow.