Go SDK
The official Go client is the full-power surface. Import
github.com/xcon-db/xcon-quee-clients-go.
c := quee.New("http://localhost:9080", token)
Publish
Publish returns only when the message is durable.
res, err := c.Publish(ctx, "main", "jobs", quee.Message{
Subject: "job.created",
Body: []byte(`{"id":42}`),
IdemKey: "42", // optional de-dup key
})
_ = res.Seq // the assigned sequence
Subscribe
Subscribe runs until the context is cancelled. It auto-credits (one credit
back per ack), auto-settles from the handler's return, auto-extends the lease
while a handler runs, and reconnects on transient errors.
c.Subscribe(ctx, "main", "jobs", "workers",
quee.SubOptions{
Create: true, // create the subscription if absent
Start: "earliest", // or "latest"
Credits: 64, // prefetch window
Concurrency: 8, // handler goroutines
Filter: "job.*", // optional subject filter
},
func(d *quee.Delivery) error {
// d.Seq, d.Subject, d.Body, d.Attempt
if err := handle(d.Body); err != nil {
return err // nack → backoff → redelivery → DLQ after maxAttempts
}
return nil // ack → advance the cursor
})
Settling by hand
Return nil to ack and a non-nil error to nack. To leave a delivery unsettled
(replayed on the next attach — a graceful-shutdown move), call d.Release().
Competing consumers & fan-out
Multiple workers on the same subscription name compete — each message goes to one of them. A different subscription name on the same topic is an independent reader with its own cursor (fan-out).