nsq

package
v0.0.0-...-d09ac20 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 6 Imported by: 1

README

NSQ

1.nsqlookupd

通过tcp(端口4160)管理nsqd服务,通过tcp(端口4161)管理nsqadmin服务,为客户端提供nsqd地址查询服务 一套nsq服务仅一个nsqlookupd服务,集群中可多台但之间无联系.nsqlookupd崩溃不会影响nsqd服务

2.nsqadmin

一个队topic和channel统一管理的操作界面及监控数据展示.默认访问地址:http://127.0.0.1:4171/

3.nsqd

负责收发message及维护队列,默认监听tcp端口4150及http端口4151及另一可选https端口

  • 同一topic同一channel的消费者负载均衡(非轮询)
  • 当channel存在时,即使channel无消费者,生产者的msg也会被缓存到队列
  • 队列中的msg至少会被消费一次
  • 限定内存占用,当channel的在内存中的msg数量超出时,msg会被缓存到磁盘
  • topic及channel在创建后会被保存,需定时清理无效topic及channel

4.连接方式

  • 消费者直连nsqd,此法使得nsqd服务无法动态扩展.当检测到连接断开后,每隔x秒会自动重连
  • 消费者通过http查询nsqlookupd获取nsqd地址,再连接nsqd,此法客户端会轮询nsqlookupd
  • 生产者必须直连nsqd且断开后需手动重连
  • 消费者可以同时接收不同nsqd节点的同名topic数据

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Consumer *nsq.Consumer
View Source
var NsqCloseSign = false
View Source
var NsqWait sync.WaitGroup
View Source
var Producer *nsq.Producer

Functions

func ConsumeStart

func ConsumeStart()

func NsqInit

func NsqInit()

func Publish

func Publish(t log.TLog, topic, msg string)

func PublishStart

func PublishStart()

Types

type ConsumerS

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

func (*ConsumerS) HandleMessage

func (this *ConsumerS) HandleMessage(msg *nsq.Message) error

Jump to

Keyboard shortcuts

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