Class UploadStatusService

java.lang.Object
ai.pipestream.connector.intake.status.UploadStatusService

@ApplicationScoped public class UploadStatusService extends Object
Projects the intake lifecycle event stream — DocumentAccepted, DocumentRejected, DocumentError — into the UploadReceipt read-model (upsert by doc_id) and resolves it for the status lookup.

The project* methods are invoked by the event consumer, not the upload path — so the durable write happens off the request thread (publish-then-write). ACCEPTED is sticky: a stale rejection/error arriving after an acceptance never downgrades it, but a later acceptance (a retry of the same deterministic doc_id) does upgrade an earlier failure.

  • Constructor Details

    • UploadStatusService

      public UploadStatusService()
  • Method Details

    • projectAccepted

      public void projectAccepted(ai.pipestream.connector.intake.v1.DocumentAccepted event)
    • projectRejected

      public void projectRejected(ai.pipestream.connector.intake.v1.DocumentRejected event)
    • projectError

      public void projectError(ai.pipestream.connector.intake.v1.DocumentError event)
    • lookup

      public Optional<UploadReceipt> lookup(String docId)
    • resolve

      Resolve the status a signed token points at. The token already binds the doc_id; as defense in depth, a receipt is only reported if it also belongs to the datasource the token is scoped to. A valid token with no row yet (or a never-projected doc) reports PENDING — never a not-found oracle.