HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.29k stars 1.69k forks source link

Hangfire with Aspire integration #2408

Open meghuizen opened 3 months ago

meghuizen commented 3 months ago

What I think would be a killer combo is having Hangfire integration in Aspire. The scenario I would like to see is that you have Aspire running with multiple Hangfire workers on different projects running in Aspire. The Hangfire dashboard as plugin part of the Aspire dashboard, which will give an overview on all the Hangfire jobs on all the Hangfire workers running in Aspire. Also the telemetry and logging being visible from Aspire.

odinserj commented 3 months ago

Looks indeed interesting, but need to understand its component model first. It seems to me that it's possible to integrate Hangfire with its current capabilities, since Aspire is likely using ASP.NET Core infrastructure, so it is likely to see the logs in Aspire dashboard anyway. But more detailed integration would be useful to have.

adanbrownpaca commented 3 months ago

We should make this simpler - we should add the ability for Hangfire to simply use a DB on the container provide by aspire. Do do this it needs to be able to install the DB seamlessly:

Hangfire Project: builder.AddSqlServerClient("BackgroundJobsDb");

Aspire: var sqldbserver = builder.AddSqlServer("DbServer"); var backgroundjobsdb = sqldbserver.AddDatabase("BackgroundJobsDb"); builder.AddProject("backgroundjobs") .WithReference(backgroundjobsdb);

This way the Db gets installed on the local development container and initialized with the schema. Then, this simplifies deployment to Azure.

arielmoraes commented 1 month ago

Let's not forget Aspire provides packages for the client too. So all the goodies like OpenTelemetry, Health Checks, and more are expected to be provided out-of-box.