1 | <?php |
||
42 | abstract class AbstractMessage implements MessageInterface, \Serializable |
||
43 | { |
||
44 | |||
45 | /** |
||
46 | * The unique session-ID. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $sessionId = null; |
||
51 | |||
52 | /** |
||
53 | * The destination queue to send the message to. |
||
54 | * |
||
55 | * @var \AppserverIo\Psr\Pms\QueueInterface |
||
56 | */ |
||
57 | protected $destination = null; |
||
58 | |||
59 | /** |
||
60 | * The parent message. |
||
61 | * |
||
62 | * @var \AppserverIo\Psr\Pms\MessageInterface |
||
63 | */ |
||
64 | protected $parentMessage = null; |
||
65 | |||
66 | /** |
||
67 | * The monitor for monitoring the message. |
||
68 | * |
||
69 | * @var \AppserverIo\Psr\Pms\MonitorInterface |
||
70 | */ |
||
71 | protected $messageMonitor = null; |
||
72 | |||
73 | /** |
||
74 | * The priority of the message, defaults to 'low'. |
||
75 | * |
||
76 | * @var integer |
||
77 | */ |
||
78 | protected $priority = null; |
||
79 | |||
80 | /** |
||
81 | * The state of the message, defaults to 'active'. |
||
82 | * |
||
83 | * @var integer |
||
84 | */ |
||
85 | protected $state = null; |
||
86 | |||
87 | /** |
||
88 | * The flag if the message should be deleted when finished or not. |
||
89 | * |
||
90 | * @var boolean |
||
91 | */ |
||
92 | protected $locked = null; |
||
93 | |||
94 | /** |
||
95 | * Initializes the message with the array |
||
96 | * to send to the queue. |
||
97 | */ |
||
98 | 1 | public function __construct() |
|
106 | |||
107 | /** |
||
108 | * Sets the unique session id. |
||
109 | * |
||
110 | * @param string $sessionId The uniquid id |
||
111 | * |
||
112 | * @return void |
||
113 | */ |
||
114 | public function setSessionId($sessionId) |
||
118 | |||
119 | /** |
||
120 | * Returns the unique session id. |
||
121 | * |
||
122 | * @return string The uniquid id |
||
123 | */ |
||
124 | public function getSessionId() |
||
128 | |||
129 | /** |
||
130 | * Sets the destination queue. |
||
131 | * |
||
132 | * @param \AppserverIo\Psr\Pms\QueueInterface $destination The destination queue |
||
133 | * |
||
134 | * @return void |
||
135 | */ |
||
136 | public function setDestination(QueueInterface $destination) |
||
140 | |||
141 | /** |
||
142 | * Returns the destination queue. |
||
143 | * |
||
144 | * @return \AppserverIo\Psr\Pms\QueueInterface The destination queue |
||
145 | */ |
||
146 | public function getDestination() |
||
150 | |||
151 | /** |
||
152 | * Sets the priority of the message. |
||
153 | * |
||
154 | * @param \AppserverIo\Psr\Pms\PriorityKeyInterface $priority The priority to set the message to |
||
155 | * |
||
156 | * @return void |
||
157 | */ |
||
158 | public function setPriority(PriorityKeyInterface $priority) |
||
162 | |||
163 | /** |
||
164 | * Returns the priority of the message. |
||
165 | * |
||
166 | * @return \AppserverIo\Psr\Pms\PriorityKeyInterface The priority of the message |
||
167 | */ |
||
168 | public function getPriority() |
||
172 | |||
173 | /** |
||
174 | * Sets the state of the message. |
||
175 | * |
||
176 | * @param \AppserverIo\Psr\Pms\StateKeyInterface $state The new state |
||
177 | * |
||
178 | * @return void |
||
179 | */ |
||
180 | public function setState(StateKeyInterface $state) |
||
184 | |||
185 | /** |
||
186 | * Returns the state of the message. |
||
187 | * |
||
188 | * @return \AppserverIo\Psr\Pms\StateKeyInterface The message state |
||
189 | */ |
||
190 | public function getState() |
||
194 | |||
195 | /** |
||
196 | * Sets the parent message. |
||
197 | * |
||
198 | * @param \AppserverIo\Psr\Pms\MessageInterface $parentMessage The parent message |
||
199 | * |
||
200 | * @return void |
||
201 | */ |
||
202 | public function setParentMessage(MessageInterface $parentMessage) |
||
206 | |||
207 | /** |
||
208 | * Returns the parent message. |
||
209 | * |
||
210 | * @return \AppserverIo\Psr\Pms\MessageInterface The parent message |
||
211 | * |
||
212 | * @see \AppserverIo\Psr\Pms\MessageInterface::getParentMessage() |
||
213 | */ |
||
214 | public function getParentMessage() |
||
218 | |||
219 | /** |
||
220 | * Sets the monitor for monitoring the message itself. |
||
221 | * |
||
222 | * @param \AppserverIo\Psr\Pms\MonitorInterface $messageMonitor The monitor |
||
223 | * |
||
224 | * @return void |
||
225 | */ |
||
226 | public function setMessageMonitor(MonitorInterface $messageMonitor) |
||
230 | |||
231 | /** |
||
232 | * Returns the message monitor. |
||
233 | * |
||
234 | * @return \AppserverIo\Psr\Pms\MonitorInterface The monitor |
||
235 | */ |
||
236 | public function getMessageMonitor() |
||
240 | |||
241 | /** |
||
242 | * Locks the message. |
||
243 | * |
||
244 | * @return void |
||
245 | */ |
||
246 | public function lock() |
||
250 | |||
251 | /** |
||
252 | * Unlocks the message. |
||
253 | * |
||
254 | * @return void |
||
255 | */ |
||
256 | public function unlock() |
||
260 | |||
261 | /** |
||
262 | * Returns the message lock flag. |
||
263 | * |
||
264 | * @return boolean TRUE if the message is locked, else FALSE |
||
265 | */ |
||
266 | public function isLocked() |
||
270 | |||
271 | /** |
||
272 | * Serializes the message and returns the serialized representation. |
||
273 | * |
||
274 | * @return string the string representation of the object or null |
||
275 | * @link http://php.net/manual/en/serializable.serialize.php |
||
276 | */ |
||
277 | 1 | public function serialize() |
|
281 | |||
282 | /** |
||
283 | * The serialized representation of the message. |
||
284 | * |
||
285 | * @param string $data The string representation of the object |
||
286 | * |
||
287 | * @return void |
||
288 | * @link http://php.net/manual/en/serializable.unserialize.php |
||
289 | */ |
||
290 | 1 | public function unserialize($data) |
|
296 | } |
||
297 |