Documentation

Quick Start

Start a worker and handle your first topic.

Use the Go SDK to subscribe to emit topics.

package main

import (
  "context"
  "log"

  "githook/sdk/go/worker"
)

func main() {
  wk, err := worker.NewFromConfigPathWithDriverFromAPI(
    "config.yaml",
    "drv_123",
    worker.WithTopics("pr.opened.ready"),
  )
  if err != nil {
    log.Fatal(err)
  }
  defer wk.Close()

  wk.HandleTopic("pr.opened.ready", func(ctx context.Context, evt *worker.Event) error {
    log.Printf("topic=%s provider=%s", evt.Topic, evt.Provider)
    return nil
  })

  if err := wk.Run(context.Background()); err != nil {
    log.Fatal(err)
  }
}

Replace drv_123 with the driver ID from your Drivers page.