-
Notifications
You must be signed in to change notification settings - Fork 1
/
args_queue.go
152 lines (129 loc) · 3.02 KB
/
args_queue.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package rabbitmqclient
import (
"github.com/streadway/amqp"
)
// QueueDeclare specifies the arguments to declare queue.
type QueueDeclare struct {
Name string
Durable bool
AutoDelete bool
Exclusive bool
NoWait bool
Args amqp.Table
}
// SetName is a setter.
func (q *QueueDeclare) SetName(name string) *QueueDeclare {
q.Name = name
return q
}
// SetDurable is a setter.
func (q *QueueDeclare) SetDurable(durable bool) *QueueDeclare {
q.Durable = durable
return q
}
// SetAutoDelete is a setter.
func (q *QueueDeclare) SetAutoDelete(delete bool) *QueueDeclare {
q.AutoDelete = delete
return q
}
// SetExclusive is a setter.
func (q *QueueDeclare) SetExclusive(exclusive bool) *QueueDeclare {
q.Exclusive = exclusive
return q
}
// SetNoWait is a setter.
func (q *QueueDeclare) SetNoWait(noWait bool) *QueueDeclare {
q.NoWait = noWait
return q
}
// SetArgs is a setter.
func (q *QueueDeclare) SetArgs(args amqp.Table) *QueueDeclare {
q.Args = args
return q
}
// Default sets the default values of the struct variables.
func (q *QueueDeclare) Default() *QueueDeclare {
q.Name = DefaultQueue
q.Durable = true
q.AutoDelete = false
q.Exclusive = false
q.NoWait = false
q.Args = amqp.Table{}
return q
}
// QueueDeclarePassive declares the queue if it isn't already declared
type QueueDeclarePassive struct {
QueueDeclare
}
// QueueBind specifies the arguments to declare binding of queue to exchange.
type QueueBind struct {
Name string
Key string
Exchange string
NoWait bool
Args amqp.Table
}
// SetName is a setter.
func (q *QueueBind) SetName(name string) *QueueBind {
q.Name = name
return q
}
// SetKey is a setter.
func (q *QueueBind) SetKey(key string) *QueueBind {
q.Key = key
return q
}
// SetExchange is a setter.
func (q *QueueBind) SetExchange(name string) *QueueBind {
q.Exchange = name
return q
}
// SetNoWait is a setter.
func (q *QueueBind) SetNoWait(noWait bool) *QueueBind {
q.NoWait = noWait
return q
}
// SetArgs is a setter.
func (q *QueueBind) SetArgs(args amqp.Table) *QueueBind {
q.Args = args
return q
}
// Default sets the default values of the struct variables.
func (q *QueueBind) Default() *QueueBind {
q.Name = DefaultQueue
q.Key = DefaultTopic
q.Exchange = DefaultExchange
q.NoWait = false
return q
}
// QueueUnbind removes the bindings of the queue to an exchange.
type QueueUnbind struct {
QueueBind
}
// QueueDelete deletes deletes the bindings, purges the queue, and remove it from the server.
type QueueDelete struct {
Name string
IfUnused bool
IfEmpty bool
NoWait bool
}
// SetName is a setter.
func (q *QueueDelete) SetName(name string) *QueueDelete {
q.Name = name
return q
}
// SetIfUnused is a setter.
func (q *QueueDelete) SetIfUnused(ifUnused bool) *QueueDelete {
q.IfUnused = ifUnused
return q
}
// SetIfEmpty is a setter.
func (q *QueueDelete) SetIfEmpty(ifEmpty bool) *QueueDelete {
q.IfEmpty = ifEmpty
return q
}
// SetNoWait is a setter.
func (q *QueueDelete) SetNoWait(noWait bool) *QueueDelete {
q.NoWait = noWait
return q
}