-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigs.go
66 lines (53 loc) · 1.33 KB
/
configs.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
56
57
58
59
60
61
62
63
64
65
66
package rcgo
import "time"
type ListenerConfigs struct {
Url string
// The server will deliver that many
// messages to consumers before
// acknowledgments are received.
// 0 means no limit.
PrefetchCount int
// Number of cmds workers to spawn
CmdsWorkers int
// Number of events workers to spawn
EventsWorkers int
// Number of queries workers to spawn
QueriesWorkers int
// Acknowledge the server as if
// the message was successfully
// processed.
AckIfNoHandlers bool
// Time to delay when rejecting
// messages to the server.
DelayOnReject time.Duration
// Timezone to be used on the listener and the logger.
Timezone *time.Location
// Zerolog valid level. From `trace` to `panic`.
// To disable `disabled`
LogLevel string
}
func NewListenerDefaultConfigs(url string) *ListenerConfigs {
return &ListenerConfigs{
Url: url,
AckIfNoHandlers: true,
DelayOnReject: 5 * time.Second,
Timezone: time.UTC,
LogLevel: "info",
CmdsWorkers: 5,
EventsWorkers: 5,
QueriesWorkers: 5,
PrefetchCount: 15,
}
}
type PublisherConfigs struct {
Url string
ReplyTimeout time.Duration
PrefetchCount int
}
func NewPublisherDefaultConfigs(url string) *PublisherConfigs {
return &PublisherConfigs{
Url: url,
ReplyTimeout: 15 * time.Second,
PrefetchCount: 15,
}
}