Is it possible to store a string returned by a job?


I have a job that returns some business status as a result. I don’t need to store this in the application database, but it would help to keep it together with the job, as an output. Can this be done in the State of the job? can it be done at all?


Who or what did you had in mind should receive this result?

A job runs in the background disconnected from who enqueued the job, so its not like you can enqueue a job and wait for it to return a result.

thanks. this would be just for manual checking. the job calls a rest endpoint and i want to store the output of that http call, to check manually later (if needed). I am also logging this output but is more difficult to query and correlate to jobs. Also, we keep logs for a month only. I could create a data structure to keep track of it but i thought that is a reasonable feature to have in hangfire jobs

i thought that is a reasonable feature to have in hangfire jobs

Not really… Its “just” a job scheduling and execution framework. What kinds of job you execute and what they do is not in the scope of Hangfire.

So you should go ahead and create your own store for storing and querying those http responses. Or maybe consider a dedicated rest endpoint test and monitoring solution like Runscope