Overview
Workflow code is replayed to reconstruct orchestration state, while activity code can be retried when work fails or its result is uncertain. Those two recovery paths require different properties:
Idempotent vs. deterministic
Compare idempotent vs. deterministic behavior, why workflow code must be deterministic, and why retried activities and side effects must be idempotent.
Workflow Constraints
The determinism constraints for workflow classes dictate that a workflow class must not depend on external state or services that may change over time. This means that a workflow class should not perform any operations that rely on the current date and time, the current user, external network resources, or any other source of potentially changing state.
Activity Constraints
Activities have none of the prior constraints. However, because activities are retryable they should still be idempotent. If your activity creates a charge for a customer then retrying it should not create a duplicate charge.
Constraints Summary
| Constraint | Workflow code | Activity code |