nsqproducer

package
v7.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: MIT Imports: 12 Imported by: 0

README

Generate mock

mockgen -destination nsqproducermock/gomock_producer.go -package nsqproducermock github.com/Scalingo/go-utils/nsqproducer Producer

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