Class ServiceStubsOptions

java.lang.Object
io.temporal.serviceclient.ServiceStubsOptions
Direct Known Subclasses:
CloudServiceStubsOptions, OperatorServiceStubsOptions, WorkflowServiceStubsOptions

public class ServiceStubsOptions extends Object
  • Field Details

    • DEFAULT_LOCAL_DOCKER_TARGET

      public static final String DEFAULT_LOCAL_DOCKER_TARGET
      See Also:
    • DEFAULT_RPC_TIMEOUT

      public static final Duration DEFAULT_RPC_TIMEOUT
      Default RPC timeout used for all non-long-poll and non-query calls.
    • DEFAULT_CONNECTION_BACKOFF_RESET_FREQUENCY

      public static final Duration DEFAULT_CONNECTION_BACKOFF_RESET_FREQUENCY
      Default timeout that will be used to reset connection backoff.
    • DEFAULT_GRPC_RECONNECT_FREQUENCY

      public static final Duration DEFAULT_GRPC_RECONNECT_FREQUENCY
      Default timeout that will be used to enter idle channel state and reconnect to temporal server.
    • channel

      protected final io.grpc.ManagedChannel channel
    • target

      protected final String target
      target string to use for connection/channel in ManagedChannelBuilder.forTarget(String)
    • channelInitializer

      @Nullable protected final Consumer<io.grpc.ManagedChannelBuilder<?>> channelInitializer
    • enableHttps

      protected final Boolean enableHttps
      Indicates whether basic HTTPS/SSL/TLS should be enabled. Null means not explicitly set by the user, allowing runtime derivation of the effective value.
    • apiKeyProvided

      protected final boolean apiKeyProvided
      Indicates whether an API key was provided, used for automatic TLS enablement
    • sslContext

      protected final io.grpc.netty.shaded.io.netty.handler.ssl.SslContext sslContext
      The user provided context for SSL/TLS over gRPC *
    • healthCheckAttemptTimeout

      protected final Duration healthCheckAttemptTimeout
      HealthCheckAttemptTimeout specifies how to long to wait for service response on each health check attempt. Default: 5s.
    • systemInfoTimeout

      protected final Duration systemInfoTimeout
      SystemInfoTimeout specifies how to long to wait for service response on each health check attempt. Default: 5s.
    • healthCheckTimeout

      protected final Duration healthCheckTimeout
      HealthCheckTimeout defines how long client should be sending health check requests to the server before concluding that it is unavailable. Defaults to 10s.
    • enableKeepAlive

      protected final boolean enableKeepAlive
      Enables keep alive ping from client to the server, which can help drop abruptly closed connections faster.
    • keepAliveTime

      protected final Duration keepAliveTime
      Interval at which server will be pinged in order to determine if connections are still alive.
    • keepAliveTimeout

      protected final Duration keepAliveTimeout
      Amount of time that client would wait for the keep alive ping response from the server before closing the connection.
    • keepAlivePermitWithoutStream

      protected final boolean keepAlivePermitWithoutStream
      If true, keep alive ping will be allowed when there are no active RPCs.
    • rpcTimeout

      protected final Duration rpcTimeout
      The gRPC timeout
    • connectionBackoffResetFrequency

      protected final Duration connectionBackoffResetFrequency
      Frequency at which connection backoff is going to be reset
    • grpcReconnectFrequency

      protected final Duration grpcReconnectFrequency
      Frequency at which grpc connection channel will be moved into an idle state, triggering a new connection to the temporal frontend host.
    • headers

      protected final io.grpc.Metadata headers
      Optional gRPC headers
    • grpcMetadataProviders

      protected final Collection<GrpcMetadataProvider> grpcMetadataProviders
      gRPC metadata/headers providers to be called on each gRPC request to supply additional headers
    • grpcClientInterceptors

      protected final Collection<io.grpc.ClientInterceptor> grpcClientInterceptors
      gRPC client interceptors to be added to gRPC channel
    • metricsScope

      protected final com.uber.m3.tally.Scope metricsScope
    • grpcCompression

      protected final GrpcCompression grpcCompression
      Outbound transport-level gRPC compression.
  • Method Details

    • getChannel

      public io.grpc.ManagedChannel getChannel()
      Returns:
      fully custom user-configured externally provided gRPC channel to use
      See Also:
    • getTarget

      public String getTarget()
      Returns:
      the target string to use for connection/channel in ManagedChannelBuilder.forTarget(String)
    • getChannelInitializer

      @Nullable public Consumer<io.grpc.ManagedChannelBuilder<?>> getChannelInitializer()
      Gives an opportunity to provide some additional configuration to the channel builder or override configurations done by the Temporal Stubs.

      Advanced API

      Returns:
      listener that will be called as a last step of channel creation if the channel is configured by ServiceStubsOptions.Builder.setTarget(String).
    • getEnableHttps

      public boolean getEnableHttps()
      Returns whether gRPC should use SSL/TLS. This method computes the effective value based on:

      Note: When getSslContext() is set, TLS is handled by the SSL context regardless of this value.

      Returns:
      if gRPC should use SSL/TLS
    • getSslContext

      public io.grpc.netty.shaded.io.netty.handler.ssl.SslContext getSslContext()
      Returns:
      the gRPC SSL Context to use
    • getHealthCheckAttemptTimeout

      public Duration getHealthCheckAttemptTimeout()
      Returns:
      how to long to wait for service response on each health check attempt
    • getSystemInfoTimeout

      public Duration getSystemInfoTimeout()
      Returns:
      The timeout for the RPC made by the client to fetch server capabilities.
    • getHealthCheckTimeout

      public Duration getHealthCheckTimeout()
      Returns:
      duration of time to wait while checking server connection when creating new client
    • getEnableKeepAlive

      public boolean getEnableKeepAlive()
      Returns:
      true if ping from client to the server is enabled, which can help detect and drop abruptly closed connections faster
    • getKeepAliveTime

      public Duration getKeepAliveTime()
      Returns:
      interval at which server will be pinged in order to determine if connections are still alive
    • getKeepAliveTimeout

      public Duration getKeepAliveTimeout()
      Returns:
      amount of time that client would wait for the keep alive ping response from the server before closing the connection
    • getKeepAlivePermitWithoutStream

      public boolean getKeepAlivePermitWithoutStream()
      Returns:
      if keep alive ping will be allowed when there are no active RPCs
    • getRpcTimeout

      public Duration getRpcTimeout()
      Returns:
      the rpc timeout value
    • getConnectionBackoffResetFrequency

      public Duration getConnectionBackoffResetFrequency()
      Returns:
      frequency at which connection backoff should be reset or null if backoff reset is disabled
    • getGrpcReconnectFrequency

      public Duration getGrpcReconnectFrequency()
      Returns:
      frequency at which grpc channel should be moved into an idle state
    • getHeaders

      public io.grpc.Metadata getHeaders()
      Returns:
      gRPC headers to be added to every call
    • getGrpcMetadataProviders

      public Collection<GrpcMetadataProvider> getGrpcMetadataProviders()
      Returns:
      gRPC metadata/headers providers to be called on each gRPC request to supply additional headers
    • getGrpcClientInterceptors

      public Collection<io.grpc.ClientInterceptor> getGrpcClientInterceptors()
      Returns:
      gRPC client interceptors to be added to gRPC channel
    • getMetricsScope

      @Nonnull public com.uber.m3.tally.Scope getMetricsScope()
      Returns:
      scope to be used for metrics reporting
    • getGrpcCompression

      @Nonnull public GrpcCompression getGrpcCompression()
      Returns:
      outbound transport-level gRPC compression used for requests.
      See Also:
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object