msq

package
v0.0.0-...-a4910e0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMAC

func GetMAC() ([]string, error)

func NewMsqConsumer

func NewMsqConsumer(ctx context.Context, rs *redis.RediStore, streamName, clientId string, delayDuration time.Duration) (*redisMsqConsumer, error)

make a consumer wigth auto claim ctx, a context rs

Types

type MsqConsumer

type MsqConsumer interface {
	Close() error

	// Read the next queue message
	Read(limit int, timeout time.Duration) ([]redis.StreamEntry, error)
	// Confirm and delete the queue message
	ACK(msgEntryId string) error
	// Put the message to the delay queue
	Delay(msgEntry *redis.MessageEntry) error

	// Read the queue msg, and send to the handleFn
	// if the handle function return true, auto send a ack to done the entry;
	// if the handle function return false, auto send the entry to a delay queue;
	// it will block the thread to wait the entry;
	// if a error happend, the caller need recall the Next function.
	Next(handleFn MsqConsumerHandleFunc) error
}

https://redis.io/docs/data-types/streams/ https://redis.io/commands/xclaim/

type MsqConsumerHandleFunc

type MsqConsumerHandleFunc func(*redis.MessageEntry) bool

type MsqProducer

type MsqProducer interface {
	Close() error
	Put(taskKey string, taskData []byte) error
}

func NewMsqProducer

func NewMsqProducer(rs *redis.RediStore, streamName string) MsqProducer

Jump to

Keyboard shortcuts

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