broker

package
v0.0.0-...-7cb1dad Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongScheme                  = errors.New("URI scheme must be amqps")
	ErrWrongQueue                   = errors.New("Queue name must be specified")
	ErrWrongKey                     = errors.New("Key must be specified")
	ErrWrongCert                    = errors.New("Cert must be specified")
	ErrWrongCA                      = errors.New("CA bundle must be specified")
	ErrWrongLogLevel                = errors.New("Log level must be specified")
	ErrWrongLogLevelValue           = errors.New("Log level must be between 0 and 5")
	ErrWrongInsecureSkipVerify      = errors.New("InsecureSkipVerify must be specified")
	ErrWrongInsecureSkipVerifyValue = errors.New("InsecureSkipVerify must be a boolean")
	ErrWrongConnectionString        = errors.New("Connection string must be specified")
	ErrWrongControllerType          = errors.New("Controller type must be specified")
)

Functions

This section is empty.

Types

type Controller

type Controller struct {
	ConnectionString string
	QueueName        string
	Svc              model.IService
	// contains filtered or unexported fields
}

func NewController

func NewController(conf ControllerConfig, svc model.IService) *Controller

NewController initializes and returns a new Controller instance with the specified configuration and service. It sets up a logger, loads TLS certificates, and handles errors with insecure skip verify as fallback.

func (*Controller) Close

func (c *Controller) Close() error

func (*Controller) Start

func (c *Controller) Start(ctx context.Context, wg *sync.WaitGroup)

Start begins the controller's operation by establishing a connection to RabbitMQ and starting message consumption. It runs the consume function in a separate goroutine, allowing it to process messages asynchronously. The method completes by signaling the associated WaitGroup when the operation is done or if a connection error occurs.

type ControllerConfig

type ControllerConfig struct {
	ConnectionString   string `yaml:"ConnectionString"`
	Scheme             string `yaml:"Scheme"`
	Host               string `yaml:"Host"`
	Port               int    `yaml:"Port"`
	UserName           string `yaml:"UserName"`
	Password           string `yaml:"Password"`
	Resource           string `yaml:"Resource"`
	QueueName          string `yaml:"QueueName"`
	LogLevel           int    `yaml:"LogLevel"`
	Key                string `yaml:"Key"`
	CABundle           string `yaml:"CABundle"`
	Cert               string `yaml:"Cert"`
	InsecureSkipVerify bool   `yaml:"InsecureSkipVerify"`
}

Jump to

Keyboard shortcuts

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