- Create ProfileManager background service that polls database every 1 second - Query active profiles with cron schedules via MediatR GetProfileQuery - Auto-create/update Hangfire recurring jobs using IRecurringJobManager - Jobs execute TriggeringDEXJobBatchCommand via IMediator dependency injection - Add profile caching with schedule change detection to avoid redundant updates - Create DtoExtensions with JobId() and ToJob() helper methods for profile-to-command conversion
22 lines
562 B
C#
22 lines
562 B
C#
using ECMJobRunner.Application.Common.Dtos;
|
|
using ECMJobRunner.Application.DEXJob.Commands;
|
|
using MediatR;
|
|
|
|
namespace ECMJobRunner.WebCron.Extensions;
|
|
|
|
public static class DtoExtensions
|
|
{
|
|
public static string JobId(this CfgProfileDto profile)
|
|
{
|
|
return $"profile-{profile.Id}-{profile.ProfileName.Replace(' ', '_').ToLowerInvariant()}";
|
|
}
|
|
|
|
public static TriggeringDEXJobBatchCommand ToJob(this CfgProfileDto profile)
|
|
{
|
|
return new TriggeringDEXJobBatchCommand
|
|
{
|
|
ProfileId = profile.Id,
|
|
};
|
|
}
|
|
}
|