Class EventEmitter
java.lang.Object
ai.pipestream.module.pipelineprobe.pipelinecrawl.EventEmitter
Wraps the gRPC response observer with the boilerplate common to every
progress event: serialization on the observer, Timestamp build, pretty
step name lookup. Single place where we hold the
synchronized(observer) contract.
Step ids are a small fixed vocabulary
(init/dispatch/running/summary); the FE
keys on step_id to render the four progress rows. Adding a new
step id requires updating both this class's PRETTY_NAMES and
the FE's progress-feed.
Not thread-safe to construct multiple instances against the same observer — there is exactly one EventEmitter per orchestration run.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEventEmitter(io.grpc.stub.StreamObserver<ai.pipestream.testing.harness.v1.RunPipelineCrawlResponse> observer) Creates the emitter bound to a single run's response observer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the response stream.voidemit(String stepId, ai.pipestream.testing.harness.v1.E2EStepOutcome outcome, String message, long durationMs, List<ai.pipestream.testing.harness.v1.ObservationSnapshot> observations) Push a single progress event.voidemit(String stepId, ai.pipestream.testing.harness.v1.E2EStepOutcome outcome, String message, long durationMs, List<ai.pipestream.testing.harness.v1.ObservationSnapshot> observations, com.google.protobuf.Struct details) Push a single progress event carrying a free-formdetailsStruct (e.g.voidemitOutput(String message, com.google.protobuf.Struct details) Emit an out-of-band "output" event carrying the final processed document (single-doc flow) indetails.
-
Field Details
-
TOTAL_STEPS
public static final int TOTAL_STEPSAll step ids we emit, in order.- See Also:
-
-
Constructor Details
-
EventEmitter
public EventEmitter(io.grpc.stub.StreamObserver<ai.pipestream.testing.harness.v1.RunPipelineCrawlResponse> observer) Creates the emitter bound to a single run's response observer.- Parameters:
observer- the gRPC response stream all events are written to; must be non-null- Throws:
IllegalArgumentException- ifobserveris null
-
-
Method Details
-
emit
public void emit(String stepId, ai.pipestream.testing.harness.v1.E2EStepOutcome outcome, String message, long durationMs, List<ai.pipestream.testing.harness.v1.ObservationSnapshot> observations) Push a single progress event.stepIdmust be one of the keys inPRETTY_NAMES; an unknown id throws — drift between this class and the FE is a bug, not a fallback case.- Parameters:
stepId- the step id to emit; must be a known key (delegates with no details)outcome- the step's outcomemessage- a human-readable status message for the stepdurationMs- the step's elapsed time in millisecondsobservations- observation snapshots to attach, or null/empty for none
-
emit
public void emit(String stepId, ai.pipestream.testing.harness.v1.E2EStepOutcome outcome, String message, long durationMs, List<ai.pipestream.testing.harness.v1.ObservationSnapshot> observations, com.google.protobuf.Struct details) Push a single progress event carrying a free-formdetailsStruct (e.g. the OS-drain phase's per-tick receipt + index counts).- Parameters:
stepId- the step id to emit; must be a known key inPRETTY_NAMESoutcome- the step's outcomemessage- a human-readable status message for the stepdurationMs- the step's elapsed time in millisecondsobservations- observation snapshots to attach, or null/empty for nonedetails- a free-form details Struct to attach, or null for none- Throws:
IllegalArgumentException- ifstepIdis not a known step id
-
emitOutput
Emit an out-of-band "output" event carrying the final processed document (single-doc flow) indetails. NOT a numbered progress step —step_numberstays 0 so the 4-step progress bar is untouched; the FE keys offstep_id == "output"to render the output panel.- Parameters:
message- a short caption (e.g. the doc id)details- the decodedPipeDocas a Struct (raw vectors stripped)
-
close
public void close()Close the response stream. Called once at the end of the orchestration run regardless of outcome. Safe to call after the stream is already torn down (logs at debug, doesn't propagate).
-