Class JdbcDispatchSubscriber
java.lang.Object
ai.pipestream.module.pipelineprobe.pipelinecrawl.JdbcDispatchSubscriber
Subscribes to the JDBC connector's
streamCrawlStatus server-streaming RPC and hydrates a RunLedger
from the per-event payload.
Three event types matter:
JdbcCrawlEventType.JDBC_CRAWL_EVENT_TYPE_EXPECTED_COUNT_KNOWN— setsRunLedger.setExpectedRowCount(int).JdbcCrawlEventType.JDBC_CRAWL_EVENT_TYPE_DOC_DISPATCHED— adds theemitted_doc_idtoRunLedger.recordDispatched(String).JdbcCrawlEventType.JDBC_CRAWL_EVENT_TYPE_DISPATCH_COMPLETE— flipsRunLedger.markDispatchComplete().
COMPLETION, DELETE, sub-crawl progress
with event_type=UNSPECIFIED) are ignored — they're informational
for other consumers but don't affect the ledger.
The subscription runs in its own gRPC Context.CancellableContext
so the orchestrator can cancel cleanly via JdbcDispatchSubscriber.Subscription.cancel()
regardless of whether the connector has closed the stream.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe active subscription. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionOpen a subscription againsttriggerId.
-
Constructor Details
-
JdbcDispatchSubscriber
public JdbcDispatchSubscriber()Creates the JDBC dispatch subscriber. Managed by CDI.
-
-
Method Details
-
subscribe
Open a subscription againsttriggerId. Events stream intoledger. Caller mustJdbcDispatchSubscriber.Subscription.cancel()when the run terminates regardless of outcome.- Parameters:
triggerId- the connector trigger id to stream crawl status for; must be non-emptyledger- theRunLedgerhydrated from the streamed events; must be non-null- Returns:
- the live
JdbcDispatchSubscriber.Subscription, which the caller must cancel when the run terminates - Throws:
IllegalArgumentException- iftriggerIdis null/empty orledgeris null
-