nsqservice

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNsqConsumer

func NewNsqConsumer(c *NsqConsumerConfig)

nsq consumer

Types

type BodyEx

type BodyEx struct {
	S2S  string `json:"s2s"`  // S2S数据
	Body []byte `json:"body"` // body数据
}

type LogEx

type LogEx struct{ Zservice *zservice.ZService }

日志扩展

func (*LogEx) Output

func (l *LogEx) Output(calldepth int, s string) error

type NsqConsumerConfig

type NsqConsumerConfig struct {
	Addrs         string // 地址 多个地址用 , 隔开
	UseNsqlookupd bool   // 是否是 nsqd 地址
	Topic         string // 主题
	Channel       string // 频道
	OnMessage     func(ctx *zservice.Context, body []byte)
}

type NsqProducerService

type NsqProducerService struct {
	*zservice.ZService
	Producer *nsq.Producer
}

func NewNsqProducerService

func NewNsqProducerService(c *NsqProducerServiceConfig) *NsqProducerService

创建一个新的nsq服务

func (*NsqProducerService) Publish

func (nps *NsqProducerService) Publish(ctx *zservice.Context, topic string, body []byte) *zservice.Error

func (*NsqProducerService) Stop

func (nps *NsqProducerService) Stop()

type NsqProducerServiceConfig

type NsqProducerServiceConfig struct {
	Addr string // nsq地址

	OnStart func(*NsqProducerService) // 启动的回调
}

Jump to

Keyboard shortcuts

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