broker

package
v0.0.0-...-53e3d08 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

Broker a mqtt broker

func NewBroker

func NewBroker(c *config.Config, pf *persist.Factory, report Report) (b *Broker, err error)

NewBroker NewBroker

func (*Broker) Close

func (b *Broker) Close()

Close closes broker

func (*Broker) Config

func (b *Broker) Config() *config.Config

Config returns config

func (*Broker) FetchQ1

func (b *Broker) FetchQ1(offset uint64, batchSize int) ([]*common.Message, error)

FetchQ1 fetches messages with qos=1

func (*Broker) Flow

func (b *Broker) Flow(msg *common.Message)

Flow flows message to broker

func (*Broker) InitOffset

func (b *Broker) InitOffset(id string, persistent bool) (uint64, error)

InitOffset init offset

func (*Broker) MsgQ0Chan

func (b *Broker) MsgQ0Chan() <-chan *common.Message

MsgQ0Chan returns config

func (*Broker) OffsetChanLen

func (b *Broker) OffsetChanLen() int

OffsetChanLen returns the length of offset channel

func (*Broker) OffsetPersisted

func (b *Broker) OffsetPersisted(id string) (*uint64, error)

OffsetPersisted gets sink's offset from database

func (*Broker) PersistOffset

func (b *Broker) PersistOffset(id string, offset uint64) error

PersistOffset puts sink's offset to offset channal

func (*Broker) WaitOffsetPersisted

func (b *Broker) WaitOffsetPersisted()

WaitOffsetPersisted waits all offsets in channel to be persisted

type Offset

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

Offset sink's offset to persist

type Report

type Report func(map[string]interface{}) error

Report reports stats

Jump to

Keyboard shortcuts

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