config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMQPConfig

type AMQPConfig struct {
	// Host is the host of the queue
	Host string `yaml:"host,omitempty"`

	// Port is the port of the queue
	Port int `yaml:"port,omitempty"`

	// Username is the username of the queue
	Username string `yaml:"username,omitempty"`

	// Password is the password of the queue
	Password string `yaml:"password,omitempty"`
}

AMQPConfig is the main configuration information needed to connect to an AMQP provider

type Config

type Config struct {
	// Providers is a list of sources that will be connected to
	Providers []*ProviderConfig `yaml:"providers"`

	// Queues is a list of queues that will be consumed
	Queues []*QueueConfig `yaml:"queues"`

	// Debug is a flag that enables debug logging
	Debug bool `yaml:"debug"`
}

Config is the main configuration struct

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the configuration from the config.yaml file

func (*Config) ValidateAll

func (c *Config) ValidateAll() error

ValidateAll validates the configuration

type KafkaConfig

type KafkaConfig struct {
	// Brokers is a list of brokers that will be consumed
	Brokers []string `yaml:"brokers,omitempty"`

	// Topic is a list of topics that will be consumed
	Topic string `yaml:"topic,omitempty"`

	// Group is the consumer group that will be used
	Group string `yaml:"group,omitempty"`
}

KafkaConfig is the main configuration information needed to connect to a Kafka provider

type ProviderConfig

type ProviderConfig struct {
	// Name is the name of the provider
	Name string `yaml:"name"`

	// Type is the type of the provider, such as "amqp" or "kafka"
	Type string `yaml:"type"`

	// Retry is the number of times to retry connecting to the provider
	Retry int `yaml:"retry,omitempty"`

	// AMQPConfig is the configuration for the AMQP provider
	AMQPConfig *AMQPConfig `yaml:"amqp-config,omitempty"`

	// KafkaConfig is the configuration for the Kafka provider
	KafkaConfig *KafkaConfig `yaml:"kafka-config,omitempty"`

	// StompMQConfig is the configuration for the ActiveMQ provider
	StompMQConfig *StompConfig `yaml:"stomp-config,omitempty"`
}

ProviderConfig is the main configuration information needed to connect to a provider

type QueueConfig

type QueueConfig struct {
	// Name is the name of the queue
	Name string `yaml:"name"`

	// Provider is the provider that will be used to consume the queue
	Provider string `yaml:"provider"`

	// Retry is the retry configuration for the queue
	Retry *RetryConfig `yaml:"retry,omitempty"`

	// Routes is the list of routes that will be used to send the messages
	Routes []*RouteConfig `yaml:"routes"`
}

QueueConfig is the main configuration information needed to consume a queue

type RetryConfig

type RetryConfig struct {
	// Enabled is the flag that indicates if the retry is enabled, defaults to false
	Enabled bool `yaml:"enabled,omitempty"`

	// MaxRetries is the maximum number of retries for the queue
	MaxRetries int `yaml:"max_retries"`

	// Strategy is the retry strategy for the queue, defaults to "fixed"
	Strategy string `yaml:"strategy,omitempty"`

	// Interval is the interval between retries
	Interval time.Duration `yaml:"interval"`

	// ThresholdStatus is the minimum status code that will trigger a retry, defaults to 500
	ThresholdStatus int `yaml:"threshold_status,omitempty"`
}

RetryConfig is the main configuration information needed to retry a message

type RouteConfig

type RouteConfig struct {
	// Name is the name of the route
	Name string `yaml:"name"`

	// URL is the URL of the service
	URL string `yaml:"url"`

	// Method is the HTTP method of the request, defaults to "POST"
	Method string `yaml:"method,omitempty"`

	// Type is the type of the request, defaults to "REST"
	Type string `yaml:"type,omitempty"`

	// Headers is the list of headers that will be sent with the request
	Headers map[string]string `yaml:"headers,omitempty"`

	// Body is the body of the request
	Body map[string]interface{} `yaml:"body,omitempty"`

	// Query is the query string of the request
	Query map[string]string `yaml:"query,omitempty"`

	// Timeout is the timeout of the request, defaults to 10 seconds
	Timeout time.Duration `yaml:"timeout,omitempty"`
}

RouteConfig is the main configuration information needed to send a message to a service

type StompConfig added in v0.2.0

type StompConfig struct {
	// Host is the host of the queue
	Host string `yaml:"host,omitempty"`

	// Port is the port of the queue
	Port int `yaml:"port,omitempty"`

	// Username is the username of the queue
	Username string `yaml:"username,omitempty"`

	// Password is the password of the queue
	Password string `yaml:"password,omitempty"`
}

Jump to

Keyboard shortcuts

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