Documentation
¶
Index ¶
- Constants
- Variables
- type AppVersion
- type BrokerConfig
- type CLIConfig
- type Config
- func (config *Config) GetConnectionTimeout() time.Duration
- func (config *Config) GetDBConnectionMaxIdleTime() time.Duration
- func (config *Config) GetDBConnectionMaxLifetime() time.Duration
- func (config *Config) GetDBConnectionURL() string
- func (config *Config) GetDBDialect() DBDialect
- func (config *Config) GetHTTPListeningAddr() string
- func (config *Config) GetHTTPReadTimeout() time.Duration
- func (config *Config) GetHTTPWriteTimeout() time.Duration
- func (config *Config) GetLogFilename() string
- func (config *Config) GetLogLevel() LogLevel
- func (config *Config) GetMaxAgeForALogFile() uint
- func (config *Config) GetMaxIdleDBConnections() uint16
- func (config *Config) GetMaxLogBackups() uint
- func (config *Config) GetMaxLogFileSize() uint
- func (config *Config) GetMaxMessageQueueSize() uint
- func (config *Config) GetMaxOpenDBConnections() uint16
- func (config *Config) GetMaxRetry() uint8
- func (config *Config) GetMaxWorkers() uint
- func (config *Config) GetRationalDelay() time.Duration
- func (config *Config) GetRetriggerBaseEndpoint() string
- func (config *Config) GetRetryBackoffDelays() []time.Duration
- func (config *Config) GetSeedData() SeedData
- func (config *Config) GetTokenRequestHeaderName() string
- func (config *Config) GetUserAgent() string
- func (config *Config) IsCompressionEnabledOnLogBackups() bool
- func (config *Config) IsLoggerConfigAvailable() bool
- func (config *Config) IsPriorityDispatcherEnabled() bool
- func (config *Config) IsRecoveryWorkersEnabled() bool
- type ConsumerConnectionConfig
- type DBDialect
- type HTTPConfig
- type LogConfig
- type LogLevel
- type RelationalDatabaseConfig
- type SeedChannel
- type SeedConsumer
- type SeedData
- type SeedDataConfig
- type SeedProducer
Constants ¶
const ( // SQLite3Dialect represents the DB Dialect for SQLite3 SQLite3Dialect = DBDialect("sqlite3") // MySQLDialect represents the DB Dialect for MySQL MySQLDialect = DBDialect("mysql") // ConfigFilename is the default config file name ConfigFilename = "webhook-broker.cfg" // DefaultSystemConfigFilePath is the default system location of the configuration DefaultSystemConfigFilePath = "/etc/webhook-broker/" + ConfigFilename // DefaultCurrentDirConfigFilePath is the config file path based on current working dir DefaultCurrentDirConfigFilePath = ConfigFilename // Debug is the lowest LogLevel, will expose all logs Debug LogLevel = 20 + iota // Info is the second lowest LogLevel Info // Error is the second highest LogLevel Error // Fatal is the highest LogLevel with lowest logs Fatal )
const DefaultConfiguration = `` /* 1094-byte string literal not displayed */
DefaultConfiguration is the configuration that will be in effect if no configuration is loaded from any of the expected locations
Variables ¶
var ( // EmptyConfigurationForError Represents the configuration instance to be // used when there is a configuration error during load EmptyConfigurationForError = &Config{} // ConfigInjector sets up configuration related bindings ConfigInjector = wire.NewSet(GetConfigurationFromCLIConfig, wire.Bind(new(SeedDataConfig), new(*Config)), wire.Bind(new(HTTPConfig), new(*Config)), wire.Bind(new(RelationalDatabaseConfig), new(*Config)), wire.Bind(new(LogConfig), new(*Config)), wire.Bind(new(BrokerConfig), new(*Config)), wire.Bind(new(ConsumerConnectionConfig), new(*Config))) )
Functions ¶
This section is empty.
Types ¶
type AppVersion ¶
type AppVersion string
AppVersion is the version string type
func GetVersion ¶
func GetVersion() AppVersion
GetVersion provides the current version of the project
type BrokerConfig ¶
type BrokerConfig interface { GetMaxMessageQueueSize() uint GetMaxWorkers() uint IsPriorityDispatcherEnabled() bool GetRetriggerBaseEndpoint() string GetMaxRetry() uint8 GetRationalDelay() time.Duration GetRetryBackoffDelays() []time.Duration IsRecoveryWorkersEnabled() bool }
BrokerConfig provides the interface for configuring the broker
type CLIConfig ¶
type CLIConfig struct { ConfigPath string MigrationSource string StopOnConfigChange bool DoNotWatchConfigChange bool // contains filtered or unexported fields }
CLIConfig represents the Command Line Args config
func (*CLIConfig) IsConfigWatcherStarted ¶
IsConfigWatcherStarted returns whether config watcher is running
func (*CLIConfig) IsMigrationEnabled ¶
IsMigrationEnabled returns whether migration is enabled
func (*CLIConfig) NotifyOnConfigFileChange ¶
func (conf *CLIConfig) NotifyOnConfigFileChange(callback func())
NotifyOnConfigFileChange registers a callback function for changes to ConfigPath; it calls the `callback` when a change is detected
func (*CLIConfig) StopWatcher ¶
func (conf *CLIConfig) StopWatcher()
StopWatcher stops any watcher if started for CLI ConfigPath file change
type Config ¶
type Config struct { DBDialect DBDialect DBConnectionURL string DBConnectionMaxIdleTime time.Duration DBConnectionMaxLifetime time.Duration DBMaxIdleConnections uint16 DBMaxOpenConnections uint16 HTTPListeningAddr string HTTPReadTimeout time.Duration HTTPWriteTimeout time.Duration LogFilename string MaxFileSize uint MaxBackups uint MaxAge uint CompressBackupsEnabled bool SeedData SeedData TokenRequestHeaderName string UserAgent string ConnectionTimeout time.Duration MaxMessageQueueSize uint MaxWorkers uint PriorityDispatcherEnabled bool RecoveryWorkersEnabled bool RetriggerBaseEndpoint string MaxRetry uint8 RationalDelay time.Duration RetryBackoffDelays []time.Duration LogLevel LogLevel }
Config represents the application configuration
func GetAutoConfiguration ¶
GetAutoConfiguration gets configuration from default config and system defined path chain of /etc/webhook-broker/webhook-broker.cfg, {USER_HOME}/.webhook-broker/webhook-broker.cfg, webhook-broker.cfg (current dir)
func GetConfiguration ¶
GetConfiguration gets the current state of application configuration
func GetConfigurationFromCLIConfig ¶
GetConfigurationFromCLIConfig from CLIConfig.
func GetConfigurationFromParseConfig ¶
GetConfigurationFromParseConfig returns configuration from parsed configuration
func (*Config) GetConnectionTimeout ¶
GetConnectionTimeout returns the connection timeout from broker to consumer
func (*Config) GetDBConnectionMaxIdleTime ¶
GetDBConnectionMaxIdleTime returns the DB Connection max idle time
func (*Config) GetDBConnectionMaxLifetime ¶
GetDBConnectionMaxLifetime returns the DB Connection max lifetime
func (*Config) GetDBConnectionURL ¶
GetDBConnectionURL returns the DB Connection URL string
func (*Config) GetDBDialect ¶
GetDBDialect returns the DB dialect of the configuration
func (*Config) GetHTTPListeningAddr ¶
GetHTTPListeningAddr retrieves the connection string to listen to
func (*Config) GetHTTPReadTimeout ¶
GetHTTPReadTimeout retrieves the connection read timeout
func (*Config) GetHTTPWriteTimeout ¶
GetHTTPWriteTimeout retrieves the connection write timeout
func (*Config) GetLogFilename ¶
GetLogFilename retrieves the file name of the log
func (*Config) GetLogLevel ¶
GetLogLevel returns the log level as per the configuration
func (*Config) GetMaxAgeForALogFile ¶
GetMaxAgeForALogFile retrieves maximum day to retain a rotated log file
func (*Config) GetMaxIdleDBConnections ¶
GetMaxIdleDBConnections returns the maximum number of idle DB connections to retain in pool
func (*Config) GetMaxLogBackups ¶
GetMaxLogBackups retrieves max rotated logs to retain
func (*Config) GetMaxLogFileSize ¶
GetMaxLogFileSize retrieves the max log file size before its rotated in MB
func (*Config) GetMaxMessageQueueSize ¶
GetMaxMessageQueueSize returns the maximum number of messages to be queued without being dispatched
func (*Config) GetMaxOpenDBConnections ¶
GetMaxOpenDBConnections returns the maximum number of concurrent DB connections to keep open
func (*Config) GetMaxRetry ¶
GetMaxRetry returns the maximum number of attempts for delivering a message to a consumer
func (*Config) GetMaxWorkers ¶
GetMaxWorkers returns the max number of workers dispatching a message to a consumer
func (*Config) GetRationalDelay ¶
GetRationalDelay returns how long to wait before retriggering, i.e., what is the addition to picking up messages in fail-safe process.
func (*Config) GetRetriggerBaseEndpoint ¶
GetRetriggerBaseEndpoint returns the URL to the load balanced endpoint for the broker for retriggering jobs
func (*Config) GetRetryBackoffDelays ¶
GetRetryBackoffDelays returns the delay steps in retrying delivery; retry will be the index and if index is greater than size use the last value times retry-attempt
func (*Config) GetSeedData ¶
GetSeedData returns the seed data configuration
func (*Config) GetTokenRequestHeaderName ¶
GetTokenRequestHeaderName returns the Token request header to pass to the consumers
func (*Config) GetUserAgent ¶
GetUserAgent returns the user agent string for consumer HTTP connection
func (*Config) IsCompressionEnabledOnLogBackups ¶
IsCompressionEnabledOnLogBackups checks if log backups are compressed
func (*Config) IsLoggerConfigAvailable ¶
IsLoggerConfigAvailable checks is logger configuration is set since its optional
func (*Config) IsPriorityDispatcherEnabled ¶
IsPriorityDispatcherEnabled returns whether priority will be respected during dispatching from queue
func (*Config) IsRecoveryWorkersEnabled ¶
IsRecoveryWorkersEnabled retrieves whether the recovery worker should be enabled or not
type ConsumerConnectionConfig ¶
type ConsumerConnectionConfig interface { GetTokenRequestHeaderName() string GetUserAgent() string GetConnectionTimeout() time.Duration }
ConsumerConnectionConfig provides the interface for working with consumer connection related configuration
type DBDialect ¶
type DBDialect string
DBDialect allows us to define constants for supported DB drivers
type HTTPConfig ¶
type HTTPConfig interface { GetHTTPListeningAddr() string GetHTTPReadTimeout() time.Duration GetHTTPWriteTimeout() time.Duration }
HTTPConfig represents the HTTP configuration related behaviors
type LogConfig ¶
type LogConfig interface { GetLogLevel() LogLevel IsLoggerConfigAvailable() bool GetLogFilename() string GetMaxLogFileSize() uint GetMaxLogBackups() uint GetMaxAgeForALogFile() uint IsCompressionEnabledOnLogBackups() bool }
LogConfig represents the interface for log related configuration
type RelationalDatabaseConfig ¶
type RelationalDatabaseConfig interface { GetDBDialect() DBDialect GetDBConnectionURL() string GetDBConnectionMaxIdleTime() time.Duration GetDBConnectionMaxLifetime() time.Duration GetMaxIdleDBConnections() uint16 GetMaxOpenDBConnections() uint16 }
RelationalDatabaseConfig represents DB configuration related behaviors
type SeedChannel ¶
type SeedChannel SeedProducer
SeedChannel represents pre configured channel via configuration
type SeedConsumer ¶
type SeedConsumer struct { SeedProducer // CallbackURL represents the URl to call back CallbackURL *url.URL // Channels represents which channel this consumer listens to Channel string }
SeedConsumer represents pre configured consumer via configuration
type SeedData ¶
type SeedData struct { DataHash string Producers []SeedProducer Channels []SeedChannel Consumers []SeedConsumer }
SeedData represents data specified in configuration to ensure is present when app starts up
type SeedDataConfig ¶
type SeedDataConfig interface {
GetSeedData() SeedData
}
SeedDataConfig provides the interface for working with SeedData in configuration
type SeedProducer ¶
type SeedProducer struct { // ID is the ID of the data ID string // Name is name of the data Name string // Token is the pre configured token of the data Token string }
SeedProducer represents the pre configured producer via configuration