environment

package
v0.0.0-...-5229af2 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2016 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Overview

The environment package provides a way to setup a global environment and also have the ability to create local encironments for testing.

Index

Constants

This section is empty.

Variables

View Source
var Env = New()

Global Environment, use it if you want to or create your own with New()

Functions

func RegisterService

func RegisterService(name string, service casa.Service)

Types

type Environment

type Environment struct {
	*viper.Viper
	casa.MessageBus
	*ServiceRegistry
	SignalHandler
	BrokerLogger broker.Logger
	casa.Logger
}

func New

func New(options ...Option) *Environment

func (*Environment) WithOptions

func (e *Environment) WithOptions(options ...Option) *Environment

type NullMessageBus

type NullMessageBus struct{}

func (NullMessageBus) Close

func (b NullMessageBus) Close() error

func (NullMessageBus) NewClient

func (b NullMessageBus) NewClient() casa.MessageClient

type NullMessageStore

type NullMessageStore struct{}

func (NullMessageStore) Close

func (s NullMessageStore) Close() error

func (NullMessageStore) Get

func (s NullMessageStore) Get(topic string) (casa.Message, error)

func (NullMessageStore) Put

func (s NullMessageStore) Put(msg casa.Message) error

func (NullMessageStore) Store

func (s NullMessageStore) Store(topic string, bus casa.MessageBus) error

type Option

type Option func(*Environment)

func WithBrokerLogger

func WithBrokerLogger(l broker.Logger) Option

func WithBus

func WithBus(bus casa.MessageBus) Option

func WithHandler

func WithHandler(handler SignalHandler) Option

func WithLogger

func WithLogger(l casa.Logger) Option

func WithRegistry

func WithRegistry(svc *ServiceRegistry) Option

func WithViper

func WithViper(v *viper.Viper) Option

type ServiceRegistry

type ServiceRegistry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ServiceRegistry) AddService

func (s *ServiceRegistry) AddService(name string, service casa.Service)

func (*ServiceRegistry) GetAllServices

func (s *ServiceRegistry) GetAllServices() map[string]casa.Service

func (*ServiceRegistry) GetService

func (s *ServiceRegistry) GetService(name string) casa.Service

func (*ServiceRegistry) RemoveService

func (s *ServiceRegistry) RemoveService(name string)

type SignalHandler

type SignalHandler interface {
	HandleSignal(chan os.Signal)
}

Jump to

Keyboard shortcuts

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