In this post, we will see how to resolve How to capture data created from within a Hangfire job?
Question:
I’m generating some new data within my Hangfire job:The official documentation doesn’t seem to cover this, at least not as far as I can find. Answers to this question purport to cover it, I believe, but if so I’m not understanding how to actually implement it.
Here’s what I’ve got in my controller:
Engine.Run()
and then assigning the new values there, but they didn’t make it out for some reason.Are those answers accomplishing what I’m after? If so, how would I integrate the solution into my existing code?
Best Answer:
It’s working now.My confusion stemmed from the fact that I’d glossed over a certain nuance: the
Schedule
function takes an Expression(Of Action(Of IEngine))
and I was hung up on the false notion that it was referring to IEngine.Run()
, thereby requiring it to be the Action
in question.I’m not sure where I came up with that idea, but it’s what was holding me back.
Once I changed the
Run
method to a function, I was able to get the result in the manner described in the answers.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review