|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* AppserverIo\Messaging\MessageMonitor |
|
5
|
|
|
* |
|
6
|
|
|
* NOTICE OF LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
|
9
|
|
|
* that is available through the world-wide-web at this URL: |
|
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
|
11
|
|
|
* |
|
12
|
|
|
* PHP version 5 |
|
13
|
|
|
* |
|
14
|
|
|
* @author Tim Wagner <[email protected]> |
|
15
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
|
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
17
|
|
|
* @link https://github.com/appserver-io/messaging |
|
18
|
|
|
* @link http://www.appserver.io |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AppserverIo\Messaging; |
|
22
|
|
|
|
|
23
|
|
|
use AppserverIo\Psr\Pms\MonitorInterface; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* A message monitor implementation. |
|
27
|
|
|
* |
|
28
|
|
|
* @author Tim Wagner <[email protected]> |
|
29
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
|
30
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
31
|
|
|
* @link https://github.com/appserver-io/messaging |
|
32
|
|
|
* @link http://www.appserver.io |
|
33
|
|
|
*/ |
|
34
|
|
|
class MessageMonitor implements MonitorInterface |
|
35
|
|
|
{ |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* The target counter for monitoring the message. |
|
39
|
|
|
* |
|
40
|
|
|
* @var integer |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $target = 0; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* The row counter for monitoring the message. |
|
46
|
|
|
* |
|
47
|
|
|
* @var integer |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $rowCount = 0; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* The log message for monitoring the message. |
|
53
|
|
|
* |
|
54
|
|
|
* @var string |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $logMessage = ''; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Initializes the queue with the name to use. |
|
60
|
|
|
* |
|
61
|
|
|
* @param int $target The target |
|
62
|
|
|
* @param string $logMessage Holds the queue name to use |
|
63
|
|
|
*/ |
|
64
|
|
|
public function __construct($target, $logMessage) |
|
65
|
|
|
{ |
|
66
|
|
|
$this->target = $target; |
|
67
|
|
|
$this->logMessage = $logMessage; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Sets the log message. |
|
72
|
|
|
* |
|
73
|
|
|
* @param string $logMessage The log message |
|
74
|
|
|
* |
|
75
|
|
|
* @return void |
|
76
|
|
|
*/ |
|
77
|
|
|
public function setLogMessage($logMessage) |
|
78
|
|
|
{ |
|
79
|
|
|
$this->logMessage = $logMessage; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Returns the row counter. |
|
84
|
|
|
* |
|
85
|
|
|
* @param integer $rowCount The row counter |
|
86
|
|
|
* |
|
87
|
|
|
* @return void |
|
88
|
|
|
*/ |
|
89
|
|
|
public function setRowCount($rowCount) |
|
90
|
|
|
{ |
|
91
|
|
|
$this->rowCount = $rowCount; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Returns the log message. |
|
96
|
|
|
* |
|
97
|
|
|
* @return string The log message |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getLogMessage() |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->logMessage; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* Returns the row counter. |
|
106
|
|
|
* |
|
107
|
|
|
* @return integer The row counter |
|
108
|
|
|
*/ |
|
109
|
|
|
public function getRowCount() |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->rowCount; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Returns the target counter. |
|
116
|
|
|
* |
|
117
|
|
|
* @return integer The target counter |
|
118
|
|
|
*/ |
|
119
|
|
|
public function getTarget() |
|
120
|
|
|
{ |
|
121
|
|
|
return $this->target; |
|
122
|
|
|
} |
|
123
|
|
|
} |
|
124
|
|
|
|