Open Closed

Background Jobs with multi tentant #1635


User avatar
0
BernardoTeixeira created
  • ABP Framework version: v4.3.3
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes

Hi, I want to use the background service with hangfire and multi tenant. Do you have any example for this? Or any type of documentation for this type of example?


14 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @BernardoTeixeira

    Can you explain your use case?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    See: https://support.abp.io/QA/Questions/1628/AsyncBackgroundJobs#answer-9bd678d0-8939-94ff-3d01-39fdfeea6986

  • User Avatar
    0
    BernardoTeixeira created

    hi @BernardoTeixeira

    Can you explain your use case?

    I want to know the best approach to use Hangfire with multi tenant. Because I want to isolate all the backgrounds services, a solution just for background services.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    There is currently no such best practice, depending on your use case.

  • User Avatar
    0
    BernardoTeixeira created

    I'm having some problems register background jobs. I follow this -> https://docs.abp.io/en/abp/latest/Background-Jobs and also this -> https://docs.abp.io/en/abp/latest/Background-Jobs-Hangfire

    But in the hangfire dashboard I dont have the job.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share a simple project with me? liming.ma@volosoft.com

  • User Avatar
    0
    BernardoTeixeira created

    I sent you an invitation for github

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi BernardoTeixeira

    Please share the steps? btw, Why are you using module templates?

  • User Avatar
    0
    BernardoTeixeira created

    hi BernardoTeixeira

    Please share the steps? btw, Why are you using module templates?

    My steps was https://docs.abp.io/en/abp/latest/Background-Jobs and also this -> https://docs.abp.io/en/abp/latest/Background-Jobs-Hangfire, I just want register background services and make recurring job.

    Because I want to isolate the Background services.

  • User Avatar
    0
    BernardoTeixeira created

    If I understand correctly, the Identity server have the tenants and also the connections strings. I can expose the data for the tenant's Id(using an endpoint) and then use CurrentTenant.Change so I can have the connections string for that tenant.

    But in that case, my Background Module will connect directly to the database. I don't want that. Instead, I want to connect my background service to an API. Is this approach supportable with CurrentTenant.Change or the ABP has another approach?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    It works for me.

    I want to connect my background service to an API. Is this approach supportable with CurrentTenant.Change or the ABP has another approach?

    Your API may require permissions, and authentication in a background job is not recommended. This is complicated.

    You can consider calling the domain service directly in the job, so that CurrentTenant.Change will work.

  • User Avatar
    0
    BernardoTeixeira created

    It doenst work for me... Did you change anything?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I didn't change anything. : )

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 26, 2024, 06:07