msq

package
v0.0.0-...-ae13ae6 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Config ConnectionConfig
	// contains filtered or unexported fields
}

func (*Connection) Attempt

func (c *Connection) Attempt() error

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Database

func (c *Connection) Database() *gorm.DB

func (*Connection) SetupDatabase

func (c *Connection) SetupDatabase() error

type ConnectionConfig

type ConnectionConfig struct {
	Type     string
	Host     string
	Proto    string
	Port     int
	Username string
	Password string
	Database string
	Charset  string
	Locale   string
	Logging  bool
}

type Event

type Event struct {
	gorm.Model
	UID       string `gorm:"type:varchar(255);index:uid"`
	Namespace string `gorm:"type:varchar(255);index:namespace;not null"`
	Payload   string `gorm:"type:text"`
	Retries   int    `gorm:"size:1;index:retries;default:0"`
}

func (*Event) BeforeCreate

func (e *Event) BeforeCreate(scope *gorm.Scope) error

func (*Event) GetPayload

func (e *Event) GetPayload() (Payload, error)

type Listener

type Listener struct {
	Running bool
	Queue   Queue
	Config  ListenerConfig
	// contains filtered or unexported fields
}

func (*Listener) Context

func (l *Listener) Context() context.Context

func (*Listener) Start

func (l *Listener) Start(handle func([]Event) bool, num int)

func (*Listener) Stop

func (l *Listener) Stop()

type ListenerConfig

type ListenerConfig struct {
	Interval time.Duration
	Timeout  time.Duration
}

type Payload

type Payload map[string]interface{}

func (*Payload) Marshal

func (p *Payload) Marshal() ([]byte, error)

func (*Payload) UnMarshal

func (p *Payload) UnMarshal(data []byte) (*Payload, error)

type Queue

type Queue struct {
	Connection *Connection
	Config     *QueueConfig
}

func Connect

func Connect(config ConnectionConfig) (*Queue, error)

func (*Queue) Configure

func (q *Queue) Configure(config *QueueConfig)

func (*Queue) Done

func (q *Queue) Done(event *Event) error

func (*Queue) Failed

func (q *Queue) Failed() ([]*Event, error)

func (*Queue) Pop

func (q *Queue) Pop() (*Event, error)

func (*Queue) Push

func (q *Queue) Push(payload Payload) (*Event, error)

func (*Queue) ReQueue

func (q *Queue) ReQueue(event *Event) error

type QueueConfig

type QueueConfig struct {
	Name       string
	MaxRetries int64
	MessageTTL time.Duration
}

Jump to

Keyboard shortcuts

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