Git Product home page Git Product logo

Comments (4)

gtmadev avatar gtmadev commented on June 14, 2024 3

I ran into this as well. What I did was I placed all my configuration code in a Startup class (per docs when using ASP.NET MVC). My code is VB, but it is very easy to convert to C# as needed.

Here is my code in the Startup.vb class for setting up the monitoring service.

Dim heartbeatService As IBackgroundProcess = New SystemMonitor(checkInterval:=TimeSpan.FromSeconds(1))

Add that as an "additionalProcesses" parameter when calling UseHangfire()

app.UseHangfireServer(serverOptions, heartbeatService)

Next.. add your global configuration parameter for the dashboard in the Global.asax.vb (or C# version). Note: You will need to import (using) Hangfire.Heartbeat.

With Hangfire.GlobalConfiguration.Configuration() .UseHeartbeatPage(New HeartbeatOptions(checkInterval:=TimeSpan.FromSeconds(1))) End With

And that's it. The new page will now appear on your Dashboard with metrics coming in every second.

screenshot_6

from hangfire.heartbeat.

Shafeeq86 avatar Shafeeq86 commented on June 14, 2024 1

Yes..please share the sample code

from hangfire.heartbeat.

ellonia avatar ellonia commented on June 14, 2024 1

If you use Making ASP.NET application always running in MVC, your settings will change to:

HangfireBootstrapper.cs:

public void Start()
{ 
     HostingEnvironment.RegisterObject(this);

     GlobalConfiguration.Configuration
         .UseSqlServerStorage("connection string");
         // Specify other options here

     var options = new BackgroundJobServerOptions {};

     IBackgroundProcess heartbeatService = new ProcessMonitor(TimeSpan.FromSeconds(1));
     _backgroundJobServer = new BackgroundJobServer(options, JobStorage.Current ,new IBackgroundProcess[]{ heartbeatService });
}

Startup.cs (Example):

public void Configuration(IAppBuilder app)
{
    GlobalConfiguration.Configuration.UseHeartbeatPage(TimeSpan.FromSeconds(1));
    GlobalJobFilters.Filters.Add(new ProlongExpirationTimeAttribute()); 

    app.UseHangfireDashboard("/jobs", new DashboardOptions()
    {
        Authorization = new[] { new HangFireAuthorizationFilter() }
    });            
}

image

from hangfire.heartbeat.

Godaday avatar Godaday commented on June 14, 2024

@gtmadev good job thanks I ran into this as well

from hangfire.heartbeat.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.