|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Basic; |
|
4
|
|
|
|
|
5
|
|
|
use PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\ContentPrecursorFrame; |
|
6
|
|
|
use PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\MethodFrame; |
|
7
|
|
|
use PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\OutgoingFrame; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class BasicPublishFrame |
|
11
|
|
|
* @author Aleksey I. Kuleshov YOU GLOBAL LIMITED |
|
12
|
|
|
* @package PHPDaemon\Clients\AMQP\Driver\Protocol\v091\Protocol\Basic |
|
13
|
|
|
*/ |
|
14
|
|
|
class BasicPublishFrame implements MethodFrame, ContentPrecursorFrame, OutgoingFrame |
|
15
|
|
|
{ |
|
16
|
|
|
const METHOD_ID = 0x003c0028; |
|
17
|
|
|
|
|
18
|
|
|
public $frameChannelId = 0; |
|
19
|
|
|
public $reserved1 = 0; // short |
|
20
|
|
|
public $exchange = ''; // shortstr |
|
21
|
|
|
public $routingKey = ''; // shortstr |
|
22
|
|
|
public $mandatory = false; // bit |
|
23
|
|
|
public $immediate = false; // bit |
|
24
|
|
|
|
|
25
|
|
|
public static function create( |
|
26
|
|
|
$exchange = null, $routingKey = null, $mandatory = null, $immediate = null |
|
27
|
|
|
) |
|
28
|
|
|
{ |
|
29
|
|
|
$frame = new self(); |
|
30
|
|
|
|
|
31
|
|
|
if (null !== $exchange) { |
|
32
|
|
|
$frame->exchange = $exchange; |
|
33
|
|
|
} |
|
34
|
|
|
if (null !== $routingKey) { |
|
35
|
|
|
$frame->routingKey = $routingKey; |
|
36
|
|
|
} |
|
37
|
|
|
if (null !== $mandatory) { |
|
38
|
|
|
$frame->mandatory = $mandatory; |
|
39
|
|
|
} |
|
40
|
|
|
if (null !== $immediate) { |
|
41
|
|
|
$frame->immediate = $immediate; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
return $frame; |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|