Class DurableTaskGrpcClientBuilder

java.lang.Object
io.dapr.durabletask.DurableTaskGrpcClientBuilder

public final class DurableTaskGrpcClientBuilder extends Object
Builder class for constructing new DurableTaskClient objects that communicate with a sidecar process over gRPC.
  • Constructor Details

    • DurableTaskGrpcClientBuilder

      public DurableTaskGrpcClientBuilder()
  • Method Details

    • dataConverter

      public DurableTaskGrpcClientBuilder dataConverter(DataConverter dataConverter)
      Sets the DataConverter to use for converting serializable data payloads.
      Parameters:
      dataConverter - the DataConverter to use for converting serializable data payloads
      Returns:
      this builder object
    • grpcChannel

      public DurableTaskGrpcClientBuilder grpcChannel(io.grpc.Channel channel)
      Sets the gRPC channel to use for communicating with the sidecar process.

      This builder method allows you to provide your own gRPC channel for communicating with the Durable Task sidecar endpoint. Channels provided using this method won't be closed when the client is closed. Rather, the caller remains responsible for shutting down the channel after disposing the client.

      If not specified, a gRPC channel will be created automatically for each constructed DurableTaskClient.

      Parameters:
      channel - the gRPC channel to use
      Returns:
      this builder object
    • tracer

      public DurableTaskGrpcClientBuilder tracer(io.opentelemetry.api.trace.Tracer tracer)
      Sets the Tracer object to be used by DurableTaskClient to emit traces.
      Parameters:
      tracer - to be used by the DurableTaskClient
      Returns:
      this builder object
    • port

      public DurableTaskGrpcClientBuilder port(int port)
      Sets the gRPC endpoint port to connect to. If not specified, the default Durable Task port number will be used.
      Parameters:
      port - the gRPC endpoint port to connect to
      Returns:
      this builder object
    • tlsCaPath

      public DurableTaskGrpcClientBuilder tlsCaPath(String tlsCaPath)
      Sets the path to the TLS CA certificate file for server authentication. If not set, the system's default CA certificates will be used.
      Parameters:
      tlsCaPath - path to the TLS CA certificate file
      Returns:
      this builder object
    • tlsCertPath

      public DurableTaskGrpcClientBuilder tlsCertPath(String tlsCertPath)
      Sets the path to the TLS client certificate file for client authentication. This is used for mTLS (mutual TLS) connections.
      Parameters:
      tlsCertPath - path to the TLS client certificate file
      Returns:
      this builder object
    • tlsKeyPath

      public DurableTaskGrpcClientBuilder tlsKeyPath(String tlsKeyPath)
      Sets the path to the TLS client key file for client authentication. This is used for mTLS (mutual TLS) connections.
      Parameters:
      tlsKeyPath - path to the TLS client key file
      Returns:
      this builder object
    • insecure

      public DurableTaskGrpcClientBuilder insecure(boolean insecure)
      Sets whether to use insecure (plaintext) mode for gRPC communication. When set to true, TLS will be disabled and communication will be unencrypted. This should only be used for development/testing.
      Parameters:
      insecure - whether to use insecure mode
      Returns:
      this builder object
    • build

      public DurableTaskClient build()
      Initializes a new DurableTaskClient object with the settings specified in the current builder object.
      Returns:
      a new DurableTaskClient object