nsq

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NsqlookupdDNS defines the default DNS for nsqlookupd
	NsqlookupdDNS = "nsqlookupd.service.consul"
	NsqlookupPort = 4161
)

Variables

NsqConsumerOption is the default for NSQ

Functions

func NewMessage

func NewMessage(topic string, message interface{}) (messaging.Messager, error)

NewMessage creates message that is publishable. Client should pass in []byte as payload for better write throughput

Types

type Config

type Config struct {
	Name                string   `json:"name" yaml:"name"`
	Nsqd                string   `json:"nsqd" yaml:"nsqd"`
	NsqLogDir           string   `json:"nsqLogDirectory" yaml:"nsqLogDirectory"`
	Nsqlookupds         []string `json:"nsqlookupds" yaml:"nsqlookupds"`
	NsqlookupdDiscovery bool     `json:"nsqlookupdDiscovery" yaml:"nsqlookupdDiscovery"`
	MaxInFlight         int      `json:"maxInFlight" yaml:"maxInFlight"`
	ConcurrentHandlers  int      `json:"concurrentHandlers" yaml:"concurrentHandlers"`
	MsgTimeoutDuration  time.Duration
	MsgTimeout          int     `json:"msgTimeout" yaml:"msgTimeout"`           // seconds
	TLS                 bool    `json:"tls" yaml:"tls"`                         // Bool enable TLS negotiation
	TLSVerification     bool    `json:"tlsVerification" yaml:"tlsVerification"` // Bool indicates whether this client should verify server certificates
	TLSRootCAFile       *string `json:"tlsRootCAFile" yaml:"tlsRootCAFile"`     // String path to file containing root CA
	TLSCert             *string `json:"tlsCert" yaml:"tlsCert"`                 // String path to file containing public key for certificate
	TLSKey              *string `json:"tlsKey" yaml:"tlsKey"`                   // String path to file containing private key for certificate
	TLSMinVersion       *string `json:"tlsMinVersion" yaml:"tlsMinVersion"`     // String indicating the minimum version of tls acceptable ('ssl3.0', 'tls1.0', 'tls1.1', 'tls1.2')

	// New fields
	LogLevel string `json:"logLevel" yaml:"logLevel"`
}

Config is the superset of configuration options for all messaging queues. this is the exact copy of old `go-messaging` repo

type ConsumerOptions

type ConsumerOptions struct {
	AutoFinish bool
}

func (*ConsumerOptions) Options

func (o *ConsumerOptions) Options() interface{}

type NsqConsumer

type NsqConsumer struct {
	*messaging.Tracer
	messaging.Logger
	// contains filtered or unexported fields
}

func Consumer

func Consumer(topic, channel string, nsqds, nsqlookupds []string) (*NsqConsumer, error)

func NewConsumer

func NewConsumer(topic, channel string, config *Config) (*NsqConsumer, error)

NewConsumer returns an nsq consumer. This is a light wrapper for Consumer constructor that aims for backward compatibility with old `go-messaging` repo`

func (*NsqConsumer) Close

func (c *NsqConsumer) Close() error

func (*NsqConsumer) Consume

func (c *NsqConsumer) Consume(_ context.Context, opts messaging.OptionCreator) (<-chan messaging.Event, error)

type NsqEvent

type NsqEvent struct {
	*gnsq.Message
	// contains filtered or unexported fields
}

func (*NsqEvent) Finish

func (e *NsqEvent) Finish()

func (*NsqEvent) Metadata

func (e *NsqEvent) Metadata() map[string]interface{}

func (*NsqEvent) Payload

func (e *NsqEvent) Payload() []byte

func (*NsqEvent) Raw

func (e *NsqEvent) Raw() interface{}

func (*NsqEvent) Requeue

func (e *NsqEvent) Requeue(delay time.Duration)

type NsqProducer

type NsqProducer struct {
	*messaging.Tracer
	messaging.Logger
	// contains filtered or unexported fields
}

func NewProducer

func NewProducer(config *Config) (*NsqProducer, error)

NewProducer returns an nsq producer. This is a light wrapper for Producer constructor that aims for backward compatibility with old `go-messaging` repo`

func Producer

func Producer(host string) (*NsqProducer, error)

func (*NsqProducer) Close

func (p *NsqProducer) Close() error

func (*NsqProducer) Produce

func (p *NsqProducer) Produce(_ context.Context, m messaging.Messager, from ...messaging.Event) error

Jump to

Keyboard shortcuts

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