Class DlqWriter
java.lang.Object
org.alfresco.elasticsearch.batchindexing.DlqWriter
Writes dead-letter records to a dedicated Elasticsearch index. Best-effort: a DLQ write failure never blocks indexing. ERROR logs on write failure are rate-limited to one per minute per failure-type key to avoid log spam if the DLQ index is broken for a sustained period.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidBest-effort index creation on startup.voidrecordSkip(Long dbId, String nodeRef, Long sourceCommitTimeMs, DeadLetterDocument.FailureStage stage, String failureType, String failureReason) Same asrecordSkip(Long, String, Long, FailureStage, Throwable)but with the failure classifier / reason supplied as strings.voidrecordSkip(Long dbId, String nodeRef, Long sourceCommitTimeMs, DeadLetterDocument.FailureStage stage, Throwable throwable) Record a give-up event fordbId.voidrecordWindowFailure(long tsFromMs, long tsToMs, Throwable cause) Record a page-level read failure keyed by the failed time window.
-
Constructor Details
-
DlqWriter
public DlqWriter(org.opensearch.client.opensearch.OpenSearchClient openSearchClient, String indexName)
-
-
Method Details
-
ensureIndexExists
public void ensureIndexExists()Best-effort index creation on startup. Logs but does not throw — a broken DLQ must not take down indexing. -
recordSkip
public void recordSkip(Long dbId, String nodeRef, Long sourceCommitTimeMs, DeadLetterDocument.FailureStage stage, Throwable throwable) Record a give-up event fordbId. If a doc already exists it is upserted in place:firstFailedAtis preserved,lastFailedAtand the failure fields are refreshed, andfailureCountis incremented.- Parameters:
dbId- node database id; may be null for reader-side skips (rare), in which case no document is writtennodeRef- best-effort node reference; may be nullsourceCommitTimeMs- best-effort ACS commit time of the node; may be nullstage- pipeline stage that produced the skipthrowable- the exception Spring Batch skipped
-
recordSkip
public void recordSkip(Long dbId, String nodeRef, Long sourceCommitTimeMs, DeadLetterDocument.FailureStage stage, String failureType, String failureReason) Same asrecordSkip(Long, String, Long, FailureStage, Throwable)but with the failure classifier / reason supplied as strings. Used by the write-side bulk-item bridge, which receives ES error responses rather than Java exceptions. -
recordWindowFailure
Record a page-level read failure keyed by the failed time window. The window bounds also form the ES document id (window:<tsFrom>-<tsTo>) so repeated failures on the same window merge into one document; a burst of chunked cycles hitting the same poison rows produces a single DLQ entry with an incrementing failureCount, not N of them.dbIdis left null (window-level, not node-level) and the message is prefixed with the window bounds so an operator can see the range at a glance.
-