-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
55 lines (49 loc) · 1.49 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package amqper
import (
"time"
"github.com/rb-pkg/amqp"
)
const (
defaultAsyncPoolSize = 1
)
// Configuration is basic configuration for worker
type Configuration struct {
AsyncWorker bool
AsyncPoolSize int32
ConnectionString string
ConnectionConfig amqp.Config
ExchangeName string
QueueName string
ConsumerName string
QueueDurable bool
QueueArguments map[string]interface{}
QueueAutoDelete bool
QueueExclusive bool
QueueNoWait bool
QueueAutoACK bool
PrefetchCount int
UseDelayedQueue bool
DelayedQueueArguments map[string]interface{}
DefaultRetryCount int32
DefaultRetryDelay time.Duration
}
// RunnableConsumer interface for processing function
type RunnableConsumer interface {
ProcessQueueTask(amqpMSG *amqp.Delivery) (retryCnt int32, retryDelay time.Duration, err error)
}
// Worker basic client
type Worker struct {
config *Configuration
amqpConnection *amqp.Connection
amqpChannel *amqp.Channel
amqpQueue amqp.Queue
amqpQueueDelayed amqp.Queue
amqpQueueDelayedName string
amqpMessages <-chan amqp.Delivery
amqpNotifyCloseConnection chan *amqp.Error
shutdownCh chan bool
errorCh chan error
amqpMessagesPoolCh chan *amqp.Delivery
runnerForProcessor func(*amqp.Delivery)
processorStorage RunnableConsumer
}