Ejemplo n.º 1
0
 /**
  * @param bool $isOn
  */
 protected function onMode($isOn)
 {
     $userId = $this->securityFacade->getLoggedUserId();
     try {
         $this->publisher->send('oro/maintenance', array('isOn' => (bool) $isOn, 'userId' => $userId));
     } catch (\Exception $e) {
         $this->logger->error($e->getMessage());
     }
 }
 /**
  * Send message into topic
  *
  * @param array $usersWithNewEmails
  */
 public function send($usersWithNewEmails)
 {
     if ($usersWithNewEmails) {
         foreach ($usersWithNewEmails as $item) {
             /** @var EmailUser $emailUser */
             $emailUser = $item['entity'];
             $messageData = ['hasNewEmail' => array_key_exists('new', $item) === true && $item['new'] > 0 ?: false];
             $this->publisher->send(self::getUserTopic($emailUser->getOwner(), $emailUser->getOrganization()), json_encode($messageData));
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Send payload into topic
  *
  * @param array $tags
  */
 public function send(array $tags)
 {
     /** @var SecurityContextInterface $securityContext */
     $securityContext = $this->securityContextLink->getService();
     $userName = $securityContext->getToken() && is_object($securityContext->getToken()->getUser()) ? $securityContext->getToken()->getUser()->getUserName() : null;
     if (!empty($tags)) {
         $tags = array_map(function ($tag) use($userName) {
             return ['username' => $userName, 'tagname' => $tag];
         }, $tags);
         $this->publisher->send(self::UPDATE_TOPIC, json_encode($tags));
     }
 }
 public function onModeOff()
 {
     $this->publisher->send('oro/maintenance', array('isOn' => false, 'msg' => 'Maintenance mode is OFF'));
 }
Ejemplo n.º 5
0
 /**
  * @param array $messageData
  * @param int $recipientId
  * @return bool
  */
 protected function sendMessage(array $messageData, $recipientId)
 {
     return $this->topicPublisher->send(sprintf('oro/reminder/remind_user_%s', $recipientId), json_encode($messageData));
 }
Ejemplo n.º 6
0
 public function onModeOff()
 {
     $userId = $this->securityFacade->getLoggedUserId();
     $this->publisher->send('oro/maintenance', array('isOn' => false, 'userId' => $userId));
 }