Implement a Cadence worker service from scratch
In the previous blog, we have introduced three critical components for a Cadence application: the Cadence backend, domain, and worker. Among these, the worker service is the most crucial focus for developers as it hosts the activities and workflows of a Cadence application. In this blog, I will provide a short tutorial on how to implement a simple worker service from scratch in Go.
To finish this tutorial, there are two prerequisites you need to finish first
- Register a Cadence domain for your worker. For this tutorial, I've already registered a domain named
test-domain - Start the Cadence backend server in background.
To get started, let's simply use the native HTTP package built in Go to start a process listening to port 3000. You may customize the port for your worker, but the port you choose should not conflict with existing port for your Cadence backend.
package main
import (
"fmt"
"net/http"
)
func main(){
fmt.Println("Cadence worker started at port 3000")
http.ListenAndServe(":3000", nil)
}





