I’m using hangfire 1.4.3 and would like to have one job produce a file and a second job send the file.
The first job simply return a file path which I would like to pass into the next job.
Can I juse ContinueWith directly in this scenario or would I have to store the filepath somewhere else?
Sure, result of the “parent” joib is available on the “Result” field:
var rs = new RedisStorage();
string result = rs.GetConnection().GetStateData(previousJobId).Data["Result"];
var myResult = (MyType)Hangfire.Common.JobHelper.FromJson(result, typeof(MyType));
I’ve got to say however that in my experience the result got written in the storage AFTER the launch of the continuation job. You can wait in a loop testing for the existence of the “Result” key.