Send message to all clients if a recurringJob in hangfire is started using SignalR in .net core2

Hi, I have made a recurring job in my core application using HangFire.IO, which trigger after 5 min of interval, here is my C# Code

RecurringJob.AddOrUpdate(() =>  FullThing (Id, name), Cron.MinuteInterval(5));

Now, I want to

- Firstly, get the state of this recurringJob.

- Secondly, I want  to send a message, to all clients using SignalR. like "Hello Recurring job starts" . if the recurringJob are started. mean the state of recurringJob is start.


Asked by:- LuneAgile
: 892 At:- 11/26/2018 12:16:46 PM
ASP.NET SignalR HangFire.IO

1 Answers
profileImage Answered by:- neena

This is quite simple, if you have understood HangFire & SignalR concepts

You can simply place a function inside your Hangfire Job to call SignalR function inside it, to get state of Hangfire.IO and to send message to all users.

Suppose my recurring job name is : FullThings

Now when HangFire call this function(FullThings), place SignalR Hub Instance inside it and call required function, something like this

public string FullThing()
   hub = GlobalHost.ConnectionManager.GetHubContext<ClientPushHub>();
   //Some code

You can also read these articles:

Above links may make things more clear about SignalR and Hangfire for you.

At:- 11/26/2018 3:01:12 PM Updated at:- 11/26/2018 3:01:31 PM
Thanks so much neena. 0
By : LuneAgile - at :- 11/26/2018 7:34:04 PM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use

Subscribe Now

Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly