Class EngineGraphClient

java.lang.Object
ai.pipestream.module.pipelineprobe.grpc.EngineGraphClient

@ApplicationScoped public class EngineGraphClient extends Object
gRPC client wrapper for engine pipeline-graph queries used by the pipeline-crawl orchestrator. Uses the same GrpcRetry + per-call deadline pattern as GraphBinder and AccountManager — no MicroProfile @Timeout on blocking stubs (it does not cancel the underlying gRPC call and left setup appearing hung for 30s with no SSE update).
  • Constructor Details

    • EngineGraphClient

      public EngineGraphClient()
      Creates the engine pipeline-graph client. The gRPC stub is injected by the container; instances are managed by CDI.
  • Method Details

    • isGraphCached

      public boolean isGraphCached(String graphId, long graphVersion)
      Returns true if the engine has the given graph version cached and ready to route to.
      Parameters:
      graphId - the pipeline graph id to query
      graphVersion - the graph version that must be the one the engine has active
      Returns:
      true when the engine reports the graph found and its active version equals graphVersion; false otherwise
    • requireGraphCached

      public void requireGraphCached(String graphId, long graphVersion)
      Asserts that the given graph version is cached on the engine, throwing if it is not (after the retry budget in isGraphCached(String, long) is spent).
      Parameters:
      graphId - the pipeline graph id that must be cached
      graphVersion - the graph version that must be active on the engine
      Throws:
      RuntimeException - if the graph version is not cached on the engine
    • getOrCreateActiveGraph

      public EngineGraphClient.ActiveGraph getOrCreateActiveGraph(ai.pipestream.config.v1.PipelineGraph graph, String graphId, String clusterId, String createdBy)
      Idempotent get-or-create for an active pipeline graph in a cluster.
      Parameters:
      graph - the pipeline graph definition to activate when none is active yet
      graphId - the graph id to look up / activate under
      clusterId - the cluster the graph is scoped to
      createdBy - audit identity recorded as the graph's creator
      Returns:
      the active graph's id and version, with created indicating whether it was newly activated (true) or an existing one was reused (false)
    • getOrCreateDatasourceInstance

      public String getOrCreateDatasourceInstance(String graphId, long graphVersion, String datasourceId, String entryNodeId, String createdBy)
      Idempotent get-or-create of the datasource-to-entry-node binding for a graph version. Lists the graph's existing datasource instances and reuses the one already bound to datasourceId if present; otherwise creates a new binding from the datasource to entryNodeId.
      Parameters:
      graphId - the graph id the binding lives under
      graphVersion - the graph version the binding lives under
      datasourceId - the datasource to bind
      entryNodeId - the graph node the datasource feeds into when a new binding is created
      createdBy - audit identity recorded as the binding's creator
      Returns:
      the datasource instance id of the reused or newly created binding
      Throws:
      RuntimeException - if creating the datasource instance reports success=false