-
Notifications
You must be signed in to change notification settings - Fork 1
/
args_exchange.go
143 lines (121 loc) · 3.01 KB
/
args_exchange.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
package rabbitmqclient
import (
"github.com/streadway/amqp"
)
// ExchangeDeclare specifies the arguments to used in declaring exchange.
type ExchangeDeclare struct {
Name string
Kind string
Durable bool
AutoDelete bool
Internal bool
NoWait bool
Args amqp.Table
}
// SetName is a setter.
func (e *ExchangeDeclare) SetName(name string) *ExchangeDeclare {
e.Name = name
return e
}
// SetKind is a setter.
func (e *ExchangeDeclare) SetKind(kind string) *ExchangeDeclare {
e.Kind = kind
return e
}
// SetDurable is a setter.
func (e *ExchangeDeclare) SetDurable(durable bool) *ExchangeDeclare {
e.Durable = durable
return e
}
// SetAutoDelete is a setter.
func (e *ExchangeDeclare) SetAutoDelete(autoDelete bool) *ExchangeDeclare {
e.AutoDelete = autoDelete
return e
}
// SetInternal is a setter.
func (e *ExchangeDeclare) SetInternal(internal bool) *ExchangeDeclare {
e.Internal = internal
return e
}
// SetNoWait is a setter.
func (e *ExchangeDeclare) SetNoWait(noWait bool) *ExchangeDeclare {
e.NoWait = noWait
return e
}
// SetArgs is a setter.
func (e *ExchangeDeclare) SetArgs(args amqp.Table) *ExchangeDeclare {
e.Args = args
return e
}
// Default sets the default values of the struct variables.
func (e *ExchangeDeclare) Default() *ExchangeDeclare {
e.Name = DefaultExchange
e.Kind = TypeDirect
e.Durable = true
e.AutoDelete = true
e.Internal = false
e.NoWait = false
return e
}
// ExchangeDeclarePassive declares an exchange as passive to assumes that the exchange is already exist.
type ExchangeDeclarePassive struct {
ExchangeDeclare
}
// ExchangeBind specifies the argumenst to bind an exchange to other exchange.
type ExchangeBind struct {
Destination string
Key string
Source string
NoWait bool
Args amqp.Table
}
// SetDestination is a setter.
func (e *ExchangeBind) SetDestination(destination string) *ExchangeBind {
e.Destination = destination
return e
}
// SetKey is a setter.
func (e *ExchangeBind) SetKey(key string) *ExchangeBind {
e.Key = key
return e
}
// SetSource is a setter.
func (e *ExchangeBind) SetSource(source string) *ExchangeBind {
e.Source = source
return e
}
// SetNoWait is a setter.
func (e *ExchangeBind) SetNoWait(noWait bool) *ExchangeBind {
e.NoWait = noWait
return e
}
// SetArgs is a setter.
func (e *ExchangeBind) SetArgs(args amqp.Table) *ExchangeBind {
e.Args = args
return e
}
// ExchangeUnbind unbinds the exchange using the same argument as the exchange bind.
type ExchangeUnbind struct {
ExchangeBind
}
// ExchangeDelete deletes the exchange when it is already declared.
type ExchangeDelete struct {
Name string
IfUnused bool
NoWait bool
}
// SetName is a setter.
func (e *ExchangeDelete) SetName(name string) *ExchangeDelete {
e.Name = name
return e
}
// SetIfUnused is a setter.
func (e *ExchangeDelete) SetIfUnused(ifUnused bool) *ExchangeDelete {
e.IfUnused = ifUnused
return e
}
// SetNoWait is a setter.
func (e *ExchangeDelete) SetNoWait(noWait bool) *ExchangeDelete {
e.NoWait = noWait
return e
}