/** * @return BaseObject|null */ public function getObject() { if ($this->event instanceof IKalturaObjectRelatedEvent) { return $this->event->getObject(); } else { return null; } }
public function getScope() { $scope = parent::getScope(); $scope->setPartnerId($this->dbBatchJob->getPartnerId()); $scope->setParentRaisedJob($this->dbBatchJob); return $scope; }
public function getScope() { $scope = parent::getScope(); if (method_exists($this->object, 'getPartnerId')) { $scope->setPartnerId($this->object->getPartnerId()); } return $scope; }
public static function raiseEvent(KalturaEvent $event) { $consumerInterface = $event->getConsumerInterface(); KalturaLog::debug("Event [" . get_class($event) . "] raised looking for consumers [{$consumerInterface}]"); $consumers = self::getConsumers($consumerInterface); foreach ($consumers as $consumerClass) { // KalturaLog::debug("Event consumer [$consumerClass] called"); $continue = $event->consume(new $consumerClass()); if (!$continue) { if ($event instanceof IKalturaCancelableEvent) { KalturaLog::notice("Event [" . get_class($event) . "] paused by consumer [{$consumerClass}]"); break; } else { KalturaLog::debug("Event [" . get_class($event) . "] is not cancelable event"); } } } }
public function getScope() { $scope = parent::getScope(); if ($this->raisedJob) { $scope->setPartnerId($this->raisedJob->getPartnerId()); $scope->setParentRaisedJob($this->raisedJob); } elseif (method_exists($this->object, 'getPartnerId')) { $scope->setPartnerId($this->object->getPartnerId()); } return $scope; }
public static function raiseEventDeferred(KalturaEvent $event) { $eventKey = $event->getKey(); if (!self::$deferredEventsEnabled) { return self::raiseEvent($event); } if (!is_null($eventKey)) { self::$deferredEvents[$eventKey] = $event; } else { self::$deferredEvents['unkeyed_' . count(self::$deferredEvents)] = $event; } }
public function shouldConsumeEvent(KalturaEvent $event) { $this->notificationTemplates = array(); $scope = $event->getScope(); if ($scope->getPartnerId() <= 0 || !EventNotificationPlugin::isAllowedPartner($scope->getPartnerId())) { return false; } $eventType = self::getEventType($event); $eventObjectClassName = self::getEventObjectType($event); $notificationTemplates = self::getNotificationTemplates($eventType, $eventObjectClassName, $scope->getPartnerId()); if (!count($notificationTemplates)) { return false; } foreach ($notificationTemplates as $notificationTemplate) { /* @var $notificationTemplate EventNotificationTemplate */ $scope->resetDynamicValues(); $notificationParameters = $notificationTemplate->getContentParameters(); foreach ($notificationParameters as $notificationParameter) { /* @var $notificationParameter kEventNotificationParameter */ if (!is_null($notificationParameter->getValue())) { $scope->addDynamicValue($notificationParameter->getKey(), $notificationParameter->getValue()); } } $notificationParameters = $notificationTemplate->getUserParameters(); foreach ($notificationParameters as $notificationParameter) { /* @var $notificationParameter kEventNotificationParameter */ if (!is_null($notificationParameter->getValue())) { $scope->addDynamicValue($notificationParameter->getKey(), $notificationParameter->getValue()); } } if ($notificationTemplate->fulfilled($scope)) { $this->notificationTemplates[] = $notificationTemplate; } } return count($this->notificationTemplates); }
public function shouldConsumeEvent(KalturaEvent $event) { $this->notificationTemplates = array(); $scope = $event->getScope(); if ($scope->getPartnerId() <= 0) { return; } if (!EventNotificationPlugin::isAllowedPartner($scope->getPartnerId())) { return; } $eventType = self::getEventType($event); $eventObjectType = self::getEventObjectType($event); $notificationTemplates = self::getNotificationTemplates($eventType, $eventObjectType, $scope->getPartnerId()); if (!count($notificationTemplates)) { return false; } foreach ($notificationTemplates as $notificationTemplate) { /* @var $notificationTemplate EventNotificationTemplate */ if ($this->notificationTemplatesConditionsFulfilled($notificationTemplate, $scope)) { $this->notificationTemplates[] = $notificationTemplate; } } return count($this->notificationTemplates); }
public static function raiseEvent(KalturaEvent $event) { $consumerInterface = $event->getConsumerInterface(); $consumers = self::getConsumers($consumerInterface); foreach ($consumers as $consumerClass) { if (!class_exists($consumerClass)) { continue; } if ($event->consume(new $consumerClass()) || !$event instanceof IKalturaCancelableEvent) { continue; } KalturaLog::notice("Event [" . get_class($event) . "] paused by consumer [{$consumerClass}]"); break; } }