nsq

package
v0.0.0-...-47d8c29 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelDebug   = LogLevel("debug")
	LogLevelInfo    = LogLevel("info")
	LogLevelError   = LogLevel("error")
	LogLevelWarning = LogLevel("warning")
)
View Source
const (
	Name = "nsq"
)

Variables

View Source
var (
	NsqLogLevel = map[LogLevel]nsq.LogLevel{
		LogLevelDebug:   nsq.LogLevelDebug,
		LogLevelInfo:    nsq.LogLevelInfo,
		LogLevelError:   nsq.LogLevelError,
		LogLevelWarning: nsq.LogLevelWarning,
	}
)

Functions

func ConsumerFromConfig

func ConsumerFromConfig(c Config, l loggers.Logger) (consumer.Consumer, error)

func NewHandler

func NewHandler(h Handler) nsq.Handler

func ProducerFromConfig

func ProducerFromConfig(c Config, l loggers.Logger) (producer.Producer, error)

Types

type Config

type Config struct {
	Addr               string
	Topic              string
	Channel            string
	Concurrency        uint
	ConsumerBufferSize uint
	LogLevel           LogLevel
	Nsq                *nsq.Config
}

type Consumer

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

func (*Consumer) Close

func (c *Consumer) Close() error

func (*Consumer) Consume

func (c *Consumer) Consume() (<-chan result.Result, error)

type Handler

type Handler func(m message.Message)

func (Handler) HandleMessage

func (h Handler) HandleMessage(m *nsq.Message) error

type LogLevel

type LogLevel string

func NewLogLevelFromLogrus

func NewLogLevelFromLogrus(lv logrus.Level) LogLevel

func (LogLevel) Nsq

func (l LogLevel) Nsq() nsq.LogLevel

type Logger

type Logger struct {
	loggers.Logger
}

func NewLogger

func NewLogger(l loggers.Logger) *Logger

func (*Logger) Output

func (l *Logger) Output(_ int, s string) error

type Nsq

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

func FromConfig

func FromConfig(c Config, l loggers.Logger) *Nsq

func (*Nsq) Close

func (q *Nsq) Close() error

func (*Nsq) Consumer

func (q *Nsq) Consumer() (consumer.Consumer, error)

func (*Nsq) Producer

func (q *Nsq) Producer() (producer.Producer, error)

type Producer

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

func (*Producer) Close

func (p *Producer) Close() error

func (*Producer) Produce

func (p *Producer) Produce(m message.Message) error

Jump to

Keyboard shortcuts

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