Package com.zb.mom.ww.mxgateway.client
Class GalaxyRepositoryClient
java.lang.Object
com.zb.mom.ww.mxgateway.client.GalaxyRepositoryClient
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionGalaxyRepositoryClient(io.grpc.Channel channel, MxGatewayClientOptions options) Constructs a client over a caller-managedChannel. -
Method Summary
Modifier and TypeMethodDescriptionbrowse()Lazy-browse entry point: fetches the root layer of the Galaxy hierarchy.browse(BrowseChildrenOptions options) Lazy-browse entry point with caller-supplied filters / shape.Issues a singleBrowseChildrenRPC and returns the raw reply.voidclose()voidShuts the owned channel down and waits up to the configured connect timeout for termination, forcibly shutting it down on timeout.static GalaxyRepositoryClientconnect(MxGatewayClientOptions options) Builds a new client and owns its channel;close()shuts the channel down.Invokes theDiscoverHierarchyRPC and returns the generatedGalaxyRepositoryOuterClass.GalaxyObjectmessages directly.InvokesDiscoverHierarchyasynchronously.Invokes theGetLastDeployTimeRPC.InvokesGetLastDeployTimeasynchronously.Returns the underlying async stub.Returns the underlying blocking stub with the per-call deadline applied.Returns the underlying future stub with the per-call deadline applied.booleanInvokes theTestConnectionRPC and returns theokflag.InvokesTestConnectionasynchronously.watchDeployEvents(Instant lastSeenDeployTime) Subscribes toWatchDeployEventsvia the async stub and consumes results through a blocking iterator.watchDeployEventsAsync(Instant lastSeenDeployTime, io.grpc.stub.StreamObserver<GalaxyRepositoryOuterClass.DeployEvent> observer) Subscribes toWatchDeployEventsvia the async stub, dispatching each event toobserver.watchDeployEventsIterator(Instant lastSeenDeployTime) Iterator-style alias forwatchDeployEvents(Instant)matching the task-spec signature.
-
Constructor Details
-
GalaxyRepositoryClient
Constructs a client over a caller-managedChannel. The caller owns channel lifecycle;close()is a no-op for this constructor.- Parameters:
channel- the gRPC channel to use for outbound callsoptions- the client options carrying the API key and timeouts- Throws:
NullPointerException- ifoptionsisnull
-
-
Method Details
-
connect
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 theTestConnectionRPC and returns theokflag.- Returns:
truewhen the gateway reached the Galaxy Repository database- Throws:
MxGatewayException- on transport or protocol failure
-
testConnectionAsync
InvokesTestConnectionasynchronously.- Returns:
- a future completed with the
okflag, or completed exceptionally withMxGatewayExceptionon failure
-
getLastDeployTime
Invokes theGetLastDeployTimeRPC.- Returns:
- the time of the last deploy, or
Optional.empty()when the server reportspresent=false - Throws:
MxGatewayException- on transport or protocol failure
-
getLastDeployTimeAsync
InvokesGetLastDeployTimeasynchronously.- Returns:
- a future completed with the time of the last deploy, or
Optional.empty()when the server reportspresent=false; completed exceptionally withMxGatewayExceptionon failure
-
discoverHierarchy
Invokes theDiscoverHierarchyRPC and returns the generatedGalaxyRepositoryOuterClass.GalaxyObjectmessages 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
InvokesDiscoverHierarchyasynchronously.- Returns:
- a future completed with the Galaxy object hierarchy, or completed
exceptionally with
MxGatewayExceptionon failure
-
browse
Lazy-browse entry point: fetches the root layer of the Galaxy hierarchy. Each returnedLazyBrowseNodecan be expanded on demand viaLazyBrowseNode.expand()to load its direct children.- Returns:
- the root nodes (no parent selector) with default options
- Throws:
MxGatewayException- on transport or protocol failure
-
browse
Lazy-browse entry point with caller-supplied filters / shape.- Parameters:
options- filter and shape options;nullmeansBrowseChildrenOptions.empty()- Returns:
- the root nodes matching the options
- Throws:
MxGatewayException- on transport or protocol failure
-
browseChildrenRaw
public GalaxyRepositoryOuterClass.BrowseChildrenReply browseChildrenRaw(GalaxyRepositoryOuterClass.BrowseChildrenRequest request) Issues a singleBrowseChildrenRPC 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
Subscribes toWatchDeployEventsvia 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 forwatchDeployEvents(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 toWatchDeployEventsvia the async stub, dispatching each event toobserver. The returned subscription is cancellable andAutoCloseable.- Parameters:
lastSeenDeployTime- optional cached deploy time for bootstrap suppressionobserver- caller-supplied observer that receives events and completion- Returns:
- a cancellable subscription handle
- Throws:
NullPointerException- ifobserverisnull
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
closeAndAwaitTermination
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
-