rock 4dbf39810f
CI / Test (pull_request) Failing after 21s
CI / Create Release (on tag) (pull_request) Failing after 1s
refactor: unify CI workflow - use .gitea/workflows
- Consolidate test + release/build workflows into single .gitea/workflows/ci.yaml
- Add explicit job dependencies (build-push needs test)
- Test runs on all PRs + main pushes
- Build/release runs on main/tags only (after test passes)
- Follows unified Forgejo CI pattern

Note: Using .gitea/ not .forgejo/ (our Forgejo instance uses .gitea/)
2026-09-14 22:52:02 +09:00
2026-08-30 09:46:58 -07:00

kmsvc-sdk

Go client SDK for the Kafka Management Service message-plane API (kafkamgmt.v1). Wraps the generated gRPC client from kmsvc-proto with ergonomic Go methods, bearer-token attachment, and long-poll handling — callers never touch raw protobuf types or gRPC metadata.

Queue lifecycle (create/delete/configure) is managed via the Queue CRD on the cluster, not this SDK — see kafaka_management_service design.md §2a/§2b.

Install

export GOPRIVATE=forgejo.riotpiao.homelab.com   # self-hosted Forgejo, skip public proxy/sumdb
go get forgejo.riotpiao.homelab.com/homelab/kmsvc-sdk@latest

Usage

client, err := kmsvc.New(ctx, "kmsvc.homelab.internal:443",
    kmsvc.WithTokenSource(kmsvc.StaticToken(token)),
)
if err != nil {
    log.Fatal(err)
}
defer client.Close()

out, err := client.SendMessage(ctx, kmsvc.SendMessageInput{
    QueueName: "orders",
    Body:      []byte(`{"order_id": 123}`),
})

msgs, err := client.ReceiveMessage(ctx, "orders", kmsvc.ReceiveOptions{
    MaxNumberOfMessages: 10,
    WaitTimeSeconds:      20,
})
for _, m := range msgs {
    // process m.Body
    client.DeleteMessage(ctx, "orders", m.ReceiptHandle)
}

Error handling

gRPC status codes are mapped to exported sentinel errors:

if errors.Is(err, kmsvc.ErrQueueNotFound) { ... }

See errors.go for the full list.

Development

export GOPRIVATE=forgejo.riotpiao.homelab.com
go build ./...
go test ./... -race

No buf/protoc install needed — kmsvc-proto's generated Go code is consumed as a plain module dependency.

Final test - clean cache removal

Final CI validation - Forgejo ready

CI cleanup - removed upload-artifact

S
Description
No description provided
Readme
131 KiB
Languages
Go 100%