natsservice

package
v1.1.34 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCommonCommandLineParams added in v0.1.16

func ParseCommonCommandLineParams(params *CommonCommandLineParams)

ParseCommonCommandLineParams sets the command line parameters, or their default values

Types

type CommonCommandLineParams added in v0.1.16

type CommonCommandLineParams struct {
	Log          string
	ConfigFolder string
}

CommandLineParams holds the common, non generic command line parameters

type Config added in v0.1.15

type Config struct {
	Servers []struct {
		Url string `default:"nats://nats1.plugis.com:443"`
		Sni bool   `default:"true"`
	}

	Postgres PostgresConfig

	Mysql MysqlConfig

	CommandLineParams CommonCommandLineParams
}

func LoadConfig added in v0.1.15

func LoadConfig(files ...string) (Config, error)

type MysqlConfig added in v0.1.15

type MysqlConfig struct {
	Host     string `default:"127.0.0.1"`
	Database string `default:"plugis"`
	User     string `default:"plugis"`
	Password string `required:"true" env:"MysqlPassword" default:"plugis"`
	Port     uint   `default:"3306"`
}

type NatsService

type NatsService struct {
	NatsServiceIntf
	// contains filtered or unexported fields
}

func NewNatsService

func NewNatsService(logger *logrus.Entry, transport natsevents.Transport) *NatsService

NewNatsService creates a nats service

func (*NatsService) Logger

func (ns *NatsService) Logger() *logrus.Entry

implement Logger

func (*NatsService) SetLogger

func (ns *NatsService) SetLogger(logger *logrus.Entry)

func (*NatsService) SetTransport

func (ns *NatsService) SetTransport(transport natsevents.Transport)

func (*NatsService) Transport

func (ns *NatsService) Transport() natsevents.Transport

implement Transporter

type NatsServiceIntf

type NatsServiceIntf interface {
	task.Runnable
	logger.Logger
	natsevents.Transporter
}

type NatsServiceProcess added in v1.1.31

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

func NewServiceProcess added in v1.1.31

func NewServiceProcess(config NatsServiceProcessConfig) (*NatsServiceProcess, error)

func (*NatsServiceProcess) Close added in v1.1.31

func (serviceprocess *NatsServiceProcess) Close(timeout time.Duration) error

func (*NatsServiceProcess) Logger added in v1.1.34

func (serviceprocess *NatsServiceProcess) Logger() *log.Entry

func (*NatsServiceProcess) Start added in v1.1.31

func (serviceprocess *NatsServiceProcess) Start(natsSvc NatsServiceIntf, params ...interface{}) *task.Task

func (*NatsServiceProcess) WaitUntilAllDone added in v1.1.31

func (serviceprocess *NatsServiceProcess) WaitUntilAllDone()

type NatsServiceProcessConfig added in v1.1.31

type NatsServiceProcessConfig struct {
	ServiceName   string
	NatsServers   string
	LogLevel      string
	CancelTimeout time.Duration
}

type NatsServiceRepository

type NatsServiceRepository struct {
	task.RunnerRepository
	natsevents.Transporter
	// contains filtered or unexported fields
}

NatsServiceRepository provides logging nats cloud events transport for multiple services

func NewNatsServiceRepository

func NewNatsServiceRepository(name string, natsServers string, logLevel string) (*NatsServiceRepository, error)

NewNatsServiceRepository creates a nats service repository

func (*NatsServiceRepository) Close

func (nsr *NatsServiceRepository) Close(timeout time.Duration) error

Close closes flushes events on nats if timeout > 0 and closes nats connection

func (*NatsServiceRepository) Logger added in v0.1.12

func (nsr *NatsServiceRepository) Logger() *logrus.Entry

Logger returns the logger for the service repository

func (*NatsServiceRepository) Name added in v0.1.13

func (nsr *NatsServiceRepository) Name() string

Name returns the name given in NewNatsTransport

func (*NatsServiceRepository) Start

func (nsr *NatsServiceRepository) Start(ctx context.Context, natsSvc NatsServiceIntf, params ...interface{}) *task.Task

Start creates a go routine and runs natsSvc Run function

func (*NatsServiceRepository) Transport added in v0.1.13

func (nsr *NatsServiceRepository) Transport() natsevents.Transport

Transport returns the transport for the service repository

type PostgresConfig added in v0.1.15

type PostgresConfig struct {
	Host     string `default:"127.0.0.1"`
	Database string `default:"plugis"`
	User     string `default:"plugis"`
	Password string `required:"true" env:"PostgresPassword" default:"plugis"`
	Port     uint   `default:"5432"`
}

Jump to

Keyboard shortcuts

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