service

package module
v0.0.0-...-17eb709 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RedisURL      string
	NatsURL       string
	NatsUserCreds string
	NatsKeyFile   string
}

type MsgHandler

type MsgHandler func(*Service, *nats.Msg) error

type Service

type Service struct {
	ClientID string
	Nats     f3nats.NatsConn
	Redis    redis.Conn
	PreRun   []func(*Service, *Config) error
	PostRun  []func(*Service)
	Handlers map[models.EventType]MsgHandler
	// contains filtered or unexported fields
}

func NewService

func NewService(clientID string, handlers ...map[models.EventType]MsgHandler) *Service

func (*Service) ReplyWithError

func (s *Service) ReplyWithError(request *nats.Msg, err error, msg string) error

ReplyWithError publish the error to the reply channel and returns the wrapped error.

func (*Service) Start

func (s *Service) Start(config *Config) error

Jump to

Keyboard shortcuts

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