2024-02-10 11:59:58 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
2024-02-13 21:39:34 +00:00
|
|
|
"code.tjo.space/mentos1386/zdravko/internal"
|
2024-02-10 11:59:58 +00:00
|
|
|
"go.temporal.io/sdk/client"
|
|
|
|
"go.temporal.io/sdk/worker"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2024-02-13 21:39:34 +00:00
|
|
|
config := internal.NewConfig()
|
|
|
|
|
2024-02-10 11:59:58 +00:00
|
|
|
// Initialize a Temporal Client
|
|
|
|
// Specify the Namespace in the Client options
|
|
|
|
clientOptions := client.Options{
|
2024-02-15 17:43:35 +00:00
|
|
|
HostPort: config.Temporal.ServerHost,
|
2024-02-10 11:59:58 +00:00
|
|
|
Namespace: "default",
|
|
|
|
}
|
|
|
|
temporalClient, err := client.Dial(clientOptions)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalln("Unable to create a Temporal Client", err)
|
|
|
|
}
|
|
|
|
defer temporalClient.Close()
|
2024-02-13 21:39:34 +00:00
|
|
|
|
2024-02-10 11:59:58 +00:00
|
|
|
// Create a new Worker
|
2024-02-13 21:39:34 +00:00
|
|
|
// TODO: Maybe identify by region or something?
|
|
|
|
yourWorker := worker.New(temporalClient, "default", worker.Options{})
|
|
|
|
|
2024-02-10 11:59:58 +00:00
|
|
|
// Register Workflows
|
|
|
|
//yourWorker.RegisterWorkflow(workflows.default)
|
|
|
|
// Register Activities
|
|
|
|
//yourWorker.RegisterActivity(activities.SSNTraceActivity)
|
|
|
|
// Start the the Worker Process
|
|
|
|
err = yourWorker.Run(worker.InterruptCh())
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalln("Unable to start the Worker Process", err)
|
|
|
|
}
|
|
|
|
}
|