Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StrategiesFromName = map[string]LBStrategy{ "": FallbackStrategy, "fallback": FallbackStrategy, "random": RandomStrategy, } )
Functions ¶
This section is empty.
Types ¶
type FromEnvOpts ¶
type FromEnvOpts struct { Logger logrus.FieldLogger SkipLogSet map[string]bool }
type LBProducerOpts ¶
type LBProducerOpts struct { Hosts []Host NsqConfig *nsq.Config Logger logrus.FieldLogger SkipLogSet map[string]bool Strategy LBStrategy }
type NsqLBProducer ¶
type NsqLBProducer struct {
// contains filtered or unexported fields
}
NsqLBProducer a producer that distribute nsq messages across a set of node if a node send an error when receiving the message it will try with another node of the set
func FromEnv ¶
func FromEnv(opts FromEnvOpts) (*NsqLBProducer, error)
func New ¶
func New(opts LBProducerOpts) (*NsqLBProducer, error)
func (*NsqLBProducer) DeferredPublish ¶
func (p *NsqLBProducer) DeferredPublish(ctx context.Context, topic string, delay int64, message nsqproducer.NsqMessageSerialize) error
func (*NsqLBProducer) Ping ¶
func (p *NsqLBProducer) Ping() error
Ping return an error if all the nodes are unreachable
func (*NsqLBProducer) Publish ¶
func (p *NsqLBProducer) Publish(ctx context.Context, topic string, message nsqproducer.NsqMessageSerialize) error
func (*NsqLBProducer) Stop ¶
func (p *NsqLBProducer) Stop()
type PublishPinger ¶
type PublishPinger interface { Publish(context.Context, string, nsqproducer.NsqMessageSerialize) error DeferredPublish(context.Context, string, int64, nsqproducer.NsqMessageSerialize) error Ping() error Stop() }
Directories ¶
Path | Synopsis |
---|---|
Package nsqlbproducermock is a generated GoMock package.
|
Package nsqlbproducermock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.