Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistributedLocker ¶
type DistributedLocker interface {
CreateMutexLock(name string, lockOptions LockOptions) Lock
}
type HeartBeatFunc ¶
type LockOptions ¶
type MessageQueue ¶
type MessageQueue interface {
Len() (int64, error) // Returns the number of messages in the queue.
Add(ctx context.Context, message *Message) error // Adds a new message to the queue.
Receive(ctx context.Context, pullDuration time.Duration, batchSize int, group, consumerName string) ([]Message, error) // Receives messages from the queue.
Consume(ctx context.Context, readBatchSize int, blockDuration time.Duration, group, consumerName string, errorChannel chan error, consumer StreamConsumeFunc) // Consumes messages using the provided consumer function.
Delete(ctx context.Context, id string) error // Deletes a specific message from the queue.
Purge(ctx context.Context) error // Clears all messages from the queue.
Ack(ctx context.Context, group, messageId string) error // Acknowledges the processing of a message.
RequireHeartHeartBeat() bool // Indicates if a heartbeat is required for message processing.
HeartBeat(ctx context.Context, group, consumer, messageId string) error // Sends a heartbeat for a specific message. // Sends a heartbeat for a specific message.
}
MessageQueue defines the contract for a message queue system. This interface provides methods for message management, including adding, receiving, consuming, and acknowledging messages.
type QueueError ¶
type QueueError string
const ErrNoNewMessage QueueError = "no new message"
const MessageNotFoundError QueueError = "message not found"
const NotInitializedError QueueError = "you should initialize rmq first"
func (QueueError) Error ¶
func (e QueueError) Error() string
type StreamConsumeFunc ¶
type StreamConsumeFunc func(context.Context, Message, HeartBeatFunc) error
Click to show internal directories.
Click to hide internal directories.