using ECMJobRunner.Domain.Entities;
using MediatR;
using System.Threading;
using System.Threading.Tasks;
namespace ECMJobRunner.Application.Profiles.Commands
{
///
/// Command to trigger a single DEX job execution
/// Execution logic is handled by pipeline behaviors:
/// 1. MainQueryExecutionBehavior - executes main SQL query
/// 2. CheckQueryExecutionBehavior - validates with check SQL query
/// 3. ReCRequestExecutionBehavior - invokes ReC HTTP request
///
public class TriggeringProfileJobCommand : IRequest
{
///
/// The SQL job to execute
///
public ProfileSqlJob Job { get; set; } = null!;
///
/// Unique batch identifier for this execution
///
public string BatchId { get; set; } = null!;
}
///
/// Handler for TriggeringDEXJobCommand
/// All execution logic is delegated to pipeline behaviors
/// This handler simply returns completion after behaviors execute
///
public class TriggeringDEXJobCommandHandler : IRequestHandler
{
///
/// Handles the TriggeringDEXJobCommand
/// Returns immediately as behaviors perform all work
///
/// The command containing job and batch ID
/// Cancellation token
/// Unit value indicating completion
public Task Handle(TriggeringProfileJobCommand request, CancellationToken cancellationToken)
{
// All execution logic is handled by pipeline behaviors:
// - MainQueryExecutionBehavior
// - CheckQueryExecutionBehavior
// - ReCRequestExecutionBehavior
return Task.FromResult(Unit.Value);
}
}
}