-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoptions.go
More file actions
65 lines (54 loc) · 1.04 KB
/
options.go
File metadata and controls
65 lines (54 loc) · 1.04 KB
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
package amqprpc
import (
"context"
"time"
"github.com/streadway/amqp"
)
type ReplyQueue struct {
Name string
Declare bool
Durable bool
AutoDelete bool
Exclusive bool
NoWait bool
Args amqp.Table
}
type Consumer struct {
Tag string
AutoAck bool
Exclusive bool
NoLocal bool
NoWait bool
Args amqp.Table
}
type Option func(client *Client)
func WithReplyQueue(rq ReplyQueue) Option {
return func(client *Client) {
client.opts.replyQueue = rq
}
}
func WithConsumer(c Consumer) Option {
return func(client *Client) {
client.opts.consumer = c
}
}
func WithPreFetchCount(count int) Option {
return func(client *Client) {
client.opts.preFetchCount = count
}
}
func WithWorkerCount(count int) Option {
return func(client *Client) {
client.opts.workerCount = count
}
}
func WithShutdownPeriod(d time.Duration) Option {
return func(client *Client) {
client.opts.shutdownPeriod = d
}
}
func WithContext(ctx context.Context) Option {
return func(client *Client) {
client.context = ctx
}
}