impl

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2025 License: LGPL-2.1, LGPL-2.1-or-later Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisStreamClient

func NewRedisStreamClient(
	redisClient redis.UniversalClient,
	serviceName string,
	opts ...RecoverableRedisOption,
) types.RedisStreamClient

NewRedisStreamClient creates a new RedisStreamClient

This function creates a new RedisStreamClient with the given redis client and stream name Stream is the name of the stream to read from where actual data is transmitted

Types

type RecoverableRedisOption added in v0.1.5

type RecoverableRedisOption func(*RecoverableRedisStreamClient) error

func WithLBSIdleTime added in v0.1.5

func WithLBSIdleTime(idleTime time.Duration) RecoverableRedisOption

WithLBSIdleTime sets the time after which a message is considered idle and will be recovered

func WithLBSRecoveryCount added in v0.1.5

func WithLBSRecoveryCount(count int) RecoverableRedisOption

WithLBSRecoveryCount sets the number of messages to fetch at a time during recovery

type RecoverableRedisStreamClient

type RecoverableRedisStreamClient struct {
	// contains filtered or unexported fields
}

RecoverableRedisStreamClient is an implementation of the RedisStreamClient interface

func (*RecoverableRedisStreamClient) Claim

func (r *RecoverableRedisStreamClient) Claim(ctx context.Context, mutexKey string) error

Claim claims pending messages from a stream

func (*RecoverableRedisStreamClient) Done

Done marks the end of processing for a client

Note that done is called when the client is shutting down and is not expected to be called again It cleans up all the streams handled by the client To cleanup a specific stream, use DoneStream

func (*RecoverableRedisStreamClient) DoneStream added in v0.1.5

func (r *RecoverableRedisStreamClient) DoneStream(ctx context.Context, dataStreamName string) error

DoneStream marks end of processing for a particular stream

This function is used to mark the end of processing for a particular stream It unlocks the stream and acknowledges the message and cleans up internal state

func (*RecoverableRedisStreamClient) ID

ID returns the consumer name that uniquely identifies the consumer

func (*RecoverableRedisStreamClient) Init

Init initializes the RedisStreamClient

This function initializes the RedisStreamClient by enabling keyspace notifications for expired events, subscribing to expired events, and starting a blocking read on the LBS stream Returns a channel to read messages from the LBS stream. The client should read from this channel and process the messages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL