Open Closed

Background Jobs vs Background Workers. when to use which? #5931


User avatar
0
joe@tronactive.com created
  • ABP Framework version: v7.3.3
  • UI Type: Blazor Server
  • Database System: EF Core SQL Server
  • Tiered (for MVC) or Auth Server Separated (for Angular): no

I read the documentation for both Background Jobs and Background Workers, but I am a bit confused. I have a application that will essentially be a worker service with many background tasks happening. I implemented Quartz and SilkierQuartz to handle these. But I am unsure what is best practice for when to use Background Jobs vs Background Workers. Any advice or help would be greatly appreciated.

Example of scheduled jobs or workers that will be running daily. I am hoping to get advice if the below should be processed as Background Jobs or Workers. There will be either one or many jobs/workers doing these tasks below and they will run twice a day using Quartz Cron Scheduler. 1. FileReceivedActivity: File comes in from SFTP waiting to be processed. Task will run twice a day to pick up those files and then queue them in Azure Service Bus Queue to go through the file processing workflow. 2. ProcessQueueFiles: Starts processing the queue which will do the following activities. 3. DecryptActivity: Decrypts the incoming file and moves it into the processing folder 4. MalwareScanActivity: Scans the file(s) for malware and decides the next action based on the scan result. (Either quarantines the file or starts the next step) 5. AzureBlobActivity: Saves the encrypted version of the file in Azure Blob Storage and adds a location pointer to the database. 6. MoveFileActivity: Moves the file(s) to the correct customer folder to be processed by 3rd party application.


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

    Hi,

    Background Job execute only once and Background Worker cycle execution. This is their most direct difference.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11