/** * Send an Event Message for each subscription * @param Session $session * @param PublishMessage $msg * @param Subscription $subscription */ private function sendEventMessage(Session $session, PublishMessage $msg, Subscription $subscription) { $sessionId = $subscription->getSession()->getSessionId(); $authroles = []; $authid = ""; $authenticationDetails = $subscription->getSession()->getAuthenticationDetails(); if ($authenticationDetails) { $authroles = $authenticationDetails->getAuthRoles(); $authid = $authenticationDetails->getAuthId(); } if ((!$msg->excludeMe() || $subscription->getSession() != $session) && !$msg->isExcluded($sessionId) && $msg->isWhiteListed($sessionId) && $msg->hasEligibleAuthrole($authroles) && $msg->hasEligibleAuthid($authid)) { $eventMsg = EventMessage::createFromPublishMessage($msg, $subscription->getId()); if ($subscription->isDisclosePublisher() === true) { $eventMsg->disclosePublisher($session); } if ($this->getMatchType() != "exact") { $eventMsg->getDetails()->topic = $msg->getUri(); } $subscription->sendEventMessage($eventMsg); } }