Documentation ¶
Index ¶
- Constants
- Variables
- func ConstantBackOff(_ int) time.Duration
- func ExponentialBackoff(i int) time.Duration
- func LinearBackoff(i int) time.Duration
- type BackoffStrategy
- type CircuitBreakerConfig
- type Config
- type EnqueueStomp
- type EnqueueStompImpl
- func (emq *EnqueueStompImpl) CheckQueue(queueName string) error
- func (emq *EnqueueStompImpl) CheckTopic(topicName string) error
- func (emq *EnqueueStompImpl) Config() Config
- func (emq *EnqueueStompImpl) ConfigureCircuitBreaker(name string, cb CircuitBreakerConfig)
- func (emq *EnqueueStompImpl) Disconnect() error
- func (emq *EnqueueStompImpl) QueueSize() int
- func (emq *EnqueueStompImpl) SendQueue(queueName string, body []byte, sc SendConfig) error
- func (emq *EnqueueStompImpl) SendTopic(topicName string, body []byte, sc SendConfig) error
- type LogField
- type LogFieldImpl
- type Logger
- type NoopLogger
- type SendConfig
Constants ¶
View Source
const ( DefaultRetriesConnect = 3 DefaultMaxRetriesConnect = 5 )
View Source
const ( DestinationTypeQueue = "queue" DestinationTypeTopic = "topic" )
View Source
const DefaultInitialBackOff = 100 * time.Millisecond
Variables ¶
Functions ¶
func ConstantBackOff ¶
ConstantBackOff always returns DefaultInitialBackOff.
func ExponentialBackoff ¶
ExponentialBackoff returns ever increasing backoffs by a power of 2.
func LinearBackoff ¶
LinearBackoff returns increasing durations.
Types ¶
type BackoffStrategy ¶
BackoffStrategy is used to determine how long a retry request should wait until attempted.
type CircuitBreakerConfig ¶
type CircuitBreakerConfig struct { // how long to wait for command to complete, in milliseconds // Default is 10000 Timeout int // how many commands of the same type can run at the same time // Default is 10000 MaxConcurrentRequests int // the minimum number of requests needed before a circuit can be tripped due to health // Default is 100 RequestVolumeThreshold int // how long, in milliseconds, to wait after a circuit opens before testing for recovery // Default is 500 SleepWindow int // causes circuits to open once the rolling measure of errors exceeds this percent of requests // Default is 5 ErrorPercentThreshold int }
type Config ¶
type Config struct { // Default is tcp Network string // host:port address // Default is localhost:61613 Addr string // https://pkg.go.dev/github.com/go-stomp/stomp Options []func(*stomp.Conn) error // The maxWorkers parameter specifies the maximum number of workers that can // execute tasks concurrently. When there are no incoming tasks, workers are // gradually stopped until there are no remaining workers. // Default is runtime.NumCPU() MaxWorkers int // Default is 3, Max is 5 RetriesConnect int // Used to determine how long a retry request should wait until attempted. // Default is ExponentialBackoff BackoffConnect BackoffStrategy // File path to write logging output to WriteOutputPath string // Logger that will be used // Default is nothing Logger Logger // create unique identifier // Default google/uuid IdentifierFunc func() string }
type EnqueueStomp ¶
type EnqueueStomp interface { SendQueue(queueName string, body []byte, sc SendConfig) error SendTopic(topicName string, body []byte, sc SendConfig) error QueueSize() int Config() Config CheckQueue(queueName string) error CheckTopic(topicName string) error Disconnect() error ConfigureCircuitBreaker(name string, cb CircuitBreakerConfig) }
func NewEnqueueStomp ¶
func NewEnqueueStomp(config Config) (EnqueueStomp, error)
type EnqueueStompImpl ¶
type EnqueueStompImpl struct {
// contains filtered or unexported fields
}
func (*EnqueueStompImpl) CheckQueue ¶
func (emq *EnqueueStompImpl) CheckQueue(queueName string) error
func (*EnqueueStompImpl) CheckTopic ¶
func (emq *EnqueueStompImpl) CheckTopic(topicName string) error
func (*EnqueueStompImpl) Config ¶
func (emq *EnqueueStompImpl) Config() Config
func (*EnqueueStompImpl) ConfigureCircuitBreaker ¶
func (emq *EnqueueStompImpl) ConfigureCircuitBreaker(name string, cb CircuitBreakerConfig)
func (*EnqueueStompImpl) Disconnect ¶
func (emq *EnqueueStompImpl) Disconnect() error
func (*EnqueueStompImpl) QueueSize ¶
func (emq *EnqueueStompImpl) QueueSize() int
func (*EnqueueStompImpl) SendQueue ¶
func (emq *EnqueueStompImpl) SendQueue(queueName string, body []byte, sc SendConfig) error
SendQueue The body array contains the message body, and its content should be consistent with the specified content type.
func (*EnqueueStompImpl) SendTopic ¶
func (emq *EnqueueStompImpl) SendTopic(topicName string, body []byte, sc SendConfig) error
SendTopic The body array contains the message body, and its content should be consistent with the specified content type.
type LogFieldImpl ¶
type LogFieldImpl struct {
// contains filtered or unexported fields
}
type NoopLogger ¶
type NoopLogger struct{}
NoopLogger does not log anything.
func (NoopLogger) Debugf ¶
func (l NoopLogger) Debugf(template string, args ...interface{})
Debugf does nothing.
func (NoopLogger) Errorf ¶
func (l NoopLogger) Errorf(template string, args ...interface{})
Errorf does nothing.
type SendConfig ¶
type SendConfig struct { // The content type should be specified, according to the STOMP specification, but if contentType is an empty // string, the message will be delivered without a content-type header entry. // Default is text/plain. ContentType string // Any number of options can be specified in opts. See the examples for usage. Options include whether // to receive a RECEIPT, should the content-length be suppressed, and sending custom header entries. // https://pkg.go.dev/github.com/go-stomp/stomp/frame Options []func(*frame.Frame) error BeforeSend func(identifier string, destinationType string, destinationName string, body []byte, startTime time.Time) AfterSend func(identifier string, destinationType string, destinationName string, body []byte, startTime time.Time, err error) // the name of the CircuitBreaker. // Default is empty CircuitName string // contains filtered or unexported fields }
func (*SendConfig) AddLogField ¶
func (sc *SendConfig) AddLogField(key, value string)
func (*SendConfig) SetOptions ¶
func (sc *SendConfig) SetOptions(opts ...func(*frame.Frame) error)
Click to show internal directories.
Click to hide internal directories.