The consumer group object
Edit this pageConsumer · Related pages
Posted: 2026-09-16 · Report this thread
type Consumer struct { Id int64 `json:"group_id"` StreamId int64 `json:"stream_id"` Name string `json:"group"` CreatedAt time.Time `json:"created_at"`}A Consumer is the stored registration of a consumer group on one stream.
Get and Consumers
return this object.
Fields
| Field | Type | JSON name | Description |
|---|---|---|---|
Id |
int64 |
group_id |
The consumer group’s id. |
StreamId |
int64 |
stream_id |
The stream that owns the group. |
Name |
string |
group |
The group’s name, unique within its stream. |
CreatedAt |
time.Time |
created_at |
When the group was registered. |
Operations
| Operation | Go API |
|---|---|
| Register a consumer group | stream.Consumer(name).Register(ctx, cfg) |
| Retrieve a consumer group | stream.Consumer(name).Get(ctx) |
| List consumer groups | stream.Consumers(ctx) |
| Delete a consumer group | stream.Consumer(name).Destroy(ctx, options) |
| Consume messages | consumer.Consume(ctx, consumerFunc, options) |
Register returns a *ConsumerInstance[T]
for running Consume.
Example payload
The examples in these entries use an initialized client, the
payments.requested stream, and the charge-cards group. The stream’s
messages use this version 1 payload:
type PaymentRequestedV1 struct { OrderId string `json:"order_id"`}
func (p PaymentRequestedV1) SchemaVersion() int { return 1 }Examples use this import alias:
import sqlstreams "github.com/allegedlyreliable/sqlstreams/client"Related topics
- Consumer groups — How instances share work and groups keep independent progress.
- Consumer metrics — Inspect current progress, exceptions, and leases.