-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
options.go
55 lines (46 loc) · 1.33 KB
/
options.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 outboxer
import "time"
// Option represents the outboxer options.
type Option func(*Outboxer)
// WithDataStore sets the data store where events will be stored before sending.
func WithDataStore(ds DataStore) Option {
return func(o *Outboxer) {
o.ds = ds
}
}
// WithEventStream sets the event stream to where events will be sent.
func WithEventStream(es EventStream) Option {
return func(o *Outboxer) {
o.es = es
}
}
// WithCheckInterval sets the frequency that outboxer will check for new events.
func WithCheckInterval(t time.Duration) Option {
return func(o *Outboxer) {
o.checkInterval = t
}
}
// WithCleanupInterval sets the frequency that outboxer will clean old events from the data store.
func WithCleanupInterval(t time.Duration) Option {
return func(o *Outboxer) {
o.cleanUpInterval = t
}
}
// WithCleanUpBefore sets the date that the clean up process should start removing from.
func WithCleanUpBefore(t time.Time) Option {
return func(o *Outboxer) {
o.cleanUpBefore = t
}
}
// WithCleanUpBatchSize sets the clean up process batch size.
func WithCleanUpBatchSize(s int32) Option {
return func(o *Outboxer) {
o.cleanUpBatchSize = s
}
}
// WithMessageBatchSize sets how many messages will be sent at a time.
func WithMessageBatchSize(s int32) Option {
return func(o *Outboxer) {
o.messageBatchSize = s
}
}