pusher

package
v3.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableFeedbackReporters = map[string]feedbackReporterInitializer{
	"kafka": func(config *viper.Viper, logger *logrus.Logger) (interfaces.FeedbackReporter, error) {
		return extensions.NewKafkaProducer(config, logger)
	},
}

AvailableFeedbackReporters contains functions to initialize all feedback reporters

View Source
var AvailableInvalidTokenHandlers = map[string]invalidTokenHandlerInitializer{
	"pg": func(config *viper.Viper, logger *logrus.Logger, dbOrNil interfaces.DB) (interfaces.InvalidTokenHandler, error) {
		return extensions.NewTokenPG(config, logger, dbOrNil)
	},
}

AvailableInvalidTokenHandlers contains functions to initialize all invalid token handlers

View Source
var AvailableStatsReporters = map[string]statsReporterInitializer{
	"statsd": func(config *viper.Viper, logger *logrus.Logger, clientOrNil interfaces.StatsDClient) (interfaces.StatsReporter, error) {
		return extensions.NewStatsD(config, logger, clientOrNil)
	},
}

AvailableStatsReporters contains functions to initialize all stats reporters

Functions

func GracefulShutdown added in v0.2.0

func GracefulShutdown(wg *sync.WaitGroup, timeout time.Duration)

GracefulShutdown waits for wg do complete then exits

func WaitTimeout added in v0.2.0

func WaitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool

WaitTimeout waits for the waitgroup for the specified max timeout. Returns true if waiting timed out. got from http://stackoverflow.com/a/32843750/3987733

Types

type APNSPusher

type APNSPusher struct {
	CertificatePath string
	Config          *viper.Viper

	GracefulShutdownTimeout int
	InvalidTokenHandlers    []interfaces.InvalidTokenHandler
	IsProduction            bool
	Logger                  *logrus.Logger
	MessageHandler          map[string]interfaces.MessageHandler
	Queue                   interfaces.Queue

	StatsReporters []interfaces.StatsReporter
	// contains filtered or unexported fields
}

APNSPusher struct for apns pusher

func NewAPNSPusher

func NewAPNSPusher(
	isProduction bool,
	config *viper.Viper,
	logger *logrus.Logger,
	statsdClientOrNil interfaces.StatsDClient,
	db interfaces.DB,
	queueOrNil ...interfaces.APNSPushQueue,
) (*APNSPusher, error)

NewAPNSPusher for getting a new APNSPusher instance

func (*APNSPusher) Start

func (a *APNSPusher) Start()

Start starts pusher in apns mode

type GCMPusher

type GCMPusher struct {
	Config *viper.Viper

	GracefulShutdownTimeout int
	InvalidTokenHandlers    []interfaces.InvalidTokenHandler
	IsProduction            bool
	Logger                  *logrus.Logger
	MessageHandler          map[string]interfaces.MessageHandler
	Queue                   interfaces.Queue

	StatsReporters []interfaces.StatsReporter
	// contains filtered or unexported fields
}

GCMPusher struct for GCM pusher

func NewGCMPusher

func NewGCMPusher(
	isProduction bool,
	config *viper.Viper,
	logger *logrus.Logger,
	statsdClientOrNil interfaces.StatsDClient,
	db interfaces.DB,
	clientOrNil ...interfaces.GCMClient,
) (*GCMPusher, error)

NewGCMPusher for getting a new GCMPusher instance

func (*GCMPusher) Start

func (g *GCMPusher) Start()

Start starts pusher in apns mode

Jump to

Keyboard shortcuts

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