| 35547 |
amit |
1 |
package com.spice.profitmandi.dao.entity.solr;
|
|
|
2 |
|
|
|
3 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
|
|
4 |
|
|
|
5 |
import javax.persistence.*;
|
|
|
6 |
import java.io.Serializable;
|
|
|
7 |
import java.time.LocalDateTime;
|
|
|
8 |
|
|
|
9 |
/**
|
|
|
10 |
* Entity for tracking failed Solr update attempts.
|
|
|
11 |
* Failures are logged here for visibility and targeted retries.
|
|
|
12 |
*/
|
|
|
13 |
@Entity
|
|
|
14 |
@Table(name = "solr_update_failures", indexes = {
|
|
|
15 |
@Index(name = "idx_status", columnList = "status"),
|
|
|
16 |
@Index(name = "idx_catalog_id", columnList = "catalog_id")
|
|
|
17 |
})
|
|
|
18 |
public class SolrUpdateFailure implements Serializable {
|
|
|
19 |
|
|
|
20 |
private static final long serialVersionUID = 1L;
|
|
|
21 |
|
|
|
22 |
@Id
|
|
|
23 |
@Column(name = "id", columnDefinition = "int(10) unsigned")
|
|
|
24 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
25 |
private int id;
|
|
|
26 |
|
|
|
27 |
@Column(name = "catalog_id", nullable = false)
|
|
|
28 |
private int catalogId;
|
|
|
29 |
|
|
|
30 |
@Column(name = "item_id")
|
|
|
31 |
private int itemId;
|
|
|
32 |
|
|
|
33 |
@Column(name = "change_type", length = 50)
|
|
|
34 |
private String changeType;
|
|
|
35 |
|
|
|
36 |
@Column(name = "error_message", columnDefinition = "TEXT")
|
|
|
37 |
private String errorMessage;
|
|
|
38 |
|
|
|
39 |
@Column(name = "retry_count", columnDefinition = "int default 0")
|
|
|
40 |
private int retryCount;
|
|
|
41 |
|
|
|
42 |
@Column(name = "status", length = 20, columnDefinition = "varchar(20) default 'PENDING'")
|
|
|
43 |
private String status;
|
|
|
44 |
|
|
|
45 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
46 |
@Column(name = "created_at")
|
|
|
47 |
private LocalDateTime createdAt;
|
|
|
48 |
|
|
|
49 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
|
|
50 |
@Column(name = "last_retry_at")
|
|
|
51 |
private LocalDateTime lastRetryAt;
|
|
|
52 |
|
|
|
53 |
public SolrUpdateFailure() {
|
|
|
54 |
this.createdAt = LocalDateTime.now();
|
|
|
55 |
this.status = "PENDING";
|
|
|
56 |
this.retryCount = 0;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
public int getId() {
|
|
|
60 |
return id;
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
public void setId(int id) {
|
|
|
64 |
this.id = id;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
public int getCatalogId() {
|
|
|
68 |
return catalogId;
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
public void setCatalogId(int catalogId) {
|
|
|
72 |
this.catalogId = catalogId;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
public int getItemId() {
|
|
|
76 |
return itemId;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
public void setItemId(int itemId) {
|
|
|
80 |
this.itemId = itemId;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public String getChangeType() {
|
|
|
84 |
return changeType;
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
public void setChangeType(String changeType) {
|
|
|
88 |
this.changeType = changeType;
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
public String getErrorMessage() {
|
|
|
92 |
return errorMessage;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
public void setErrorMessage(String errorMessage) {
|
|
|
96 |
this.errorMessage = errorMessage;
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
public int getRetryCount() {
|
|
|
100 |
return retryCount;
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
public void setRetryCount(int retryCount) {
|
|
|
104 |
this.retryCount = retryCount;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
public String getStatus() {
|
|
|
108 |
return status;
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
public void setStatus(String status) {
|
|
|
112 |
this.status = status;
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
public LocalDateTime getCreatedAt() {
|
|
|
116 |
return createdAt;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
public void setCreatedAt(LocalDateTime createdAt) {
|
|
|
120 |
this.createdAt = createdAt;
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
public LocalDateTime getLastRetryAt() {
|
|
|
124 |
return lastRetryAt;
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
public void setLastRetryAt(LocalDateTime lastRetryAt) {
|
|
|
128 |
this.lastRetryAt = lastRetryAt;
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
@Override
|
|
|
132 |
public String toString() {
|
|
|
133 |
return "SolrUpdateFailure{" +
|
|
|
134 |
"id=" + id +
|
|
|
135 |
", catalogId=" + catalogId +
|
|
|
136 |
", itemId=" + itemId +
|
|
|
137 |
", changeType='" + changeType + '\'' +
|
|
|
138 |
", status='" + status + '\'' +
|
|
|
139 |
", retryCount=" + retryCount +
|
|
|
140 |
", createdAt=" + createdAt +
|
|
|
141 |
", lastRetryAt=" + lastRetryAt +
|
|
|
142 |
'}';
|
|
|
143 |
}
|
|
|
144 |
}
|