Class S3DispatchSubscriber

java.lang.Object
ai.pipestream.module.pipelineprobe.pipelinecrawl.S3DispatchSubscriber

@ApplicationScoped public class S3DispatchSubscriber extends Object
Subscribes to the s3-connector's StreamCrawlStatus for one crawl and mirrors its state into a S3DispatchSubscriber.S3DispatchState the orchestrator's wait loop reads each tick — the S3 counterpart of JdbcDispatchSubscriber, but count-based: the connector reports how many objects it dispatched (and, at COMPLETED, the final total) rather than per-doc ids.

House pattern: blocking server-streaming iterator drained on a dedicated virtual thread; no Mutiny. The connector's stream has state-snapshot semantics (current state arrives immediately), so there is no subscribe race to defend against.

If the stream cannot be established (older connector without the RPC, connector restarted and forgot the crawl), the state reports S3DispatchSubscriber.S3DispatchState.unavailable() and the wait loop falls back to its legacy stability gate — degraded, not broken.

  • Constructor Details

    • S3DispatchSubscriber

      public S3DispatchSubscriber()
      Creates the subscriber; its gRPC stub is injected and it is managed by CDI.
  • Method Details

    • subscribe

      public S3DispatchSubscriber.S3DispatchState subscribe(String requestId)
      Open the status stream for requestId and drain it on a virtual thread. Returns immediately; the returned state updates as responses arrive and stops changing once the stream ends.
      Parameters:
      requestId - the crawl request id whose status stream to subscribe to
      Returns:
      a live state mirror that is updated by a background virtual thread as status responses arrive