Class GalaxyRepositoryClient

java.lang.Object
com.zb.mom.ww.mxgateway.client.GalaxyRepositoryClient
All Implemented Interfaces:
AutoCloseable

public final class GalaxyRepositoryClient extends Object implements AutoCloseable
Thin wrapper around the generated GalaxyRepositoryGrpc stubs that exposes the three metadata-only RPCs of the Galaxy Repository service in idiomatic Java types. Mirrors the constructor and option-handling style of MxGatewayClient.
  • Constructor Details

    • GalaxyRepositoryClient

      public GalaxyRepositoryClient(io.grpc.Channel channel, MxGatewayClientOptions options)
      Constructs a client over a caller-managed Channel. The caller owns channel lifecycle; close() is a no-op for this constructor.
      Parameters:
      channel - the gRPC channel to use for outbound calls
      options - the client options carrying the API key and timeouts
      Throws:
      NullPointerException - if options is null
  • Method Details

    • connect

      public static GalaxyRepositoryClient connect(MxGatewayClientOptions options)
      Builds a new client and owns its channel; close() shuts the channel down.
      Parameters:
      options - the client options carrying the endpoint and credentials
      Returns:
      a connected client
    • rawBlockingStub

      Returns the underlying blocking stub with the per-call deadline applied.
      Returns:
      the blocking stub
    • rawFutureStub

      Returns the underlying future stub with the per-call deadline applied.
      Returns:
      the future stub
    • rawAsyncStub

      Returns the underlying async stub. Stream deadlines are applied per call.
      Returns:
      the async stub
    • testConnection

      public boolean testConnection()
      Invokes the TestConnection RPC and returns the ok flag.
      Returns:
      true when the gateway reached the Galaxy Repository database
      Throws:
      MxGatewayException - on transport or protocol failure
    • testConnectionAsync

      public CompletableFuture<Boolean> testConnectionAsync()
      Invokes TestConnection asynchronously.
      Returns:
      a future completed with the ok flag, or completed exceptionally with MxGatewayException on failure
    • getLastDeployTime

      public Optional<Instant> getLastDeployTime()
      Invokes the GetLastDeployTime RPC.
      Returns:
      the time of the last deploy, or Optional.empty() when the server reports present=false
      Throws:
      MxGatewayException - on transport or protocol failure
    • getLastDeployTimeAsync

      public CompletableFuture<Optional<Instant>> getLastDeployTimeAsync()
      Invokes GetLastDeployTime asynchronously.
      Returns:
      a future completed with the time of the last deploy, or Optional.empty() when the server reports present=false; completed exceptionally with MxGatewayException on failure
    • discoverHierarchy

      public List<GalaxyRepositoryOuterClass.GalaxyObject> discoverHierarchy()
      Invokes the DiscoverHierarchy RPC and returns the generated GalaxyRepositoryOuterClass.GalaxyObject messages directly. Callers can read every field of the proto message without an extra DTO layer.
      Returns:
      the Galaxy object hierarchy
      Throws:
      MxGatewayException - on transport or protocol failure
    • discoverHierarchyAsync

      Invokes DiscoverHierarchy asynchronously.
      Returns:
      a future completed with the Galaxy object hierarchy, or completed exceptionally with MxGatewayException on failure
    • browse

      public List<LazyBrowseNode> browse()
      Lazy-browse entry point: fetches the root layer of the Galaxy hierarchy. Each returned LazyBrowseNode can be expanded on demand via LazyBrowseNode.expand() to load its direct children.
      Returns:
      the root nodes (no parent selector) with default options
      Throws:
      MxGatewayException - on transport or protocol failure
    • browse

      public List<LazyBrowseNode> browse(BrowseChildrenOptions options)
      Lazy-browse entry point with caller-supplied filters / shape.
      Parameters:
      options - filter and shape options; null means BrowseChildrenOptions.empty()
      Returns:
      the root nodes matching the options
      Throws:
      MxGatewayException - on transport or protocol failure
    • browseChildrenRaw

      Issues a single BrowseChildren RPC and returns the raw reply. Callers wanting full control over pagination can drive the loop themselves.
      Parameters:
      request - the request to send
      Returns:
      the reply
      Throws:
      MxGatewayException - on transport or protocol failure
    • watchDeployEvents

      public DeployEventStream watchDeployEvents(Instant lastSeenDeployTime)
      Subscribes to WatchDeployEvents via the async stub and consumes results through a blocking iterator. Closing the returned stream cancels the underlying gRPC call.
      Parameters:
      lastSeenDeployTime - optional. When non-null, the bootstrap event is suppressed if the cached deploy time matches.
      Returns:
      an iterator-style stream of deploy events
    • watchDeployEventsIterator

      public Iterator<GalaxyRepositoryOuterClass.DeployEvent> watchDeployEventsIterator(Instant lastSeenDeployTime)
      Iterator-style alias for watchDeployEvents(Instant) matching the task-spec signature.
      Parameters:
      lastSeenDeployTime - optional cached deploy time for bootstrap suppression
      Returns:
      an iterator over deploy events
    • watchDeployEventsAsync

      public DeployEventSubscription watchDeployEventsAsync(Instant lastSeenDeployTime, io.grpc.stub.StreamObserver<GalaxyRepositoryOuterClass.DeployEvent> observer)
      Subscribes to WatchDeployEvents via the async stub, dispatching each event to observer. The returned subscription is cancellable and AutoCloseable.
      Parameters:
      lastSeenDeployTime - optional cached deploy time for bootstrap suppression
      observer - caller-supplied observer that receives events and completion
      Returns:
      a cancellable subscription handle
      Throws:
      NullPointerException - if observer is null
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • closeAndAwaitTermination

      public void closeAndAwaitTermination() throws InterruptedException
      Shuts the owned channel down and waits up to the configured connect timeout for termination, forcibly shutting it down on timeout. No-op for clients that do not own their channel.
      Throws:
      InterruptedException - if the calling thread is interrupted while waiting