client

package
v1.0.1-0...-7ff242b Latest Latest
Warning

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

Go to latest
Published: May 15, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPriority   = errors.New("cogman: task priority invalid")
	ErrNotConnected      = errors.New("cogman: client not connected")
	ErrNotPublished      = errors.New("cogman: task not published")
	ErrInvalidConfig     = errors.New("cogman: invalid client config")
	ErrRequestTimeout    = errors.New("cogman: request timeout")
	ErrConnectionTimeout = errors.New("cogman: connection timeout")
	ErrQueueNotAvailable = errors.New("cogman: queue not available")
)

list of client side errors

Functions

This section is empty.

Types

type Session

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

Session holds necessary fields of a client session

func NewSession

func NewSession(cfg config.Client) (*Session, error)

NewSession creates new client session with config cfg

func (*Session) Close

func (s *Session) Close() error

Close closes session s. It must be defer from the method client initiated.

func (*Session) Connect

func (s *Session) Connect() error

Connect connects a client session. It also take care reconnection process. For result log, Redis & Mongo connection will be initiated. Mongo indices ensured here. If any conflict occurred, drop the indice table.

func (*Session) EnsureQueue

func (s *Session) EnsureQueue(con *amqp.Connection, queue string, taskType util.TaskPriority) (*amqp.Queue, error)

EnsureQueue ensures that all required queues are available

func (*Session) GetQueueName

func (s *Session) GetQueueName(pType util.TaskPriority) (string, error)

GetQueueName return a available queue name based on task priority

func (*Session) RetryTask

func (s *Session) RetryTask(t util.Task) error

RetryTask re-process the task reducing counter by 1

func (*Session) SendTask

func (s *Session) SendTask(t util.Task) error

SendTask sends a task to rabbitmq

Jump to

Keyboard shortcuts

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