nsq

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

	//init
	 pu,err:=NewProducer("192.168.0.197",4150)
	 if err!=nil{
		//error
	 }
	 b,_:=json.Marshal(obj)
  	 //发送
	 err = pu.Publish("topic",b)
	 if err!=nil{
		//error
	 }

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageHandler

type MessageHandler struct {
	Channel string
	// contains filtered or unexported fields
}

MessageHandler MessageHandler

func NewMessageHandler

func NewMessageHandler(nsqServer string, channel string) (mh *MessageHandler, err error)

NewMessageHandler return new MessageHandler

func (*MessageHandler) Registry

func (m *MessageHandler) Registry(topic string, ch chan []byte)

Registry Registry

type Producer

type Producer struct {
	P *gnsq.Producer
}

Producer Producer

func NewProducer

func NewProducer(addr string) (producer *Producer, err error)

NewProducer init

func (*Producer) Publish

func (m *Producer) Publish(topic string, data []byte) (err error)

Publish publish

Jump to

Keyboard shortcuts

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