The official temporal documentation talks about local activities. However it is still not very clear what are the advantages or limitations of the local activities and how to code them?
According to this post,
Here is a sequence of steps to execute a single activity workflow.
Here is a sequence of steps to execute a local activity.
CompleteWorkflowExecution
commands. The marker command contains the
result of the local activity execution.The limitations of local activities are:
A caution from @maxim
We’ve seen multiple cases when use of local activities without understanding their limitations caused various production issues. So my advice is to stick to normal activities unless your use case requires very high throughput and large activity fan outs of very short activities.
Code example java-sdk:
private final RetryOptions retryOptions = RetryOptions.newBuilder()
.setInitialInterval(Duration.ofSeconds(1))
.setMaximumInterval(Duration.ofSeconds(10))
.setBackoffCoefficient(2.0)
.setMaximumAttempts(3)
.build();
private final LocalActivityOptions laOptions =
LocalActivityOptions.newBuilder()
.setRetryOptions(retryOptions)
.setStartToCloseTimeout(Duration.ofSeconds(10))
.build();
private final Account acc = Workflow.newLocalActivityStub(Account.class, laOptions);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With