RabbitMQ integration
Hi I am using RabbitMQ to enqueue job on top of sqlStorage. I could able to see rabbitMQ queue has been created however no activity in the queue. Still SQL is being used for job storage
Here is the code
Client console application
var sqlStorage = new SqlServerStorage(@“Server=localhost;Database=HangFire;Trusted_Connection=True;”).
UseRabbitMq(conf =>
{ conf.HostName = “localhost”;
conf.Port = 5672;
}, “HangFireQueue”);
Hangfire.GlobalConfiguration.Configuration
.UseColouredConsoleLogProvider().UseStorage(sqlStorage);
string jobName = "Job_" + Guid.NewGuid().ToString();
Hangfire.BackgroundJob.Enqueue<WorkerClass>(x => x.DoWork(jobName));
////Schedule the the job - one time execution
jobName = "ScheduleJob_" + Guid.NewGuid().ToString();
BackgroundJob.Schedule<WorkerClass>(x => x.DoWork(jobName), TimeSpan.FromMinutes(3));
//Schedule the recurring job
jobName = "Recurring" + Guid.NewGuid().ToString();
RecurringJob.AddOrUpdate<WorkerClass>(jobName, x => x.DoWork(jobName), Cron.Minutely(), null, "HangFireQueue");
Server console application
var sqlStorage = new SqlServerStorage(@“Server=localhost;Database=HangFire;Trusted_Connection=True;”);
sqlStorage.UseRabbitMq(conf => { conf.HostName = “localhost”; conf.Port = 5672; }, “HangFireQueue”);
using (new Hangfire.BackgroundJobServer(sqlStorage))
{
Console.WriteLine("Background server is running. Press enter to EXIT!!!");
Console.ReadLine();
}
Could you please help me to solve the issue.
Appreciate your reply.