Open Closed

Run Hangfire on multiple instances #2296


User avatar
0
Yousef.H85 created

Hi,

We are building a Blazor server app (Multi-Tenancy and MongoDB ) and we need to use Hangfire for backgrounds jobs for all Tenants.

We have two questions : 1 - How we can implement a hangfire server in an isolated Abp app and run this app on multiple instances? 2- How it can handle and access the tenant databases?

  • ABP Framework version: v5
  • UI type: Blazor Server
  • DB provider: MongoDB
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

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

    Hi,

    1 - How we can implement a hangfire server in an isolated Abp app and run this app on multiple instances?

    Hangfire natively supports multi-instance servers, you only need to deploy multiple application instances.

    2- How it can handle and access the tenant databases?

    Example:

    var tenants = await _tenantRepository.GetListAsync();
    
    foreach(var tenant in tenants)
    {
       using(CurrentTenant.Change(tenant.Id))
       {
           //handle and access the tenant databases...
       }
    } 
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 21, 2026, 06:18
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.