producer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2015 License: MIT Imports: 4 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(addr string) error

Connect method initialize the connection to nsq

func ConnectConfig

func ConnectConfig(addr string, config *nsq.Config) error

ConnectConfig method initialize the connection to nsq with config

func MultiPublish

func MultiPublish(topic string, body [][]byte) error

MultiPublish - sends multiple message to to nsq topic

func MultiPublishAsync

func MultiPublishAsync(topic string, body [][]byte, doneChan chan *nsq.ProducerTransaction, args ...interface{}) error

MultiPublishAsync - sends multiple message to nsq topic asynchronously

func Publish

func Publish(topic string, body []byte) error

Publish - sends message to nsq topic

func PublishAsync

func PublishAsync(topic string, body []byte, doneChan chan *nsq.ProducerTransaction, args ...interface{}) error

PublishAsync - sends a message to nsq topic asynchronously

func PublishJSON

func PublishJSON(topic string, v interface{}) error

PublishJSON - sends message to nsq topic in json format

func PublishJSONAsync

func PublishJSONAsync(topic string, v interface{}, doneChan chan *nsq.ProducerTransaction, args ...interface{}) error

PublishJSONAsync - sends message to nsq topic in json format asynchronously

Types

type Producer

type Producer struct {
	Logger   *log.Logger
	LogLevel nsq.LogLevel

	*nsq.Producer
}

Producer inherets the nsq Producer object

var DefaultProducer *Producer

Instantiates the Producer object

func New

func New() *Producer

New - Creates a new Producer.

func (*Producer) Connect

func (p *Producer) Connect(addr string) (err error)

Connect - Connects prodocuer to nsq instance.

func (*Producer) ConnectConfig

func (p *Producer) ConnectConfig(addr string, config *nsq.Config) (err error)

ConnectConfig method initialize the connection to nsq with config.

func (*Producer) PublishJSON

func (p *Producer) PublishJSON(topic string, v interface{}) error

PublishJSON - sends message to nsq topic in json format

func (*Producer) PublishJSONAsync

func (p *Producer) PublishJSONAsync(topic string, v interface{}, doneChan chan *nsq.ProducerTransaction, args ...interface{}) error

PublishJSONAsync - sends message to nsq topic in json format asynchronously

Jump to

Keyboard shortcuts

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