nsq

package
v0.0.0-...-3f52206 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package nsq represents the interface queues implementation.

Index

Constants

View Source
const (
	LogLevelDebug   = nsq.LogLevelDebug
	LogLevelInfo    = nsq.LogLevelInfo
	LogLevelWarning = nsq.LogLevelWarning
	LogLevelError   = nsq.LogLevelError
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	NsqConfig   *nsq.Config
	NsqD        string
	NsqLookupDs []string
	Channel     string
	Log         Logger
	StopTimeout time.Duration
	Marshaler   codec.Marshaler
	Unmarshaler codec.Unmarshaler
}

Config delivers a set of settings for QueueManager implementation.

func (Config) Validate

func (c Config) Validate() error

Validate validates Config according to predefined rules.

type Envelope

type Envelope struct {
	Magic  string          `json:"$magic"`
	Header http.Header     `json:"$header"`
	Body   json.RawMessage `json:"$body"`
}

Envelope transmitted in queues.

type Logger

type Logger struct {
	Output io.Writer
	Level  int
}

Logger predetermines the consistency of the logging.

func (Logger) Validate

func (l Logger) Validate() error

Validate validates Logger according to predefined rules.

type Message

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

Message predetermines the consistency of the queues.Message implementation.

func (*Message) AttemptsCount

func (m *Message) AttemptsCount() uint16

AttemptsCount provides the message attempts count.

func (*Message) Body

func (m *Message) Body() []byte

Body provides the message body.

func (*Message) Context

func (m *Message) Context() context.Context

Context provides message context.

func (*Message) DisableAutoResponse

func (m *Message) DisableAutoResponse()

DisableAutoResponse provides nsq.Message.DisableAutoResponse.

func (*Message) Finish

func (m *Message) Finish()

Finish provides nsq.Message.Finish.

func (*Message) HasResponded

func (m *Message) HasResponded() bool

HasResponded provides nsq.Message.HasResponded.

func (*Message) QueueAddr

func (m *Message) QueueAddr() string

QueueAddr provides the address of the nsq daemon from which the message came.

func (*Message) RequeueWithoutBackoff

func (m *Message) RequeueWithoutBackoff(delay time.Duration)

RequeueWithoutBackoff provides nsq.Message.RequeueWithoutBackoff.

func (*Message) Subject

func (m *Message) Subject() string

Subject provides the message Subject.

func (*Message) Timestamp

func (m *Message) Timestamp() int64

Timestamp provides the message timestamp.

func (*Message) Touch

func (m *Message) Touch()

Touch provides nsq.Message.Touch.

type Queue

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

Queue predetermines the consistency of the queues.QueueManager implementation.

func New

func New(cfg Config) (*Queue, error)

New is a QueueManager constructor.

func (*Queue) Ping

func (q *Queue) Ping(ctx context.Context) error

Ping - ping to producer,

func (*Queue) Publish

func (q *Queue) Publish(ctx context.Context, topic string, body []byte) error

Publish publishes a message to the queue.

func (*Queue) Stop

func (q *Queue) Stop(ctx context.Context)

Stop stops producer and all instances of subscribers.

func (*Queue) Subscribe

func (q *Queue) Subscribe(ctx context.Context, topic string, handler queues.Handler) (queues.Subscriber, error)

Subscribe carries out accession to the nsq daemon.

func (*Queue) Unsubscribe

func (q *Queue) Unsubscribe(ctx context.Context)

Unsubscribe disconnects all subscribers from the nsq daemon.

type Subscription

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

Subscription predetermines the consistency of the queues.Subscriber implementation.

func (*Subscription) Stop

func (s *Subscription) Stop(ctx context.Context)

Stop stops the instance Subscription.

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe(ctx context.Context) error

Unsubscribe disconnects the instance Subscription from nsq daemon.

Jump to

Keyboard shortcuts

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