-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
43 lines (38 loc) · 1.15 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"log"
"os"
"go.temporal.io/sdk/client"
"go.temporal.io/sdk/worker"
"github.com/onaio/akuko-temporal-go-tooling/activities"
"github.com/onaio/akuko-temporal-go-tooling/workflows"
)
type Response struct {
Message string `json:"message"`
}
func main() {
clientOptions := client.Options{
HostPort: os.Getenv("TEMPORAL_HOST"),
Namespace: os.Getenv("TEMPORAL_NAMESPACE"),
}
temporalClient, err := client.Dial(clientOptions)
if err != nil {
fmt.Println("Unable to create a Temporal Client: ", err)
}
if temporalClient != nil {
defer temporalClient.Close()
// Create a new Worker
yourWorker := worker.New(temporalClient, os.Getenv("GEOPARQUET_WORKER_TASK_QUEUE_NAME"), worker.Options{})
// Register Workflows
yourWorker.RegisterWorkflow(workflows.ConvertGeoparquetToGeojson)
// Register Activities
yourWorker.RegisterActivity(activities.ConvertGeoParquetToGeoJSONActivity)
yourWorker.RegisterActivity(activities.SanitizeGeoJSONFeaturePropertiesActivity)
// Start the Worker Process
err = yourWorker.Run(worker.InterruptCh())
if err != nil {
log.Fatalln("Unable to start the Worker Process", err)
}
}
}