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
-
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
-
1
Hi,
Can I check it remotely?
-
0
yes , should i send you a zoom link ?
-
0
Hi,
Please send an email to me. shiwei.liang@volosoft.com
-
0
the email is not correct
-
0
HI,
Sorry, should be shiwei.liang@volosoft.com
-
0
Resolved. You need to queue a job item: https://docs.abp.io/en/abp/latest/Background-Jobs#queue-a-job-item
-
0
one more thing , when we run a backgroundjob how can we determine the Tenant Connectionstring as we are using seperate databases per tenant.
-
0
Use
CurrentTenant.Change
for per tenant : https://docs.abp.io/en/abp/latest/Multi-Tenancy#change-the-current-tenant -
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.
-
0
You can try use
https://github.com/borisdj/EFCore.BulkExtensions
I think your main problem has been resolved, so will close the ticket.
-
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.
-
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,
InsertManyAsync
just use the native API of EF Core, you will also get the problem without ABP : ) . -
0
This question has been automatically marked as stale because it has not had recent activity.
-
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 ?
-
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.
-
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 .
-
0
can you please help with the problem i'm having ?
-
0
if you don't want to overlap the jobs, there's a very basic solution; add a static variable
bool IsTheLastJobStillRunning = false
then check this flag if it's true then return else set this true do your work set this false.