SQLStreams

the messaging platform that is just Postgres

You last visited on 9999-99-99 Show what's new since then

Retrieve a consumer group

Edit this page
Consumer · Related pages
Posted: 2026-09-16 · Report this thread
brandon Site Admin brandon profile Posts: 96
Get(ctx context.Context) (*Consumer, error)

Reads a consumer group’s stored registration. If the group does not exist, Get does not create it. Reading an existing group does not update its settings or change which messages it will process next.

Example

Read the charge-cards group on the payments.requested stream using an initialized client and the example payload.

payments := client.Stream[PaymentRequestedV1]("payments.requested")
chargeCards := payments.Consumer("charge-cards")
group, err := chargeCards.Get(ctx)
if err != nil {
return err
}
if group == nil {
return errors.New("charge-cards is not registered on payments.requested")
}
fmt.Println(group.Id, group.Name)

Parameters

Parameter Type Required Description
ctx context.Context Yes Cancelling this context or reaching its deadline interrupts the database read.

Returns

Condition Return value
Group is registered (group, nil), where group is the consumer group object.
Stream or group is not registered (nil, nil).
Read fails (nil, err). See Errors.

CLI

sqlstreams consumer get payments.requested charge-cards

Prints the group’s registration and exits with status 0 when found. If the stream or group is absent, prints an absence message and exits with status 1. See consumer get for output formats and flags.

Errors

Error When
Validation error The stream or group name is empty.
Database error The registration cannot be read.
Context cancellation or deadline error The read is interrupted by its context.