Files
flow-center-service/src/main/java/com/yunhai/flowcenter/entity/FlwCallbackLog.java
T

87 lines
2.9 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.yunhai.flowcenter.entity;
import com.yunhai.flowcenter.enums.FlwEnums;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.time.LocalDateTime;
/**
* 回调推送日志 = 重试队列(概览 §4.9):eventId 唯一(重试不变,业务方按它幂等去重);
* payload_json 完整快照可重放;索引 (status, next_retry_time) 是扫描主路径。
*/
@Getter
@Setter
@Entity
@Table(name = "flw_callback_log",
uniqueConstraints = @UniqueConstraint(name = "uk_flw_log_event", columnNames = "event_id"),
indexes = {
@Index(name = "idx_flw_log_scan", columnList = "status, next_retry_time"),
@Index(name = "idx_flw_log_inst", columnList = "instance_id")})
public class FlwCallbackLog extends BaseEntity {
/** 租户键 */
@Column(name = "sch_id", nullable = false)
private Long schId;
/** 归属注册 */
@Column(name = "reg_id", nullable = false)
private Long regId;
/** 事件唯一键(UUID 去横线 32 位),重试不变 */
@Column(name = "event_id", nullable = false, length = 32)
private String eventId;
/** 事件类型(flow.submitted/task.created/task.handled/completed/rejected/withdrawn) */
@Column(name = "event", nullable = false, length = 32)
private String event;
/** 办件 */
@Column(name = "instance_id", nullable = false)
private Long instanceId;
/** 业务键冗余(业务方消费主键) */
@Column(name = "biz_type", length = 32)
private String bizType;
@Column(name = "biz_id", length = 64)
private String bizId;
/** 完整推送体快照(含签名原文,可重放) */
@Column(name = "payload_json", nullable = false, columnDefinition = "LONGTEXT")
private String payloadJson;
/** 0 待推/重试中 / 1 成功 / 2 死信 */
@Column(name = "status", nullable = false)
private Integer status = FlwEnums.CallbackLogStatus.PENDING.getCode();
/** 已重试次数 */
@Column(name = "retry_count", nullable = false)
private Integer retryCount = 0;
/** 下次推送时间 */
@Column(name = "next_retry_time")
private LocalDateTime nextRetryTime;
/** 末次 HTTP 状态(管理端排障用) */
@Column(name = "last_http_status", length = 32)
private String lastHttpStatus;
/** 末次错误 */
@Column(name = "last_error", length = 1000)
private String lastError;
/** 响应体摘要(探测/probe 落,截 1000;常规推送不落——2xx 即成功不解析响应体) */
@Column(name = "resp_body", columnDefinition = "TEXT")
private String respBody;
/** 成功时间 */
@Column(name = "push_time")
private LocalDateTime pushTime;
}