queue

package
v0.0.0-...-7a1e3be Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Processor

type Processor interface {
	Process([]engine.Message) ([]engine.Message, []error) // Process method to process a message
}

Processor is an interface that must be implemented by the consumer of the queue

type PushService

type PushService struct{}

func NewPushService

func NewPushService() *PushService

func (*PushService) Process

func (p *PushService) Process(messages []engine.Message) (invalid []engine.Message, errors []error)

type Service

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

Service struct represents a queue service with a queue channel, quit channel, maximum retries, context and a webhook messager.

func NewService

func NewService(name string, maxRetries, bufferSize int, ctx context.Context) (*Service, chan error)

NewService function initializes a new Service with provided maximum retries, context and webhook messager.

func (*Service) Close

func (s *Service) Close()

Close method sends a signal to the quit channel to stop the service.

func (*Service) Enqueue

func (s *Service) Enqueue(message engine.Message)

Enqueue method enqueues a message to the queue channel.

func (*Service) Start

func (s *Service) Start(p Processor) error

Start method starts the service and processes messages from the queue channel. If processing a message fails, it requeues the message until the maximum retries is reached. If the queue was empty, it waits for a duration before continuing to avoid a busy loop. It also notifies errors using the webhook messager. The service can be stopped by sending a signal to the quit channel.

type UserOpService

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

func NewUserOpService

func NewUserOpService(db *db.DB,
	evm engine.EVMRequester,
	pushq *Service,
	pools *ws.ConnectionPools) *UserOpService

func (*UserOpService) Process

func (s *UserOpService) Process(messages []engine.Message) (invalid []engine.Message, errors []error)

Process method processes messages of type []engine.Message and returns processed messages and an errors if any.

Jump to

Keyboard shortcuts

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