Hi all!
Can anyone show an example on how to use hangfire to enqueue an external command?
Thank you in advance,
Alexandros
Hi all!
Can anyone show an example on how to use hangfire to enqueue an external command?
Thank you in advance,
Alexandros
public class EmailService
{
public void Send() { }
}
BackgroundJob.Enqueue<EmailService>(x => x.Send());
Within Send
, it would call the external command.
I have tried using System.Diagnostics.Process.Start()
either as:
var jobId = BackgroundJob.Enqueue(() => System.Diagnostics.Process.Start(startInfo));
or in a wrapper class. In both cases, I received error Newtonsoft.Json.JsonSerializationException
: Can not find the target method
.
It seems like hangfire cannot resolve this.