Files
handler-base/README.md
Billy D. d321c9852b refactor: rewrite handler-base as Go module
Replace Python handler-base library with Go module providing:
- config: environment-based configuration
- health: HTTP health/readiness server for k8s probes
- natsutil: NATS/JetStream client with msgpack serialization
- telemetry: OpenTelemetry tracing and metrics setup
- clients: HTTP clients for LLM, embeddings, reranker, STT, TTS
- handler: base Handler runner wiring NATS + health + telemetry

Implements ADR-0061 Phase 1.
2026-02-19 17:16:17 -05:00

1.1 KiB

handler-base

Go module providing shared infrastructure for NATS-based handler services.

Packages

Package Purpose
config Environment-based configuration via struct fields
health HTTP health/readiness server for Kubernetes probes
natsutil NATS/JetStream client with msgpack serialization
telemetry OpenTelemetry tracing and metrics setup
clients HTTP clients for LLM, embeddings, reranker, STT, TTS
handler Base Handler runner wiring NATS + health + telemetry

Usage

package main

import (
    "context"
    "git.daviestechlabs.io/daviestechlabs/handler-base/config"
    "git.daviestechlabs.io/daviestechlabs/handler-base/handler"
    "github.com/nats-io/nats.go"
)

func main() {
    cfg := config.Load()
    cfg.ServiceName = "my-service"

    h := handler.New("my.subject", cfg)
    h.OnMessage(func(ctx context.Context, msg *nats.Msg, data map[string]any) (map[string]any, error) {
        return map[string]any{"ok": true}, nil
    })
    h.Run()
}

Testing

go test ./...