1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AMQPAL\Adapter\PhpAmqpLib\Options; |
4
|
|
|
|
5
|
|
|
use AMQPAL\AbstractOptions; |
6
|
|
|
use AMQPAL\Adapter\PhpAmqpLib\Factory; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class ConnectionOptions |
10
|
|
|
* |
11
|
|
|
* @package AMQPAL\Adapter\PhpAmqpLib\Options |
12
|
|
|
*/ |
13
|
|
|
class ConnectionOptions extends AbstractOptions |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
protected $type = 'lazy'; |
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $host = 'localhost'; |
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
protected $port = 5672; |
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
protected $username; |
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $password; |
35
|
|
|
/** |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
protected $vhost = '/'; |
39
|
|
|
/** |
40
|
|
|
* @var bool |
41
|
|
|
*/ |
42
|
|
|
protected $insist = false; |
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $loginMethod = 'AMQPLAIN'; |
47
|
|
|
/** |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
protected $locale = 'en_US'; |
51
|
|
|
/** |
52
|
|
|
* @var int |
53
|
|
|
*/ |
54
|
|
|
protected $readWriteTimeout = 0; |
55
|
|
|
/** |
56
|
|
|
* @var bool |
57
|
|
|
*/ |
58
|
|
|
protected $keepAlive = false; |
59
|
|
|
/** |
60
|
|
|
* @var int |
61
|
|
|
*/ |
62
|
|
|
protected $connectionTimeout = 3; |
63
|
|
|
/** |
64
|
|
|
* @var int |
65
|
|
|
*/ |
66
|
|
|
protected $heartbeat = 0; |
67
|
|
|
/** |
68
|
|
|
* @var array |
69
|
|
|
*/ |
70
|
|
|
protected $sslOptions = []; |
71
|
|
|
/** |
72
|
|
|
* @var Factory\ConnectionFactoryFactory |
73
|
|
|
*/ |
74
|
|
|
protected $connectionFactoryFactory; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
9 |
|
public function getType() |
80
|
|
|
{ |
81
|
9 |
|
return $this->type; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param string $type |
86
|
|
|
* @return $this |
87
|
|
|
*/ |
88
|
2 |
|
public function setType($type) |
89
|
|
|
{ |
90
|
2 |
|
$this->type = $type; |
91
|
2 |
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return string |
96
|
|
|
*/ |
97
|
8 |
|
public function getHost() |
98
|
|
|
{ |
99
|
8 |
|
return $this->host; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param string $host |
104
|
|
|
* @return $this |
105
|
|
|
*/ |
106
|
8 |
|
public function setHost($host) |
107
|
|
|
{ |
108
|
8 |
|
$this->host = $host; |
109
|
8 |
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
8 |
|
public function getPort() |
116
|
|
|
{ |
117
|
8 |
|
return $this->port; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param string $port |
122
|
|
|
* @return $this |
123
|
|
|
*/ |
124
|
8 |
|
public function setPort($port) |
125
|
|
|
{ |
126
|
8 |
|
$this->port = $port; |
127
|
8 |
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
8 |
|
public function getUsername() |
134
|
|
|
{ |
135
|
8 |
|
return $this->username; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @param string $username |
140
|
|
|
* @return $this |
141
|
|
|
*/ |
142
|
8 |
|
public function setUsername($username) |
143
|
|
|
{ |
144
|
8 |
|
$this->username = $username; |
145
|
8 |
|
return $this; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return string |
150
|
|
|
*/ |
151
|
8 |
|
public function getPassword() |
152
|
|
|
{ |
153
|
8 |
|
return $this->password; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param string $password |
158
|
|
|
* @return $this |
159
|
|
|
*/ |
160
|
8 |
|
public function setPassword($password) |
161
|
|
|
{ |
162
|
8 |
|
$this->password = $password; |
163
|
8 |
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return string |
168
|
|
|
*/ |
169
|
8 |
|
public function getVhost() |
170
|
|
|
{ |
171
|
8 |
|
return $this->vhost; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @param string $vhost |
176
|
|
|
* @return $this |
177
|
|
|
*/ |
178
|
8 |
|
public function setVhost($vhost) |
179
|
|
|
{ |
180
|
8 |
|
$this->vhost = $vhost; |
181
|
8 |
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @return boolean |
186
|
|
|
*/ |
187
|
8 |
|
public function isInsist() |
188
|
|
|
{ |
189
|
8 |
|
return $this->insist; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @param boolean $insist |
194
|
|
|
* @return $this |
195
|
|
|
*/ |
196
|
1 |
|
public function setInsist($insist) |
197
|
|
|
{ |
198
|
1 |
|
$this->insist = $insist; |
199
|
1 |
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @return string |
204
|
|
|
*/ |
205
|
8 |
|
public function getLoginMethod() |
206
|
|
|
{ |
207
|
8 |
|
return $this->loginMethod; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* @param string $loginMethod |
212
|
|
|
* @return $this |
213
|
|
|
*/ |
214
|
1 |
|
public function setLoginMethod($loginMethod) |
215
|
|
|
{ |
216
|
1 |
|
$this->loginMethod = $loginMethod; |
217
|
1 |
|
return $this; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* @return string |
222
|
|
|
*/ |
223
|
8 |
|
public function getLocale() |
224
|
|
|
{ |
225
|
8 |
|
return $this->locale; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* @param string $locale |
230
|
|
|
* @return $this |
231
|
|
|
*/ |
232
|
1 |
|
public function setLocale($locale) |
233
|
|
|
{ |
234
|
1 |
|
$this->locale = $locale; |
235
|
1 |
|
return $this; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* @return int |
240
|
|
|
*/ |
241
|
8 |
|
public function getReadWriteTimeout() |
242
|
|
|
{ |
243
|
8 |
|
return $this->readWriteTimeout; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @param int $readWriteTimeout |
248
|
|
|
* @return $this |
249
|
|
|
*/ |
250
|
1 |
|
public function setReadWriteTimeout($readWriteTimeout) |
251
|
|
|
{ |
252
|
1 |
|
$this->readWriteTimeout = $readWriteTimeout; |
253
|
1 |
|
return $this; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* @return boolean |
258
|
|
|
*/ |
259
|
8 |
|
public function isKeepAlive() |
260
|
|
|
{ |
261
|
8 |
|
return $this->keepAlive; |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
/** |
265
|
|
|
* @param boolean $keepAlive |
266
|
|
|
* @return $this |
267
|
|
|
*/ |
268
|
1 |
|
public function setKeepAlive($keepAlive) |
269
|
|
|
{ |
270
|
1 |
|
$this->keepAlive = $keepAlive; |
271
|
1 |
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* @return int |
276
|
|
|
*/ |
277
|
8 |
|
public function getConnectionTimeout() |
278
|
|
|
{ |
279
|
8 |
|
return $this->connectionTimeout; |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
/** |
283
|
|
|
* @param int $connectionTimeout |
284
|
|
|
* @return $this |
285
|
|
|
*/ |
286
|
1 |
|
public function setConnectionTimeout($connectionTimeout) |
287
|
|
|
{ |
288
|
1 |
|
$this->connectionTimeout = $connectionTimeout; |
289
|
1 |
|
return $this; |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
/** |
293
|
|
|
* @return int |
294
|
|
|
*/ |
295
|
8 |
|
public function getHeartbeat() |
296
|
|
|
{ |
297
|
8 |
|
return $this->heartbeat; |
298
|
|
|
} |
299
|
|
|
|
300
|
|
|
/** |
301
|
|
|
* @param int $heartbeat |
302
|
|
|
* @return $this |
303
|
|
|
*/ |
304
|
1 |
|
public function setHeartbeat($heartbeat) |
305
|
|
|
{ |
306
|
1 |
|
$this->heartbeat = $heartbeat; |
307
|
1 |
|
return $this; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @return array |
312
|
|
|
*/ |
313
|
1 |
|
public function getSslOptions() |
314
|
|
|
{ |
315
|
1 |
|
return $this->sslOptions; |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* @param array $sslOptions |
320
|
|
|
* @return $this |
321
|
|
|
*/ |
322
|
1 |
|
public function setSslOptions(array $sslOptions) |
323
|
|
|
{ |
324
|
1 |
|
$this->sslOptions = $sslOptions; |
325
|
1 |
|
return $this; |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
/** |
329
|
|
|
* @return Factory\ConnectionFactoryFactory |
330
|
|
|
*/ |
331
|
9 |
|
public function getConnectionFactoryFactory() |
332
|
|
|
{ |
333
|
9 |
|
if (!$this->connectionFactoryFactory) { |
334
|
8 |
|
$this->connectionFactoryFactory = new Factory\ConnectionFactoryFactory(); |
335
|
|
|
} |
336
|
9 |
|
return $this->connectionFactoryFactory; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* @param Factory\ConnectionFactoryFactory $connectionFactoryFactory |
341
|
|
|
* @return $this |
342
|
|
|
*/ |
343
|
1 |
|
public function setConnectionFactoryFactory(Factory\ConnectionFactoryFactory $connectionFactoryFactory) |
344
|
|
|
{ |
345
|
1 |
|
$this->connectionFactoryFactory = $connectionFactoryFactory; |
346
|
1 |
|
return $this; |
347
|
|
|
} |
348
|
|
|
} |
349
|
|
|
|