startup

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package startup is intended as a helper package to run services in go routines in main

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilListener      = errors.New("Nil Listener")
	ErrNilListenerValue = errors.New("Nil Listener value")
)

Functions

func Run

func Run(serviceName string, run Runner)

defers do not work in main() because of the os.Exit(

Types

type Listener

type Listener interface {
	Listen() error
	Shutdown(context.Context) error
}

Listener is an interface that describes any kind of listener - HTTP Server, GRPC Server or servicebus receiver.

type Listeners

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

Listeners contains all servers that comply with the service.

func NewListeners

func NewListeners(log Logger, name string, opts ...ListenersOption) Listeners

func (*Listeners) Listen

func (l *Listeners) Listen() error

func (*Listeners) Shutdown

func (l *Listeners) Shutdown() error

func (*Listeners) String

func (l *Listeners) String() string

type ListenersOption

type ListenersOption func(*Listeners)

func WithListeners

func WithListeners(listeners ...Listener) ListenersOption

WithListeners add multiple listeners. Nil listeners will cause an error to be returned.

type Logger

type Logger = logger.Logger

type Runner

type Runner func(string, logger.Logger) error

Jump to

Keyboard shortcuts

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