Welcome to the latest of our regular monthly Community Spotlight updates that gives you news from in and around the Cadence community!
Please see below for a roundup of the highlights:
More Cadence How To's
You might have noticed that we have had a few more contributions to our blog from Chris Qin. Chris has been busy sharing insights, and tips on a few important Cadence topics. The objective is to help the community with any potential problems.
Here are the latest topics:
Bad Practices and Anti-Patterns with Cadence - Part 1
Non-Determistic Errors, Replayers and Shadowers
Even if you have not encountered these use cases - it is good to be prepared and have a solution ready.Please take a look and let us have your feedback.
Chris is also going to take a look at ...
It is conceivable that developers constantly update their Cadence workflow code based upon new business use cases and needs. However,
the definition of a Cadence workflow must be deterministic because behind the scenes cadence uses event sourcing to construct
the workflow state by replaying the historical events stored for this specific workflow. Introducing components that are not compatible
with an existing running workflow will yield to non-deterministic errors and sometimes developers find it tricky to debug. Consider the
following workflow that executes two activities.
func SampleWorkflow(ctx workflow.Context, data string) (string, error) {
ao := workflow.ActivityOptions{
ScheduleToStartTimeout: time.Minute,
StartToCloseTimeout: time.Minute,
}
ctx = workflow.WithActivityOptions(ctx, ao)
var result1 string
err := workflow.ExecuteActivity(ctx, ActivityA, data).Get(ctx, &result1)
if err != nil {
return "", err
}
v ...
Welcome to the latest of our regular monthly Community Spotlight updates that gives you news from in and around the Cadence community!
Please see below for a roundup of the highlights:
Getting Started with Cadence
Are you new to Cadence and want to understand the basic concepts and architecture? Well we have some great information for you!
Community member Chris Qin has written a short blog post that takes you through the the three main components that make up a Cadence application. Please take a look and feel free to give us your comments and feedback.
Thanks Chris for sharing your knowledge and helping others to get started.
Cadence Go Client v1.0 Released
This month saw the release of v1.0 of the Cadence Go Client. Note that the work done on this release was as a result ...
We have covered basic components of Cadence and how to implement a Cadence worker on local environment in previous blogs. In this blog, let's write your very first HelloWorld workflow with Cadence. I've started the Cadence backend server in background and registered a domain named test-domain. You may use the code snippet for the worker service in this blog Let's first write a activity, which takes a single string argument and print a log in the console.
func helloWorldActivity(ctx context.Context, name string) (string, error) {
logger := activity.GetLogger(ctx)
logger.Info("helloworld activity started")
return "Hello " + name + "!", nil
}
Then let's write a workflow that invokes this activity
func helloWorldWorkflow(ctx workflow.Context, name string) error {
ao := workflow.ActivityOptions{
...
In the upcoming blog series, we will delve into a discussion about common bad practices and anti-patterns related to Cadence. As diverse teams often encounter distinct business use cases, it becomes imperative to address the most frequently reported issues in Cadence workflows. To provide valuable insights and guidance, the Cadence team has meticulously compiled these common challenges based on customer feedback.
Reusing the same workflow ID for very active/continuous running workflows
Cadence organizes workflows based on their unique IDs, using a process called partitioning. If a workflow receives a large number of updates in a short period of time or frequently starts new runs using the continueAsNew function, all these updates will be directed to the same shard. Unfortunately, the Cadence backend is not equipped to handle this concentrated workload efficiently. As a result, a situation known as a "hot shard" arises, overloading the Cadence backend and worsening the prob ...