push

package
v1.0.6-1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LinearActivity

func LinearActivity(p *Pusher, brk brokers.Broker, store stores.Store) error

LinearActivity implements a linear retry push

Types

type HTTPSender

type HTTPSender struct {
	Client http.Client
}

HTTPSender sends msgs through http

func NewHTTPSender

func NewHTTPSender(timeoutSec int) *HTTPSender

NewHTTPSender creates a new HTTPSender. Specify timeout in seconds

func (*HTTPSender) Send

func (hs *HTTPSender) Send(msg string, endpoint string) error

Send sends a message through HTTP

type Manager

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

Manager manages all pusher routines

func NewManager

func NewManager(brk brokers.Broker, str stores.Store, sndr Sender) *Manager

NewManager creates a new manager object for managing push routines

func (*Manager) Add

func (mgr *Manager) Add(projectUUID string, subName string) error

Add a new push subscription

func (*Manager) Get

func (mgr *Manager) Get(psub string) (*Pusher, error)

Get returns a pusher

func (*Manager) Launch

func (mgr *Manager) Launch(project string, sub string) error

Launch Launches a new puhser

func (*Manager) LoadPushSubs

func (mgr *Manager) LoadPushSubs()

LoadPushSubs is called during API initialization to retrieve available push configured subs and activate them

func (*Manager) PrintAll

func (mgr *Manager) PrintAll()

PrintAll prints manager stats

func (*Manager) Refresh

func (mgr *Manager) Refresh(projectUUID string, sub string) error

Refresh updates the subscription information from the database

func (*Manager) Remove

func (mgr *Manager) Remove(project string, sub string) error

Remove a push subscription

func (*Manager) RemoveProjectAll

func (mgr *Manager) RemoveProjectAll(projectUUID string) error

RemoveProjectAll stops and removes all pushers related to a project

func (*Manager) Restart

func (mgr *Manager) Restart(project string, sub string) error

Restart a push subscription

func (*Manager) StartAll

func (mgr *Manager) StartAll()

StartAll enables all pushsers

func (*Manager) Stop

func (mgr *Manager) Stop(project string, sub string) error

Stop stops a push subscription

func (*Manager) StopAll

func (mgr *Manager) StopAll() error

StopAll stops Activity on all pushers

type MockSender

type MockSender struct {
	ClientFail   bool
	LastMsg      string
	LastEndpoint string
}

MockSender mocks sending messages to remote endpoints

func NewMockSender

func NewMockSender(fail bool) *MockSender

NewMockSender creates a new Mock sender

func (*MockSender) Send

func (ms *MockSender) Send(msg string, endpoint string) error

Send sends a message through HTTP

type Pusher

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

Pusher holds information for the pusher routine and subscription

type Sender

type Sender interface {
	Send(msg string, endpoint string) error
}

Sender is inteface for sending messages to remote endpoints

Directories

Path Synopsis
grpc

Jump to

Keyboard shortcuts

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