添加项目文件。
This commit is contained in:
55
common/Tnb.Common.Core/EventBus/Sources/TaskEventSource.cs
Normal file
55
common/Tnb.Common.Core/EventBus/Sources/TaskEventSource.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.EventBus;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.EventHandler;
|
||||
|
||||
/// <summary>
|
||||
/// 任务事件源.
|
||||
/// </summary>
|
||||
public class TaskEventSource : IEventSource
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数.
|
||||
/// </summary>
|
||||
/// <param name="eventId">事件ID.</param>
|
||||
/// <param name="connectionConfig">数据库连接配置.</param>
|
||||
/// <param name="entity">实体.</param>
|
||||
public TaskEventSource(string eventId, ConnectionConfigOptions connectionConfig, TimeTaskEntity entity)
|
||||
{
|
||||
EventId = eventId;
|
||||
ConnectionConfig = connectionConfig;
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据库连接配置.
|
||||
/// </summary>
|
||||
public ConnectionConfigOptions ConnectionConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务实体.
|
||||
/// </summary>
|
||||
public TimeTaskEntity Entity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 事件 Id.
|
||||
/// </summary>
|
||||
public string EventId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 事件承载(携带)数据.
|
||||
/// </summary>
|
||||
public object Payload { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 取消任务 Token.
|
||||
/// </summary>
|
||||
/// <remarks>用于取消本次消息处理.</remarks>
|
||||
public CancellationToken CancellationToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 事件创建时间.
|
||||
/// </summary>
|
||||
public DateTime CreatedTime { get; } = DateTime.UtcNow;
|
||||
}
|
||||
Reference in New Issue
Block a user