I have a web application where users can enqueue tasks to export some data. The process can take up to 2-3 hours but can complete in seconds depending what was requested.
The export process will be handled like that:
public class ExportCommandHandler: IAsyncRequestHandler<ExportCommand, bool>
{
...
public async Task<bool> Handle(ExportCommand message)
{
return await _externalScheduler.EnqueueJobAsync(new ExportJob(...));
}
}
The _externalScheduler.EnqueueJobAsync
currently just calls a self-hosted webapi method exposed in the external process to start a job there.
The problem here I want to get a notification when the job was completed to notify user it's ready if he's still browsing our web-site (planning to use SignalR here). If it wasn't hosted in the external process it would be obvious.
But what's the best approach to get notified when it's hosted in the external process? Is exposing a web-method in the web application for external process to call after completion is a proper way?
We're currently planning using Quartz.NET for processing external jobs but don't mind trying some other things like Hangfire.