nsqproducer

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 12 Imported by: 7

README

Package nsqproducer v1.1.2

nsqproducer is a private package used by nsqlbproducer. It should NEVER be directly used! Please use the nsqlbproducer package.

nsqproducer contains the code to publish a message to a single nsqd instance. This is not good for high availability.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NsqConfigFromEnv

func NsqConfigFromEnv(E map[string]string) (*nsq.Config, error)

Types

type NsqMessageSerialize

type NsqMessageSerialize struct {
	At      int64       `json:"at"`
	Type    string      `json:"type"`
	Payload interface{} `json:"payload"`

	// Automatically set by context if existing, generated otherwise
	RequestID string `json:"request_id"`
}

type NsqProducer

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

func FromEnv

func FromEnv() (*NsqProducer, error)

func New

func New(opts ProducerOpts) (*NsqProducer, error)

func (*NsqProducer) DeferredPublish

func (p *NsqProducer) DeferredPublish(ctx context.Context, topic string, delay int64, message NsqMessageSerialize) error

func (*NsqProducer) Ping

func (p *NsqProducer) Ping() error

func (*NsqProducer) Publish

func (p *NsqProducer) Publish(ctx context.Context, topic string, message NsqMessageSerialize) error

func (*NsqProducer) Stop

func (p *NsqProducer) Stop()

type Producer

type Producer interface {
	Publish(ctx context.Context, topic string, message NsqMessageSerialize) error
	DeferredPublish(ctx context.Context, topic string, delay int64, message NsqMessageSerialize) error
	Stop()
}

type ProducerOpts

type ProducerOpts struct {
	Host       string
	Port       string
	NsqConfig  *nsq.Config
	SkipLogSet map[string]bool
}

type WithLoggableFields

type WithLoggableFields interface {
	LoggableFields() logrus.Fields
}

Directories

Path Synopsis
Package nsqproducermock is a generated GoMock package.
Package nsqproducermock is a generated GoMock package.

Jump to

Keyboard shortcuts

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