1 | <?php |
||
16 | class Qos |
||
17 | { |
||
18 | /** |
||
19 | * CAUTION: Looks like phpamqplib did not implement this feature! |
||
20 | * @var int prefetch size in bytes |
||
21 | */ |
||
22 | private $prefetchSize = 0; |
||
23 | |||
24 | /** |
||
25 | * @var int prefetch count in items |
||
26 | */ |
||
27 | private $prefetchCount = 0; |
||
28 | |||
29 | /** |
||
30 | * @var bool if for true this setting is channel-wide |
||
31 | */ |
||
32 | private $global = false; |
||
33 | |||
34 | /** |
||
35 | * Simple fluent constructor to avoid weird-looking constructions like |
||
36 | * |
||
37 | * ```php |
||
38 | * $qos = (new Qos())->count(10); |
||
39 | * ``` |
||
40 | * |
||
41 | * @return Qos |
||
42 | */ |
||
43 | public static function factory() |
||
47 | |||
48 | /** |
||
49 | * Sets `prefetch_size` qos parameter for channel or consumer |
||
50 | * |
||
51 | * CAUTION: Looks like phpamqplib did not implement this feature! |
||
52 | * |
||
53 | * @see https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos.prefetch-size |
||
54 | * @default 0 disables limit |
||
55 | * @param int $value prefetch size in bytes |
||
56 | * @return $this |
||
57 | */ |
||
58 | public function size($value) |
||
63 | |||
64 | /** |
||
65 | * Sets `prefetch_count` qos parameter for channel or consumer |
||
66 | * |
||
67 | * @see https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos.prefetch-count |
||
68 | * @default 0 disables limit |
||
69 | * @param int $value prefetch size in items |
||
70 | * @return $this |
||
71 | */ |
||
72 | public function count($value) |
||
77 | |||
78 | /** |
||
79 | * Sets `global` qos parameter. |
||
80 | * This parameter defines if those settings should be used for all channel or only for current Consumer. |
||
81 | * By default settings are consumer-wide. |
||
82 | * |
||
83 | * @see https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.qos.global |
||
84 | * @default false |
||
85 | * @param boolean $value |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function isGlobal($value) |
||
93 | |||
94 | /** |
||
95 | * Returns all parameters in same order as they are used in PhpAmqpLib\Channel\AMQPChannel::basic_qos() |
||
96 | * |
||
97 | * @see \PhpAmqpLib\Channel\AMQPChannel::basic_qos() |
||
98 | * @return array |
||
99 | */ |
||
100 | public function listParams() |
||
104 | } |
||
105 |