Difference Between Hangfire And MSMQ
Hangfire or MSMQ
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
Do not use MSMQ with Hangfire. It fails for no reason.
ReplyDeleteI use hangfire default settings for jobs without using MSMQ. And it works great for me. thanks for the heads up though.
Delete