# WorkflowActivity (dapr-sdk-workflows 0.12.2 API)
declaration: package: io.dapr.workflows.runtime, interface: WorkflowActivity

Package io.dapr.workflows.runtime

# Interface WorkflowActivity

public interface WorkflowActivity
Common interface for task activity implementations.

Activities are the basic unit of work in a durable task orchestration. Activities are the tasks that are orchestrated in the business process. For example, you might create an orchestrator to process an order. The tasks ay involve checking the inventory, charging the customer, and creating a shipment. Each task would be a separate activity. These activities may be executed serially, in parallel, or some combination of both.

Unlike task orchestrators, activities aren't restricted in the type of work you can do in them. Activity functions are frequently used to make network calls or run CPU intensive operations. An activity can also return data back to the orchestrator function. The Durable Task runtime guarantees that each called activity function will be executed at least once during an orchestration's execution.

Because activities only guarantee at least once execution, it's recommended that activity logic be implemented as idempotent whenever possible.

Activities are scheduled by orchestrators using one of the `WorkflowContext.callActivity(java.lang.String, java.lang.Object, com.microsoft.durabletask.TaskOptions, java.lang.Class<V>)` method overloads.

## Method Summary

Modifier and Type
Method
Description
`Object`
`run(WorkflowActivityContext ctx)`
Executes the activity logic and returns a value which will be serialized and returned to the calling orchestrator.

## Method Details

### run

Object run(WorkflowActivityContext ctx)
Executes the activity logic and returns a value which will be serialized and returned to the calling orchestrator.

Parameters:
  `ctx` - provides information about the current activity execution, like the activity's name and the input data provided to it by the orchestrator.
Returns:
  any serializable value to be returned to the calling orchestrator.