Difference Between Hangfire And MSMQ

Hangfire or MSMQ

Developers are confused when it comes to making a decision whether to use Hangfire or MSMQ, what difference is MSMQ to Hangfire or are they really doing the same thing? Whether you decide to use Hangfire or MSMQ or both for your applications, it would work. But there is a slight difference.
 



What is Hangfire

Hangfire is an open-source framework that helps to create, process and manage your background jobs, i.e. operations you don't want to put in your request processing pipeline:
  • Mass notifications/newsletters
  • Batch import from XML,CSV,JSON
  • Building different graphs
...


What is MSMQ

Message Queuing (MSMQ) technology enables applications running at different times to communicate across heterogeneous networks and systems that may be temporarily offline. Applications send messages to queues and read messages from queues.


Differences 

Working with enterprise applications that require lot of persistent logic, and your applications communicate across heterogeneous networks, sometimes the server may go offline or be terminated unexpectedly, which would lead to loss of data or corrupt data. 

The good news is that hangfire retries failed jobs after some interval. If the server shut down unexpectedly or an exception occurred, it would retry after some seconds (15 by default) when the server becomes available. Having multiple servers is also good practice because each server that is running executes the queued jobs simultaneously. So if one fails, the other servers continue processing

But when using MSMQ, you don’t have to wait! MSMQ will start processing immediately when the server becomes available. Hangfire also has support for MSMQ, read more about it here http://docs.hangfire.io/en/latest/configuration/using-sql-server-with-msmq.html



Comments

  1. Do not use MSMQ with Hangfire. It fails for no reason.

    ReplyDelete
    Replies
    1. I use hangfire default settings for jobs without using MSMQ. And it works great for me. thanks for the heads up though.

      Delete

Post a Comment

Popular posts from this blog

Paystack In Asp.Net MVC

Sending Notification Message with Firebase with JavaScript and .Net client

Solved: Jwt Authentication in Asp.Net Web Api And Mvc