| Conditions | 4 |
| Paths | 4 |
| Total Lines | 29 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | public function execute($message) : int |
||
| 38 | { |
||
| 39 | if (!$message instanceof AMQPMessage) { |
||
| 40 | return self::MSG_REJECT; |
||
| 41 | } |
||
| 42 | $body = json_decode($message->body); |
||
| 43 | if ($this->messageName !== $body->name) { |
||
| 44 | return self::MSG_REJECT; |
||
| 45 | } |
||
| 46 | |||
| 47 | try { |
||
| 48 | $this->eventSubscriber->handle( |
||
| 49 | new AsyncEvent( |
||
| 50 | $this->messageName, |
||
| 51 | new \DateTimeImmutable($body->occurredOn), |
||
| 52 | json_decode( |
||
| 53 | json_encode( |
||
| 54 | $body->values |
||
| 55 | ), |
||
| 56 | true |
||
| 57 | ) |
||
| 58 | ) |
||
| 59 | ); |
||
| 60 | |||
| 61 | return self::MSG_ACK; |
||
| 62 | } catch (Exception $exception) { |
||
| 63 | return self::MSG_REJECT; |
||
| 64 | } |
||
| 65 | } |
||
| 66 | } |
||
| 67 |