Documentation
¶
Index ¶
- func NewRedisStreamClient(redisClient redis.UniversalClient, serviceName string, ...) types.RedisStreamClient
- type RecoverableRedisOption
- type RecoverableRedisStreamClient
- func (r *RecoverableRedisStreamClient) Claim(ctx context.Context, mutexKey string) error
- func (r *RecoverableRedisStreamClient) Done() error
- func (r *RecoverableRedisStreamClient) DoneStream(ctx context.Context, dataStreamName string) error
- func (r *RecoverableRedisStreamClient) ID() string
- func (r *RecoverableRedisStreamClient) Init(ctx context.Context) (<-chan notifs.RecoverableRedisNotification[any], error)
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 ¶
func (r *RecoverableRedisStreamClient) Done() error
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 ¶
func (r *RecoverableRedisStreamClient) ID() string
ID returns the consumer name that uniquely identifies the consumer
func (*RecoverableRedisStreamClient) Init ¶
func (r *RecoverableRedisStreamClient) Init( ctx context.Context, ) (<-chan notifs.RecoverableRedisNotification[any], error)
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. Returns a channel to read keyspace notifications. The client should read from this channel and process the notifications.