producer

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TPC - protocol
	TPC = "tcp"
	// HTTP - protocol
	HTTP = "http"
)

Variables

View Source
var (
	Queue  NSQ
	Config Configs
	Logger = log.New(os.Stderr, "", log.Flags())
)

Functions

func ConnHTTP

func ConnHTTP(c Configs)

ConnHTTP -

func ConnTCP

func ConnTCP(c Configs) error

ConnTCP -

Types

type Configs

type Configs struct {
	Protocol string
	URL      string
	Retry    int
	Timeout  time.Duration
	LogLevel nsq.LogLevel
	Topic    string
}

Configs -

type Hconnecter

type Hconnecter struct {
	URL string
}

Hconnecter - Http

func (*Hconnecter) Publish

func (t *Hconnecter) Publish(topic string, d []byte) error

Publish - HTTP

func (*Hconnecter) PublishStop

func (t *Hconnecter) PublishStop()

PublishStop -

type NSQ

type NSQ interface {
	Publish(topic string, d []byte) error
	PublishStop()
}

NSQ - interface

type Tconnecter

type Tconnecter struct {
	URL      string
	Producer *nsq.Producer
}

Tconnecter - TPC

func (*Tconnecter) Publish

func (t *Tconnecter) Publish(topic string, d []byte) error

Publish - TPC

func (*Tconnecter) PublishStop

func (t *Tconnecter) PublishStop()

PublishStop -

Jump to

Keyboard shortcuts

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