nsq

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MIT Imports: 15 Imported by: 0

README

https://nsq.io/deployment/docker.html

docker run --name lookupd -p 4160:4160 -p 4161:4161 -d nsqio/nsq /nsqlookupd docker run --name nsqadmin -p 4171:4171 -d nsqio/nsq /nsqadmin --lookupd-http-address=172.17.0.1:4161

//--nsqd-http-address=172.17.0.1:4151

docker run --name nsqd -p 4150:4150 -p 4151:4151 -d nsqio/nsq /nsqd --broadcast-address=172.17.0.1 --lookupd-tcp-address=172.17.0.1:4160

Documentation

Index

Constants

View Source
const (
	DefaultUserAgent       = ""
	DefaultMaxConcurrency  = 1
	DefaultMaxInFlight     = 1
	DefaultDialTimeout     = 5 * time.Second
	DefaultReadTimeout     = 1 * time.Minute
	DefaultWriteTimeout    = 10 * time.Second
	DefaultLookupTimeout   = 10 * time.Second
	DefaultMaxRetryTimeout = 10 * time.Second
	DefaultMinRetryTimeout = 10 * time.Millisecond
	DefaultDrainTimeout    = 10 * time.Second

	NoTimeout = time.Duration(0)
)

Variables

This section is empty.

Functions

func CreateChannel added in v1.0.4

func CreateChannel(insType string, topic, channel string) error

func CreateTopic added in v1.0.4

func CreateTopic(insType string, topic string) error

func DeferredPublishAsync added in v1.0.4

func DeferredPublishAsync(insType string, topic string, data []byte,
	doneChan chan *nsq.ProducerTransaction, delay time.Duration) error

func DeleteChannel added in v1.0.4

func DeleteChannel(insType string, topic, channel string) error

func DeleteTopic added in v1.0.4

func DeleteTopic(insType string, topic string) error

func Initialize added in v1.0.4

func Initialize(config *ManagerConfig)

func PublishAsync added in v1.0.4

func PublishAsync(insType string, topic string, data []byte, doneChan chan *nsq.ProducerTransaction) error

Types

type ConsumerClient

type ConsumerClient struct {
	NSQDAddresses []string
	// contains filtered or unexported fields
}

func NewConsumerClient

func NewConsumerClient(conf ConsumerConfig, cb func(c *nsq.Config)) *ConsumerClient

func (*ConsumerClient) AddHandle

func (c *ConsumerClient) AddHandle(handler nsq.Handler)

type ConsumerConfig

type ConsumerConfig struct {
	Topic        string
	Channel      string
	Address      string
	Lookup       []string
	MaxInFlight  int
	Identify     nsq.IdentifyResponse
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	DrainTimeout time.Duration
}

type Identify

type Identify struct {
	// ClientID should be set to a unique identifier representing the client.
	ClientID string `json:"client_id"`

	// Hostname represents the hostname of the client, by default it is set to
	// the value returned by os.Hostname is used.
	Hostname string `json:"hostname"`

	// UserAgent represents the type of the client, by default it is set to
	// nsq.DefaultUserAgent.
	UserAgent string `json:"user_agent"`

	// MessageTimeout can bet set to configure the server-side message timeout
	// for messages delivered to this consumer.  By default it is not sent to
	// the server.
	MessageTimeout time.Duration `json:"message_timeout"`
}

Identify represents the IDENTIFY command.

func (Identify) Name

func (c Identify) Name() string

Name returns the name of the command in order to satisfy the Command interface.

func (Identify) Write

func (c Identify) Write(w *bufio.Writer) (err error)

Write serializes the command to the given buffered output, satisfies the Command interface.

type Manager added in v1.0.4

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

func (*Manager) AddProducerManager added in v1.0.4

func (m *Manager) AddProducerManager(c *ProducerManagerConfig)

type ManagerConfig added in v1.0.4

type ManagerConfig struct {
	Configs []*ProducerManagerConfig `json:"configs"`
}

type NodeData added in v1.0.4

type NodeData struct {
	RemoteAddr    string      `json:"remote_address"`
	HostName      string      `json:"hostname"`
	BroadcastAddr string      `json:"broadcast_address"`
	TCPPort       int         `json:"tcp_port"`
	HTTPPort      int         `json:"http_port"`
	Version       string      `json:"version"`
	Tombstones    interface{} `json:"tombstones"`
	Topics        interface{} `json:"topics"`
}

type NodesData added in v1.0.4

type NodesData struct {
	Producers []*NodeData `json:"producers"`
}

type ProducerClient

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

func NewProducerClient

func NewProducerClient(addr string) *ProducerClient

func (*ProducerClient) Pub

func (c *ProducerClient) Pub(topicName string, body []byte)

func (*ProducerClient) Run

func (c *ProducerClient) Run()

type ProducerConfig

type ProducerConfig struct {
	FailOnConnErr  bool
	MaxConcurrency int
	Address        string
	Topic          string
	DialTimeout    time.Duration
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
}

type ProducerManager added in v1.0.4

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

func NewProducerManager added in v1.0.4

func NewProducerManager(configs []*ProducerConfig, poolSize int) *ProducerManager

func (*ProducerManager) AddProducer added in v1.0.4

func (m *ProducerManager) AddProducer(address string)

func (*ProducerManager) GetProducer added in v1.0.4

func (m *ProducerManager) GetProducer() *ProducerClient

type ProducerManagerConfig added in v1.0.4

type ProducerManagerConfig struct {
	Category        string            `json:"category"`
	ProducerConfigs []*ProducerConfig `json:"producerConfigs"`
	PoolSize        int
}

type PublishData

type PublishData struct {
	TopicName string
	Body      []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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