nsq

package
v0.0.0-...-20aadb4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: MIT Imports: 9 Imported by: 3

README

nsq

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.RWMutex
	ID                 int64 // GUID
	Producer           *nsq.Producer
	Topics             map[string]byte          // "topic": client-client'
	Subscribes         map[string]*nsq.Consumer // "topic/channel" -> Consumer
	LookupdHTTPAddress string                   // Lookupd HTTP address
}

Client can use a producer for publish and subscribe multi topic/channel message

func NewClient

func NewClient(id int64, addr, lookupdHTTPAddress string, config *Config) (*Client, error)

NewClient create an instance of Client

func (*Client) Publish

func (c *Client) Publish(topic string, message string) error

Publish a message on specified topic

func (*Client) SetHandler

func (c *Client) SetHandler(topic, channel string, handler Handler) error

SetHandler set handler of consumer in Client.Subscribes

func (*Client) Subscribe

func (c *Client) Subscribe(topic, channel string, config *Config, handler Handler) error

Subscribe topic/channel message with nsq.consumer

type Config

type Config = nsq.Config

Config for nsq.producer

func NewConfig

func NewConfig() *Config

NewConfig return default Config

type Handler

type Handler = nsq.Handler

Handler for consumer

type HandlerFunc

type HandlerFunc func(message *Message) error

HandlerFunc for consumer

func (HandlerFunc) HandleMessage

func (h HandlerFunc) HandleMessage(m *Message) error

HandleMessage implements the Handler interface

type LookupdOptions

type LookupdOptions = nsqlookupd.Options

LookupdOptions https://nsq.io/components/nsqlookupd.html nsqlookupd.NewOptions() return default Option

func NewLookupdOptions

func NewLookupdOptions() *LookupdOptions

NewLookupdOptions ...

type Message

type Message = nsq.Message

Message for topic

type NSQAdmin

type NSQAdmin = nsqadmin.NSQAdmin

NSQAdmin is a Web UI to view aggregated cluster stats in realtime and perform various administrative tasks.

func StartNsqAdmin

func StartNsqAdmin(opts *NsqadminOptions) (*NSQAdmin, error)

StartNsqAdmin start a nsqadmin service

type NSQD

type NSQD = nsqd.NSQD

NSQD is the daemon that receives, queues, and delivers messages to clients. It can be run standalone but is normally configured in a cluster with nsqlookupd instance(s) (in which case it will announce topics and channels for discovery). It listens on two TCP ports, one for clients and another for the HTTP API. It can optionally listen on a third port for HTTPS.

func StartNsqd

func StartNsqd(opts *NsqdOptions) (*NSQD, error)

StartNsqd start a nsqd service

type NSQLookupd

type NSQLookupd = nsqlookupd.NSQLookupd

NSQLookupd is the daemon that manages topology information. Clients query nsqlookupd to discover nsqd producers for a specific topic and nsqd nodes broadcasts topic and channel information.

There are two interfaces: A TCP interface which is used by nsqd for broadcasts, and an HTTP interface for clients to perform discovery and administrative actions.

func StartNsqlookupd

func StartNsqlookupd(opts *LookupdOptions) (*NSQLookupd, error)

StartNsqlookupd start a nsqlookupd service

type NsqadminOptions

type NsqadminOptions = nsqadmin.Options

NsqadminOptions https://nsq.io/components/nsqadmin.html nsqadmin.NewOptions() return default Option

func NewNsqadminOptions

func NewNsqadminOptions() *NsqadminOptions

NewNsqadminOptions ...

type NsqdOptions

type NsqdOptions = nsqd.Options

NsqdOptions https://nsq.io/components/nsqd.html nsqd.NewOptions() return default Option

func NewNsqdOptions

func NewNsqdOptions() *NsqdOptions

NewNsqdOptions ...

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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