Beacon/workers/go/main.go
2025-06-20 14:33:34 +08:00

35 lines
952 B
Go

package main
import (
"beacon/server/activities"
"beacon/server/workflows"
"go.temporal.io/sdk/client"
"go.temporal.io/sdk/worker"
"log"
)
func main() {
// Create a Temporal client with the default options.
c, err := client.Dial(client.Options{HostPort: "temporal.newai.day:17233"})
if err != nil {
log.Fatalln("Unable to create Temporal client", err)
}
defer c.Close()
taskQueue := "data-processing-task-queue"
// Create a Worker that listens on the specified Task Queue.
w := worker.New(c, taskQueue, worker.Options{})
// Register the Workflow and the real Go suffix Activity with the Worker.
w.RegisterWorkflow(workflows.TestRunWorkflow)
w.RegisterActivity(activities.AddSuffixActivity)
//(for later) w.RegisterActivity(activities.AddSuffixActivity)
// Start the Worker. This call blocks until the Worker is interrupted.
err = w.Run(worker.InterruptCh())
if err != nil {
log.Fatalln("Unable to start Worker", err)
}
}