queue

package
v0.0.0-...-edbed3e Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Id          string
	UUID        string
	Retry       int
	Execute     int
	Topic       string
	PayLoad     []byte
	Handler     string
	CreatedOn   time.Time
	ExecutedOn  time.Time
	CompletedOn time.Time
}

type MessageQueue

type MessageQueue struct {
	QueueID  string
	QueuName string

	DocDBconn     *documents.DocDB
	DB            *sql.DB
	SignalRClient signalr.Client
	// contains filtered or unexported fields
}

func NewMessageQueue

func NewMessageQueue(Id string, Name string) *MessageQueue

func NewMessageQueuebyExternal

func NewMessageQueuebyExternal(Id string, Name string, DB *sql.DB, DocDBconn *documents.DocDB, SignalRClient signalr.Client) *MessageQueue

func (*MessageQueue) Clear

func (mq *MessageQueue) Clear()

func (*MessageQueue) Length

func (mq *MessageQueue) Length() int

Length returns the number of messages in the message queue.

func (*MessageQueue) Peek

func (mq *MessageQueue) Peek() Message

Peek returns the first message in the message queue without removing it. If the queue is empty, it returns an empty Message. It measures the performance duration of the operation and logs any errors that occur.

func (*MessageQueue) Pop

func (mq *MessageQueue) Pop() Message

Pop removes and returns the first message from the message queue. If the queue is empty, it returns an empty Message. It measures the performance duration of the operation and logs any errors that occur.

func (*MessageQueue) Push

func (mq *MessageQueue) Push(message Message)

func (*MessageQueue) WaitAndPop

func (mq *MessageQueue) WaitAndPop(timeout time.Duration) Message

WaitAndPop waits for a message to be available in the queue and then removes and returns it. If the queue is empty, it will return an empty Message struct. The timeout parameter specifies the maximum duration to wait for a message before returning. If a timeout of zero is provided, it will wait indefinitely until a message is available. It measures the performance duration of the operation and logs any errors that occur. It takes a timeout time.Duration as a parameter and returns a Message struct.

func (*MessageQueue) WaitAndPopWithTimeout

func (mq *MessageQueue) WaitAndPopWithTimeout(timeout time.Duration) Message

type PayLoad

type PayLoad struct {
	Topic   string `json:"Topic"`
	Payload string `json:"Payload"`
}

Jump to

Keyboard shortcuts

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