pulsar

package module
v0.0.0-...-ca7b6da Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 14 Imported by: 0

README

pulsar-client-go

English | 中文版

Introduction

Tuya pulsar client SDK for Golang

Get Started

Support

You can get support from Tuya with the following methods:

Documentation

Index

Constants

View Source
const (
	DefaultFlowPeriodSecond = 30
	DefaultFlowPermit       = 10

	PulsarAddrCN = "pulsar://mqe.tuyacn.com:7285"
	PulsarAddrEU = "pulsar://mqe.tuyaeu.com:7285"
	PulsarAddrUS = "pulsar://mqe.tuyaus.com:7285"
)

Variables

This section is empty.

Functions

func NewAuthProvider

func NewAuthProvider(accessID, accessKey string) *authProvider

func SetInternalLogLevel

func SetInternalLogLevel(level logrus.Level)

func TopicForAccessID

func TopicForAccessID(accessID string) string

Types

type AuthProvider

type AuthProvider interface {
	AuthMethod() string
	AuthData() []byte
}

type Client

type Client interface {
	NewConsumer(config ConsumerConfig) (Consumer, error)
}

func NewClient

func NewClient(cfg ClientConfig) Client

type ClientConfig

type ClientConfig struct {
	PulsarAddr string
}

type Consumer

type Consumer interface {
	ReceiveAndHandle(ctx context.Context, handler PayloadHandler)
	Stop()
}

type ConsumerConfig

type ConsumerConfig struct {
	Topic string
	Auth  AuthProvider
}

type ConsumerList

type ConsumerList struct {
	FlowPeriodSecond int
	FlowPermit       uint32
	Topic            string
	Stopped          chan struct{}
	// contains filtered or unexported fields
}

func (*ConsumerList) CronFlow

func (l *ConsumerList) CronFlow()

func (*ConsumerList) ReceiveAndHandle

func (l *ConsumerList) ReceiveAndHandle(ctx context.Context, handler PayloadHandler)

func (*ConsumerList) Stop

func (l *ConsumerList) Stop()

type Message

type Message = msg.Message

type PayloadHandler

type PayloadHandler interface {
	HandlePayload(ctx context.Context, msg *Message, payload []byte) error
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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