- 在日终任务的逐日循环中,于当日收盘、风险监控和日终文件生成完成后, 按 valueDate 推送一条 TRS 合约全量快照;区间收盘逐日推送,空日推送空快照。 - 基于 eod_swap、trade、eod_swap_position、swap_position 组装合约字段, Kafka Key 使用 yyyy-MM-dd 格式的 valueDate。 - 新增带 Key 的 Kafka 发送重载;保留原有无 Key 发送及其吞异常行为,避免影响既有调用。 - 推送失败最多尝试 3 次;最终失败记录 Error 日志,并按 eod_swap.id 写入 push_status, 空快照失败使用 record_id=0。 - 增加 ContractTopic 配置,默认及各部署环境使用 onederiv.trs.contract.v1。 - 增加定向单测,覆盖空快照、区间逐日推送、重试成功、三次失败和字段映射。
67 lines
2.2 KiB
C#
67 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace YLErp.Model
|
|
{
|
|
public class KafkaConfig
|
|
{
|
|
/// <summary>
|
|
/// Kafka 集群的地址
|
|
/// </summary>
|
|
public string BootstrapServers { get; set; }
|
|
/// <summary>
|
|
/// 消息确认方式,可以是 All(-1)、Leader(1)、None(0) 中的一种
|
|
/// </summary>
|
|
public int Acks { get; set; }
|
|
/// <summary>
|
|
/// 开启幂等性,确保消息只被发送一次
|
|
/// </summary>
|
|
public bool EnableIdempotence { get; set; }
|
|
/// <summary>
|
|
/// 控制生产者在同一时间最多可以发送的未确认消息数
|
|
/// </summary>
|
|
public int MaxInFlight { get; set; }
|
|
/// <summary>
|
|
/// 消息压缩方式,可以是 None(0)、Gzip(1)、Snappy(2)、Lz4(3)、Zstd(4) 中的一种
|
|
/// </summary>
|
|
public int CompressionType { get; set; }
|
|
/// <summary>
|
|
/// 控制生产者等待消息确认的时间,单位是毫秒
|
|
/// </summary>
|
|
public int MessageTimeoutMs { get; set; }
|
|
/// <summary>
|
|
/// 客户互换费率topic
|
|
/// </summary>
|
|
|
|
public string ClientRateTopic { get; set; }
|
|
/// <summary>
|
|
/// 客户对冲账户topic
|
|
/// </summary>
|
|
public string HedgingAccountTopic { get; set; }
|
|
/// <summary>
|
|
/// 账户资金请求返回topic
|
|
/// </summary>
|
|
public string OnRspAccountCapitalTopic { get; set; }
|
|
/// <summary>
|
|
/// 互换自动簿记消费者topic
|
|
/// </summary>
|
|
public string OnRspInterestRateSwapInsertTopic { get; set; }
|
|
/// <summary>
|
|
/// 互换自动簿记消费组
|
|
/// </summary>
|
|
public string OnRspInterestRateSwapInsertTopicGroupId { get; set; }
|
|
|
|
public string AccountCapitalTopicGroupId { get; set; }
|
|
|
|
public int AutoOffsetReset { get; set; }
|
|
/// <summary>
|
|
/// TRS合约数据推送topic(对外,如onebp等)
|
|
/// </summary>
|
|
public string ContractTopic { get; set; } = "onederiv.trs.contract.v1";
|
|
}
|
|
|
|
}
|