Class DurableTaskGrpcWorkerBuilder

java.lang.Object
io.dapr.durabletask.DurableTaskGrpcWorkerBuilder

public final class DurableTaskGrpcWorkerBuilder extends Object
Builder object for constructing customized DurableTaskGrpcWorker instances.
  • Constructor Details

    • DurableTaskGrpcWorkerBuilder

      public DurableTaskGrpcWorkerBuilder()
  • Method Details

    • addOrchestration

      public DurableTaskGrpcWorkerBuilder addOrchestration(TaskOrchestrationFactory factory)
      Adds an orchestration factory to be used by the constructed DurableTaskGrpcWorker.
      Parameters:
      factory - an orchestration factory to be used by the constructed DurableTaskGrpcWorker
      Returns:
      this builder object
    • addActivity

      public DurableTaskGrpcWorkerBuilder addActivity(TaskActivityFactory factory)
      Adds an activity factory to be used by the constructed DurableTaskGrpcWorker.
      Parameters:
      factory - an activity factory to be used by the constructed DurableTaskGrpcWorker
      Returns:
      this builder object
    • grpcChannel

      public DurableTaskGrpcWorkerBuilder 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 worker is closed. Rather, the caller remains responsible for shutting down the channel after disposing the worker.

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

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

      public DurableTaskGrpcWorkerBuilder 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
    • dataConverter

      public DurableTaskGrpcWorkerBuilder 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
    • maximumTimerInterval

      public DurableTaskGrpcWorkerBuilder maximumTimerInterval(Duration maximumTimerInterval)
      Sets the maximum timer interval. If not specified, the default maximum timer interval duration will be used. The default maximum timer interval duration is 3 days.
      Parameters:
      maximumTimerInterval - the maximum timer interval
      Returns:
      this builder object
    • withExecutorService

      public DurableTaskGrpcWorkerBuilder withExecutorService(ExecutorService executorService)
      Sets the executor service that will be used to execute threads.
      Parameters:
      executorService - ExecutorService.
      Returns:
      this builder object.
    • appId

      public DurableTaskGrpcWorkerBuilder appId(String appId)
      Sets the app ID for cross-app workflow routing.

      This app ID is used to identify this worker in cross-app routing scenarios. It should match the app ID configured in the Dapr sidecar.

      Parameters:
      appId - the app ID for this worker
      Returns:
      this builder object
    • build

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