Package io.dapr.workflows.runtime

# Class WorkflowRuntimeBuilder

java.lang.Object
io.dapr.workflows.runtime.WorkflowRuntimeBuilder

public class WorkflowRuntimeBuilder extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WorkflowRuntimeBuilder()`
  Constructs the WorkflowRuntimeBuilder.
  `WorkflowRuntimeBuilder(Properties properties)`
  Constructs the WorkflowRuntimeBuilder.
  `WorkflowRuntimeBuilder(org.slf4j.Logger logger)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `WorkflowRuntime`
  `build()`
  Returns a WorkflowRuntime object.
  `<T extends WorkflowActivity>
  WorkflowRuntimeBuilder`
  `registerActivity(Class<T> clazz)`
  Registers an Activity object.
  `<T extends WorkflowActivity>
  WorkflowRuntimeBuilder`
  `registerActivity(String name, Class<T> clazz)`
  Registers an Activity object.
  `<T extends WorkflowActivity>
  WorkflowRuntimeBuilder`
  `registerActivity(String name, T instance)`
  Registers an Activity object.
  `<T extends WorkflowActivity>
  WorkflowRuntimeBuilder`
  `registerActivity(T instance)`
  Registers an Activity object.
  `WorkflowRuntimeBuilder`
  `registerTaskActivityFactory(String activityName, TaskActivityFactory taskActivityFactory)`
  Registers a Task Activity using a `TaskActivityFactory`.
  `WorkflowRuntimeBuilder`
  `registerTaskOrchestrationFactory(String orchestrationName, TaskOrchestrationFactory taskOrchestrationFactory)`
  Registers a Task Orchestration using a `TaskOrchestrationFactory`.
  `<T extends Workflow>
  WorkflowRuntimeBuilder`
  `registerWorkflow(Class<T> clazz)`
  Registers a Workflow object.
  `<T extends Workflow>
  WorkflowRuntimeBuilder`
  `registerWorkflow(String name, Class<T> clazz)`
  Registers a Workflow object.
  `<T extends Workflow>
  WorkflowRuntimeBuilder`
  `registerWorkflow(String name, Class<T> clazz, String versionName, Boolean isLatestVersion)`
  Registers a Workflow object.
  `<T extends Workflow>
  WorkflowRuntimeBuilder`
  `registerWorkflow(String name, T instance, String versionName, Boolean isLatestVersion)`
  Registers a Workflow object.
  `<T extends Workflow>
  WorkflowRuntimeBuilder`
  `registerWorkflow(T instance)`
  Registers a Workflow object.
  `WorkflowRuntimeBuilder`
  `withExecutorService(ExecutorService executorService)`
  Register Executor Service to use with workflow.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### WorkflowRuntimeBuilder

    public WorkflowRuntimeBuilder()
    Constructs the WorkflowRuntimeBuilder.

  - ### WorkflowRuntimeBuilder

    public WorkflowRuntimeBuilder(Properties properties)
    Constructs the WorkflowRuntimeBuilder.
    Parameters:
      `properties` - Properties to use.

  - ### WorkflowRuntimeBuilder

    public WorkflowRuntimeBuilder(org.slf4j.Logger logger)

- ## Method Details

  - ### build

    public WorkflowRuntime build()
    Returns a WorkflowRuntime object.
    Returns:
      A WorkflowRuntime object.

  - ### withExecutorService

    public WorkflowRuntimeBuilder withExecutorService(ExecutorService executorService)
    Register Executor Service to use with workflow.
    Parameters:
      `executorService` - to be used.
    Returns:
      `WorkflowRuntimeBuilder`.

  - ### registerWorkflow

    public <T extends Workflow> WorkflowRuntimeBuilder registerWorkflow(Class<T> clazz)
    Registers a Workflow object.
    Type Parameters:
      `T` - any Workflow type
    Parameters:
      `clazz` - the class being registered
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerWorkflow

    public <T extends Workflow> WorkflowRuntimeBuilder registerWorkflow(String name, Class<T> clazz)
    Registers a Workflow object.
    Type Parameters:
      `T` - any Workflow type
    Parameters:
      `name` - the name of the workflow to register
      `clazz` - the class being registered
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerWorkflow

    public <T extends Workflow> WorkflowRuntimeBuilder registerWorkflow(String name, Class<T> clazz, String versionName, Boolean isLatestVersion)
    Registers a Workflow object.
    Type Parameters:
      `T` - any Workflow type
    Parameters:
      `name` - the name of the workflow to register
      `clazz` - the class being registered
      `versionName` - the version name of the workflow
      `isLatestVersion` - whether the workflow is the latest version
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerWorkflow

    public <T extends Workflow> WorkflowRuntimeBuilder registerWorkflow(T instance)
    Registers a Workflow object.
    Type Parameters:
      `T` - any Workflow type
    Parameters:
      `instance` - the workflow instance being registered
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerWorkflow

    public <T extends Workflow> WorkflowRuntimeBuilder registerWorkflow(String name, T instance, String versionName, Boolean isLatestVersion)
    Registers a Workflow object.
    Type Parameters:
      `T` - any Workflow type
    Parameters:
      `name` - the name of the workflow to register
      `instance` - the workflow instance being registered
      `versionName` - the version name of the workflow
      `isLatestVersion` - whether the workflow is the latest version
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerActivity

    public <T extends WorkflowActivity> WorkflowRuntimeBuilder registerActivity(Class<T> clazz)
    Registers an Activity object.
    Type Parameters:
      `T` - any WorkflowActivity type
    Parameters:
      `clazz` - the class being registered
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerActivity

    public <T extends WorkflowActivity> WorkflowRuntimeBuilder registerActivity(String name, Class<T> clazz)
    Registers an Activity object.
    Type Parameters:
      `T` - any WorkflowActivity type
    Parameters:
      `name` - Name of the activity to register.
      `clazz` - Class of the activity to register.
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerActivity

    public <T extends WorkflowActivity> WorkflowRuntimeBuilder registerActivity(T instance)
    Registers an Activity object.
    Type Parameters:
      `T` - any WorkflowActivity type
    Parameters:
      `instance` - the class instance being registered
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerActivity

    public <T extends WorkflowActivity> WorkflowRuntimeBuilder registerActivity(String name, T instance)
    Registers an Activity object.
    Type Parameters:
      `T` - any WorkflowActivity type
    Parameters:
      `name` - Name of the activity to register.
      `instance` - the class instance being registered
    Returns:
      the WorkflowRuntimeBuilder

  - ### registerTaskActivityFactory

    public WorkflowRuntimeBuilder registerTaskActivityFactory(String activityName, TaskActivityFactory taskActivityFactory)
    Registers a Task Activity using a `TaskActivityFactory`.

    This method allows advanced use cases where activities are created dynamically or require custom instantiation logic instead of relying on class-based or instance-based registration.

    Parameters:
      `activityName` - the logical name of the activity to register
      `taskActivityFactory` - the factory responsible for creating the activity
    Returns:
      the `WorkflowRuntimeBuilder`

  - ### registerTaskOrchestrationFactory

    public WorkflowRuntimeBuilder registerTaskOrchestrationFactory(String orchestrationName, TaskOrchestrationFactory taskOrchestrationFactory)
    Registers a Task Orchestration using a `TaskOrchestrationFactory`.

    This method is intended for advanced scenarios where orchestrations are created programmatically or require custom construction logic, rather than being registered via workflow classes or instances.

    Parameters:
      `orchestrationName` - the logical name of the orchestration to register
      `taskOrchestrationFactory` - the factory responsible for creating the orchestration
    Returns:
      the `WorkflowRuntimeBuilder`