rabbitmq / rabbitmq-stream-go-client

A client library for RabbitMQ streams
MIT License
161 stars 13 forks source link

Smart Consumer for V2 #244

Open ablease opened 8 months ago

ablease commented 8 months ago

Ideal Features

Description

Expanding on the V1 consumer, while addressing some issues highlighted in this issue #241. Keep the design close to Producer v2 for a more streamlined user experience. For example, the Consumer Options struct contains only optional params

Consumer Options

// ConsumerOpts handles optional parameters only
type ConsumerOpts struct {
    client             *Client
    ConsumerName       string
    streamName         string
    autocommit         bool
    autoCommitStrategy *AutoCommitStrategy
    Offset             OffsetSpecification
        Filter
    CRCCheck           bool
    initialCredits     int16
        sinlgeActiveConsumer bool
        reference string
}

// func (c *Consumer) CreateConsumer(stream string, opts ConsumerOpts) *Consumer {}

Single Active Consumer is created via the singleActiveConsumer bool and reference string in ConsumerOpts