Hangfire Job Description Customization

Hi! Anyone know how to format, in this case the response given on B, since I’m returning in this case a json object and it appears with special chars instead of the new line?

And how to remove in this case the method call in the A section since i’m using this to debug the run tasked and that information to me needs to be more clean since i can study each task that run with success. In conclusion, i would like to have a more human readable format.

The Hangfire Dashboard is really just a fancy diagnostic tool. It’s not customizable in such a way that’s going to allow you to make the Job and Result data more human readable. If you need that information to be more human readable you’re going to have to do that work yourself, separately.

For your problem B:
The code returning Json to your Background Job is returning formatted Json and is adding the new line codes (/r/n) in the response. Hangfire is then just taking that data, html encoding it and sticking the new lines and all into a div. My recommendation would be to extract the info you care about from the Json and save it to a different tool (i.e. database) where you can then manipulate it into a more human readable form and return it via a query or perhaps expose it via your web site code. If you need to look at the Json you could also just save that, but that’s not very efficient, storage-wise.

For your problem A:
Generally we wouldn’t pass that complicated of an object when queuing up a Background Job. We would save that information to the database and pass the corresponding primary key to the Background job. The Background Job would then do a lookup and then execute.

Hope that makes sense.

1 Like