You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

31 lines
946 B

package rabbitmq
import "time"
// ConnectionOptions are used to describe how a new consumer will be created.
type ConnectionOptions struct {
ReconnectInterval time.Duration
Config Config
}
// getDefaultConnectionOptions describes the options that will be used when a value isn't provided
func getDefaultConnectionOptions() ConnectionOptions {
return ConnectionOptions{
ReconnectInterval: time.Second * 5,
Config: Config{},
}
}
// WithConnectionOptionsReconnectInterval sets the reconnection interval
func WithConnectionOptionsReconnectInterval(interval time.Duration) func(options *ConnectionOptions) {
return func(options *ConnectionOptions) {
options.ReconnectInterval = interval
}
}
// WithConnectionOptionsConfig sets the Config used in the connection
func WithConnectionOptionsConfig(cfg Config) func(options *ConnectionOptions) {
return func(options *ConnectionOptions) {
options.Config = cfg
}
}