Dears,
i tried to Implement backgroundjobs in my solution , i did exactly like the documentation said but still it didn't work.
i want the background job to work on startup knowing that i'm using microservices archetichture.
so can you please tell me how to make it work on startup when i run the microservice its implemented in.
20 Answer(s)
-
0
Hi,
i did exactly like the documentation said but still it didn't work.
Can you provide steps to reproduce? thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
hi,
i did all whats in this documentation https://docs.abp.io/en/abp/latest/Background-Jobs
and changed options.IsJobExecutionEnabled to true
Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; //Disables job execution });
but still its not working when i run the microservice.
so i want to know whats the right way to implement it and what to exactly do to make it work on startup.
and can you also please tell me how it works and what is it usually used for ? just to know if its the right thing for what i need or not
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
1
Hi,
Can I check it remotely?
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
Please send an email to me. shiwei.liang@volosoft.com
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
HI,
Sorry, should be shiwei.liang@volosoft.com
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Resolved. You need to queue a job item: https://docs.abp.io/en/abp/latest/Background-Jobs#queue-a-job-item
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Use
CurrentTenant.Changefor per tenant : https://docs.abp.io/en/abp/latest/Multi-Tenancy#change-the-current-tenantMarkdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
thanks , also in my background job i use InsertManyAsync , but if the records are more than 10K it does not insert them and it returns TimeOut , and if the records are 10K or less it inserts them but does not return a result.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
You can try use
https://github.com/borisdj/EFCore.BulkExtensionsI think your main problem has been resolved, so will close the ticket.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
but why InsertManyAsync is not working right ? and EFCore.BulkExtensions only work for Microsoft Sql and SQLLite, i use PostgreSQL.
and yes my main problem has been resolved but all of these problems are connected, all in the same background job.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
EFCore.BulkExtensions only work for Microsoft Sql and SQLLite, i use PostgreSQL.
You can use commercial ef core extension: https://entityframework-extensions.net/bulk-insert, this is actually not related to ABP but EF Core.
but why InsertManyAsync is not working
This is no magic,
InsertManyAsyncjust use the native API of EF Core, you will also get the problem without ABP : ) .Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
This question has been automatically marked as stale because it has not had recent activity.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
can i do more than one queue for the same job ?
and the BackGround worker does it execute (DoWorkAsync) everytime the timer starts ? lets say im executing something that will take alot of time and the timer is set to 1 minute , will it still execute the (DoWorkAsync) ? or will it wait until the first execution is done and then count another 1 minute ?
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi @Qusai,
and the BackGround worker does it execute (DoWorkAsync) everytime the timer starts ? lets say im executing something that will take alot of time and the timer is set to 1 minute , will it still execute the (DoWorkAsync) ? or will it wait until the first execution is done and then count another 1 minute ?
It waits until the first execution is done but does not count another 1 minute again. For example: Just assume you set your timer as 10 minute and it first called at 1.10pm, and assume your job finished at 1.22pm (took 12minutes, more than our period). The counter will not count from that point it will only count extra 8 minutes to complete your period (10 minutes) and run your worker.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
but for some reason in my case it starts again before it finishes the first execution , i logged everything , and when i check it starts another execution before the first one ends .
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
if you don't want to overlap the jobs, there's a very basic solution; add a static variable
bool IsTheLastJobStillRunning = falsethen check this flag if it's true then return else set this true do your work set this false.Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)