amqper

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: MIT Imports: 4 Imported by: 0

README

amqper

Golang package for easy creation of AMQP workers with resend if error ability

Website | Contributing

license GitHub go.mod Go version GoDoc GitHub release (latest SemVer) Coverage Status Build Status Go Report Card

Installation

go get -u github.com/rb-pkg/amqper

Usage

This is a minimal example.

in dev

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	AsyncWorker           bool
	AsyncPoolSize         int32
	ConnectionString      string
	ConnectionConfig      amqp.Config
	ExchangeName          string
	QueueName             string
	ConsumerName          string
	QueueDurable          bool
	QueueArguments        map[string]interface{}
	QueueAutoDelete       bool
	QueueExclusive        bool
	QueueNoWait           bool
	QueueAutoACK          bool
	PrefetchCount         int
	UseDelayedQueue       bool
	DelayedQueueArguments map[string]interface{}
	DefaultRetryCount     int32
	DefaultRetryDelay     time.Duration
}

Configuration is basic configuration for worker

type RunnableConsumer

type RunnableConsumer interface {
	ProcessQueueTask(amqpMSG *amqp.Delivery) (retryCnt int32, retryDelay time.Duration, err error)
}

RunnableConsumer interface for processing function

type Worker

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

Worker basic client

func NewWorker

func NewWorker(config *Configuration, processor RunnableConsumer) (*Worker, chan error)

NewWorker returns main worker base

func (*Worker) Close

func (wrk *Worker) Close() error

Close is for graceful serve stop

func (*Worker) Serve

func (wrk *Worker) Serve() error

Serve start worker processing messages

Jump to

Keyboard shortcuts

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