FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pulsar-client-php/src/MessageOptions.php at main · stonegithubs/pulsar-client-php · GitHub
stonegithubs
pulsar-client-php
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pulsar-client-php
/
src
/
MessageOptions.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
73 lines (58 loc) · 1.35 KB
Breadcrumbs
pulsar-client-php
/
src
/
MessageOptions.php
Copy path
File metadata and controls
73 lines (58 loc) · 1.35 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
/**
* Created by PhpStorm.
* User: Sunny
* Date: 2022/6/30
* Time: 5:57 PM
*/
declare
( strict_types =
1
);
namespace
Pulsar
;
/**
* Class MessageOptions
*
* @package Pulsar
*/
class
MessageOptions
{
/**
* DeliverAfter requests to deliver the message only after the specified relative delay.
* Note: messages are only delivered with delay when a consumer is consuming
* through a `SubscriptionType=Shared` or `SubscriptionType=Key_Shared` subscription. With other subscription
* types, the messages will still be delivered immediately.
*/
const
DELAY_SECONDS
=
'
delay_seconds
'
;
/**
* @var string
* Key sets the key of the message for routing policy
*/
const
KEY
=
'
key
'
;
/**
* @var array
*/
protected
$
data
= [];
/**
* @param array $data
*/
public
function
__construct
(
array
$
data
)
{
$
this
->
data
=
$
data
;
}
/**
* @return string
*/
public
function
getKey
():
string
{
return
(
string
)(
$
this
->
data
[
self
::
KEY
] ??
''
);
}
/**
* @return float|int|null
*/
public
function
getDeliverAtTime
()
{
$
seconds
=
$
this
->
data
[
self
::
DELAY_SECONDS
] ??
null
;
if
(
$
seconds
) {
return
(
int
)( (
time
() +
$
seconds
) *
1000
);
}
return
null
;
}
}
Back
|
FazBrowse Home
|
New Git URL