Called around each proxied activity invocation. Code before next()
runs in the before phase; code after next() runs in the after phase
once the activity result is available on replay.
Metadata about the activity being called (args may be modified)
The workflow context map (same as WorkflowInterceptor receives)
Call to proceed to the next interceptor or the core activity function
The activity result (from replay or after interruption/re-execution)
Interceptor for individual proxied activity calls within a workflow. Runs inside the workflow's async local storage context, so all Durable workflow methods (proxyActivities, sleepFor, waitFor, execChild, etc.) are available.
Activity interceptors wrap proxied activity calls in an onion pattern, supporting both before and after phases:
Before phase (code before
await next()): Runs before the activity executes. The interceptor can inspect or modifyactivityCtx.argsto transform the activity input before it is sent.After phase (code after
await next()): Runs on replay once the activity result is available. The interceptor receives the activity output as the return value ofnext()and can inspect or transform it.On first execution,
next()registers the activity with the interruption system and throws (the activity has not completed yet). On replay,next()returns the stored result and the after-phase code executes. This follows the same deterministic replay pattern as workflow interceptors.Example