| 12345678910111213141516171819202122232425262728293031 |
- using Admin.NET.Plugin.AiDOP.Entity.DataPlatform;
- namespace Admin.NET.Plugin.AiDOP.DataPlatform.Executors;
- /// <summary>出站执行器:按 mdp_source.source_type 推送单条 Outbox。</summary>
- public interface IMdpTargetPushExecutor
- {
- /// <summary>API / DB</summary>
- string SupportedType { get; }
- Task<MdpPushResult> PushAsync(MdpSource source, MdpOutbox item, CancellationToken ct = default);
- }
- public sealed class MdpPushResult
- {
- public bool Success { get; set; }
- public int AffectedRows { get; set; }
- public string? ResponseJson { get; set; }
- public string? ErrorMessage { get; set; }
- /// <summary>true 表示识别为「已处理过」,幂等跳过,应记为成功。</summary>
- public bool IdempotentSkip { get; set; }
- public static MdpPushResult Ok(int affected = 1, string? response = null) =>
- new() { Success = true, AffectedRows = affected, ResponseJson = response };
- public static MdpPushResult Skip(string? response = null) =>
- new() { Success = true, IdempotentSkip = true, AffectedRows = 0, ResponseJson = response };
- public static MdpPushResult Fail(string error, string? response = null) =>
- new() { Success = false, ErrorMessage = error, ResponseJson = response };
- }
|