1 | <?php |
||
32 | class MessageWrapper implements MessageInterface |
||
33 | { |
||
34 | |||
35 | /** |
||
36 | * The message we want to wrap. |
||
37 | * |
||
38 | * @var \AppserverIo\Psr\Pms\MessageInterface |
||
39 | */ |
||
40 | protected $message; |
||
41 | |||
42 | /** |
||
43 | * Injects the message we want to wrap. |
||
44 | * |
||
45 | * @param \AppserverIo\Psr\Pms\MessageInterface $message The message instance |
||
46 | * |
||
47 | * @return void |
||
48 | */ |
||
49 | 1 | public function injectMessage(MessageInterface $message) |
|
53 | |||
54 | /** |
||
55 | * Returns the injected message instance. |
||
56 | * |
||
57 | * @return \AppserverIo\Psr\Pms\MessageInterface The injected message instance |
||
58 | */ |
||
59 | 1 | public function getInjectedMessage() |
|
63 | |||
64 | /** |
||
65 | * Returns the destination queue. |
||
66 | * |
||
67 | * @return \AppserverIo\Psr\Pms\QueueInterface The destination queue |
||
68 | */ |
||
69 | public function getDestination() |
||
73 | |||
74 | /** |
||
75 | * Returns the message id as an |
||
76 | * hash value.. |
||
77 | * |
||
78 | * @return string The message id as hash value |
||
79 | */ |
||
80 | public function getMessageId() |
||
84 | |||
85 | /** |
||
86 | * Returns the message itself. |
||
87 | * |
||
88 | * @return Object The message depending on the type of the Message object |
||
89 | */ |
||
90 | 1 | public function getMessage() |
|
94 | |||
95 | /** |
||
96 | * Sets the unique session id. |
||
97 | * |
||
98 | * @param string $sessionId The uniquid id |
||
99 | * |
||
100 | * @return void |
||
101 | */ |
||
102 | public function setSessionId($sessionId) |
||
106 | |||
107 | /** |
||
108 | * Returns the unique session id. |
||
109 | * |
||
110 | * @return string The uniquid id |
||
111 | */ |
||
112 | public function getSessionId() |
||
116 | |||
117 | /** |
||
118 | * Returns the parent message. |
||
119 | * |
||
120 | * @return \AppserverIo\Psr\Pms\MessageInterface The parent message |
||
121 | */ |
||
122 | public function getParentMessage() |
||
126 | |||
127 | /** |
||
128 | * Returns the message monitor. |
||
129 | * |
||
130 | * @return \AppserverIo\Psr\Pms\MonitorInterface The monitor |
||
131 | */ |
||
132 | public function getMessageMonitor() |
||
136 | |||
137 | /** |
||
138 | * Returns the priority of the message. |
||
139 | * |
||
140 | * @return \AppserverIo\Psr\Pms\PriorityKeyInterface The priority of the message |
||
141 | */ |
||
142 | public function getPriority() |
||
146 | |||
147 | /** |
||
148 | * Returns the state of the message. |
||
149 | * |
||
150 | * @return \AppserverIo\Psr\Pms\StateKeyInterface The message state |
||
151 | */ |
||
152 | public function getState() |
||
156 | |||
157 | /** |
||
158 | * Sets the monitor for monitoring the message itself. |
||
159 | * |
||
160 | * @param \AppserverIo\Psr\Pms\MonitorInterface $messageMonitor The monitor |
||
161 | * |
||
162 | * @return void |
||
163 | */ |
||
164 | public function setMessageMonitor(MonitorInterface $messageMonitor) |
||
168 | |||
169 | /** |
||
170 | * Unlocks the message. |
||
171 | * |
||
172 | * @return void |
||
173 | */ |
||
174 | public function unlock() |
||
178 | |||
179 | /** |
||
180 | * Sets the parent message. |
||
181 | * |
||
182 | * @param \AppserverIo\Psr\Pms\MessageInterface $parentMessage The parent message |
||
183 | * |
||
184 | * @return void |
||
185 | */ |
||
186 | public function setParentMessage(MessageInterface $parentMessage) |
||
190 | |||
191 | /** |
||
192 | * Sets the destination queue. |
||
193 | * |
||
194 | * @param \AppserverIo\Psr\Pms\QueueInterface $destination The destination queue |
||
195 | * |
||
196 | * @return void |
||
197 | */ |
||
198 | public function setDestination(QueueInterface $destination) |
||
202 | |||
203 | /** |
||
204 | * Return's the number of retries for this message. |
||
205 | * |
||
206 | * @return integer The number of retries |
||
207 | */ |
||
208 | public function getRetryCounter() |
||
212 | |||
213 | /** |
||
214 | * Return's the callback information for the given state. |
||
215 | * |
||
216 | * @param \AppserverIo\Psr\Pms\StateKeyInterface $state The state to register the callback for |
||
217 | * |
||
218 | * @return array The array with the callback information |
||
219 | */ |
||
220 | public function getCallbacks(StateKeyInterface $state) |
||
224 | |||
225 | /** |
||
226 | * Add's the callback for the given state. |
||
227 | * |
||
228 | * @param \AppserverIo\Psr\Pms\StateKeyInterface $state The state to register the callback for |
||
229 | * @param array $callback The array with the bean's lookup and method name that has to be invoked |
||
230 | * |
||
231 | * @return void |
||
232 | * @throws \Exception Is thrown if the passed state doesn't support callbacks |
||
233 | */ |
||
234 | public function addCallback(StateKeyInterface $state, array $callback) |
||
238 | |||
239 | /** |
||
240 | * Return's the timeout for the given retry. |
||
241 | * |
||
242 | * @param integer $retry The retry to return the timeout for |
||
243 | * |
||
244 | * @return integer The timeout in seconds for the passed retry |
||
245 | * @throws \InvalidArgumentException Is thrown if the timeout for the passed retry is NOT available |
||
246 | */ |
||
247 | public function getRetryTimeout($retry) |
||
251 | |||
252 | /** |
||
253 | * Return's the array with the retry timeouts. |
||
254 | * |
||
255 | * @return array The retry timeouts |
||
256 | */ |
||
257 | public function getRetryTimeouts() |
||
261 | |||
262 | /** |
||
263 | * Returns the message lock flag. |
||
264 | * |
||
265 | * @return boolean TRUE if the message is locked, else FALSE |
||
266 | */ |
||
267 | public function isLocked() |
||
271 | |||
272 | /** |
||
273 | * Sets the state of the message. |
||
274 | * |
||
275 | * @param \AppserverIo\Psr\Pms\StateKeyInterface $state The new state |
||
276 | * |
||
277 | * @return void |
||
278 | */ |
||
279 | public function setState(StateKeyInterface $state) |
||
283 | |||
284 | /** |
||
285 | * Locks the message. |
||
286 | * |
||
287 | * @return void |
||
288 | */ |
||
289 | public function lock() |
||
293 | |||
294 | /** |
||
295 | * Sets the priority of the message. |
||
296 | * |
||
297 | * @param \AppserverIo\Psr\Pms\PriorityKeyInterface $priority The priority to set the message to |
||
298 | * |
||
299 | * @return void |
||
300 | */ |
||
301 | public function setPriority(PriorityKeyInterface $priority) |
||
305 | |||
306 | /** |
||
307 | * Return's whether or not callbacks for the passed state has been registered. |
||
308 | * |
||
309 | * @param \AppserverIo\Psr\Pms\StateKeyInterface $state The state to register the callback for |
||
310 | * |
||
311 | * @return boolean TRUE if callbacks has been registered, else FALSE |
||
312 | */ |
||
313 | public function hasCallbacks(StateKeyInterface $state) |
||
317 | |||
318 | /** |
||
319 | * Set's the array with the retry timeouts which is also responsible |
||
320 | * for the the number of retries. |
||
321 | * |
||
322 | * @param array $retryTimeouts The number of retries with their timeouts |
||
323 | * |
||
324 | * @return void |
||
325 | */ |
||
326 | public function setRetryTimeouts(array $retryTimeouts) |
||
330 | } |
||
331 |