Interface ServiceStubs<B,F>

All Known Subinterfaces:
CloudServiceStubs, OperatorServiceStubs, WorkflowServiceStubs

public interface ServiceStubs<B,F>
  • Method Details

    • blockingStub

      B blockingStub()
      Returns:
      Blocking (synchronous) stub that allows direct calls to service.
    • futureStub

      F futureStub()
      Returns:
      Future (asynchronous) stub that allows direct calls to service.
    • getRawChannel

      io.grpc.ManagedChannel getRawChannel()
      Returns:
      the gRPC channel user by the stubs. This channel may be created internally by the stub or passed to it outside in the Options. This is a "raw" gRPC ManagedChannel, not an intercepted channel.
    • shutdown

      void shutdown()
    • shutdownNow

      void shutdownNow()
    • isShutdown

      boolean isShutdown()
    • isTerminated

      boolean isTerminated()
    • awaitTermination

      boolean awaitTermination(long timeout, TimeUnit unit)
      Awaits for gRPC stubs shutdown up to the specified timeout. The shutdown has to be initiated through shutdown() or shutdownNow().

      If waiting thread is interrupted, returns false and sets Thread.interrupted() flag

      Returns:
      false if timed out or the thread was interrupted.
    • connect

      void connect(@Nullable Duration timeout)
      Establishes a connection with Temporal Server. If the Server is not available, retries waits for timeout duration.
      Parameters:
      timeout - how long to wait for a successful connection with the server. If null, rpcTimeout configured for this stub will be used.
      Throws:
      io.grpc.StatusRuntimeException - if the server is unavailable after timeout
      IllegalStateException - if the channel is already shutdown
    • healthCheck

      io.grpc.health.v1.HealthCheckResponse healthCheck()
      Checks service health using gRPC standard Health Check: https://github.com/grpc/grpc/blob/master/doc/health-checking.md

      ServiceStubsOptions.rpcTimeout is used as a timeout for this call.

      Please note that this method throws if the service Health Check endpoint can't be reached.

      Returns:
      gRPC Health HealthCheckResponse
      Throws:
      io.grpc.StatusRuntimeException - if the service Health Check endpoint is unavailable.
    • getServerCapabilities

      Note: This method is needed mostly for internal SDK purposes only to adjust behavior for different server versions.
      Returns:
      Supplier of Server Capabilities. This method returns a supplier instead of the instance to allow for lazy initialization of the capabilities while eager wiring of the components. This also leaves the flexibility to implement dynamic reloading in the future.