Class JdbcDispatchSubscriber.Subscription
java.lang.Object
ai.pipestream.module.pipelineprobe.pipelinecrawl.JdbcDispatchSubscriber.Subscription
- All Implemented Interfaces:
io.grpc.stub.StreamObserver<ai.pipestream.connector.jdbc.v1.StreamCrawlStatusResponse>
- Enclosing class:
JdbcDispatchSubscriber
public static final class JdbcDispatchSubscriber.Subscription
extends Object
implements io.grpc.stub.StreamObserver<ai.pipestream.connector.jdbc.v1.StreamCrawlStatusResponse>
The active subscription. Three roles:
- Implements
StreamObserver— receives events from the connector and hydrates the boundRunLedger. - Holds the
Context.CancellableContextso the orchestrator cancancel()the stream when the run ends regardless of whether the connector closed it first. - Exposes any real failure to the orchestrator via
terminalErrorIfReal()so the wait loop can fail fast on connector errors instead of riding the deadline.
Two failure paths are tracked separately:
- Stream errors from
onError(Throwable)— gRPC transport failures, connector aborts, our own cancel. - Processing errors from
onNext(StreamCrawlStatusResponse)— malformed events from the connector (e.g. negative expected_row_count, missing emitted_doc_id) that the per-event handler refuses to silently accept.
CANCELLED; we keep the original processing error around so
it isn't silently downgraded to "subscription cancelled".-
Method Details
-
onNext
public void onNext(ai.pipestream.connector.jdbc.v1.StreamCrawlStatusResponse evt) - Specified by:
onNextin interfaceio.grpc.stub.StreamObserver<ai.pipestream.connector.jdbc.v1.StreamCrawlStatusResponse>
-
onError
- Specified by:
onErrorin interfaceio.grpc.stub.StreamObserver<ai.pipestream.connector.jdbc.v1.StreamCrawlStatusResponse>
-
onCompleted
public void onCompleted()- Specified by:
onCompletedin interfaceio.grpc.stub.StreamObserver<ai.pipestream.connector.jdbc.v1.StreamCrawlStatusResponse>
-
cancel
public void cancel()Cancel the subscription. The connector's stream will close withStatus.CANCELLED;onError(Throwable)sees that and treats it as expected (no error) — unless an earlierprocessingErroris already recorded, in which caseterminalErrorIfReal()surfaces that. The parent subscriber's tracking set is updated whenonErrororonCompletedfires in response. -
terminalErrorIfReal
The first real failure the subscription saw, ornullif everything has gone fine so far. "Real" means:- a connector-emitted malformed event (rejected by our onNext), OR
- a stream error that is NOT
CANCELLEDfrom our own cancel.
processingErrortakes precedence — when our onNext throws, gRPC also fires onError with CANCELLED, and we want to report the original cause not the cancellation that masked it.- Returns:
- the first real failure (processing error, or a non-CANCELLED
stream error), or
nullif none has occurred
-