Hangfire Best Practice: Invoke by ID
In my previous post, I created a few extension methods for Hangfire and MediatR in order to enqueue an IRequest. However, it was not following Hangfire Best Practice. The purpose was to have the IRequest serialized entirely when calling Enqueue(), which would be stored in Hangfires storage. Then when the request would be invoked, Hangfire would deserialize the IRequest and call Mediators Send(). My functioning example worked as expected. However, Hangfire recommends making your job arguments small and simple. Best Practice Method invocation (i.e. a job) is serialized during the background job creation process. Arguments are converted into JSON strings using the TypeConverter… Read More »Hangfire Best Practice: Invoke by ID