Conditions | 6 |
Paths | 7 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
36 | public function handleMessage(AMQPMessage $message) |
||
37 | { |
||
38 | if (!isset($this->callback)) { |
||
39 | throw new ReaderException("Handling a message with no callback set"); |
||
40 | } |
||
41 | |||
42 | try { |
||
43 | $task = $this->jsonMessageFactory->create($message->body); |
||
44 | $response = call_user_func($this->callback, $task); |
||
45 | if(is_null($response) || !is_bool($response) || $response) { |
||
46 | $message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']); |
||
47 | } |
||
48 | } catch(InvalidJSONMessageException $e) { |
||
49 | throw new ParseMessageException(json_encode($message->getBody()), 0, $e); |
||
50 | } |
||
51 | } |
||
52 | |||
57 | } |