/**
  * @param UserCreatedEvent $userCreatedEvent
  */
 public function onUserCreated(UserCreatedEvent $userCreatedEvent)
 {
     $user = $userCreatedEvent->getUser();
     $data = array('event' => ApiEvent::USER_CREATED, 'user' => $user->getId(), 'userFullName' => $user->getFullName(), 'image' => $user->getAvatar());
     $message = $this->serializer->serialize($data, 'json', $this->serializationContext);
     $this->sqsClient->send($message);
 }
 /**
  * @param array $message
  * @throws \Exception
  */
 public function handleMessage($message)
 {
     $this->output->writeln('Handle message');
     $receiptHandle = $message['ReceiptHandle'];
     $messageId = $message['MessageId'];
     $body = $message['Body'];
     $data = $this->serializer->deserialize($body, 'array', 'json');
     $notifications = $this->notificationFactoryBag->create($data);
     /** @var Notification $notification */
     foreach ($notifications as $notification) {
         $this->processNotification($notification, $messageId);
     }
     $this->sqsClient->delete($receiptHandle);
 }