Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOUN-1370: add kafka event notification for roomEntry changes #12595

Open
wants to merge 4 commits into
base: Tucana-20.8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions deployment/updates/scripts/2024_03_03_deploy_kafka_room_events.php
@@ -0,0 +1,29 @@
<?php
/**
* @package deployment
*/
require_once (__DIR__ . '/../../bootstrap.php');

$script = realpath(dirname(__FILE__) . "/../../../tests/standAloneClient/exec.php");
$newTemplateUpdate = realpath(dirname(__FILE__) . "/../../updates/scripts/xml/notifications/2024_03_03_add_kafka_room_entry_notifications.xml");

if(!file_exists($newTemplateUpdate) || !file_exists($script))
{
KalturaLog::err("Missing update script file");
return;
}

if (!kConf::hasMap(kConfMapNames::KAFKA)){
KalturaLog::err("Kafka configuration file (kafka.ini) wasn't found!");
return;
}

$kafkaConfig = kConf::getMap(kConfMapNames::KAFKA);

if (!isset($kafkaConfig['brokers']) && !(isset($kafkaConfig['host']) && isset($kafkaConfig['port'])))
{
KalturaLog::err("No Kafka brokers configured");
return;
}

passthru("php $script $newTemplateUpdate");
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<config>
<serviceUrl>@SERVICE_URL@</serviceUrl>
<partnerId>-2</partnerId>
<clientTag>Stand alone php 1.0.0</clientTag>
<curlTimeout>30</curlTimeout>
<userAgent>Stand alone php 1.0.0</userAgent>
</config>
<session>
<partnerId>-2</partnerId>
<secret>@ADMIN_CONSOLE_PARTNER_ADMIN_SECRET@</secret>
<sessionType>2</sessionType>
</session>

<multirequest>
<request service="eventNotificationTemplate" action="add" plugin="eventNotification" partnerId="0">
<template objectType="KalturaKafkaNotificationTemplate">
<name>Room Entry Updated</name>
<systemName>KAFKA_ROOM_ENTRY_UPDATED</systemName>
<description>Kafka notification template to be sent when room entry updated</description>
<automaticDispatchEnabled>1</automaticDispatchEnabled>
<eventType>3</eventType>
<!-- EventNotificationEventType::OBJECT_CHANGED -->
<eventObjectType>1</eventObjectType>
<!-- EventNotificationEventObjectType::ENTRY -->
<topicName>entry</topicName>
<partitionKey>id</partitionKey>
<messageFormat>1</messageFormat>
<apiObjectType>KalturaRoomEntry</apiObjectType>
<eventConditions objectType="array">
<item objectType="KalturaOrCondition">
<conditions objectType="array">
<item objectType="KalturaEventFieldCondition">
<description>Entry of type Room</description>
<field objectType="KalturaEvalBooleanField">
<code>$scope->getObject()->getType() == RoomPlugin::getEntryTypeCoreValue(RoomEntryType::ROOM)</code>
</field>
<values objectType="array">
<item objectType="KalturaStringValue">
<value>1</value>
</item>
</values>
</item>
</conditions>
</item>
</eventConditions>
</template>
</request>
</multirequest>
</xml>
Expand Up @@ -114,7 +114,7 @@ public function dispatch(kScope $scope)
}

$requiredPermissions = explode(",", $this->getRequiresPermissions());
if(count($requiredPermissions))
if(count(array_filter($requiredPermissions, 'strlen')))
{
KalturaLog::debug("Checking if partner has permissions required to dispatch [{$this->getRequiresPermissions()}]");
$found = false;
Expand Down
12 changes: 12 additions & 0 deletions release-notes.md
@@ -1,3 +1,15 @@
# Tucana-20.7.0
## Add kafka event notification for room entry updates ##
- Issue Type: Task
- Issue ID: FOUN-1370

### Configuration ###
Replace all tokens (SERVICE_URL, ADMIN_CONSOLE_PARTNER_ADMIN_SECRET) from the template XML file below and remove ".template" from the file name:
/opt/kaltura/app/deployment/updates/scripts/xml/notifications/2024_03_03_add_kafka_room_entry_notifications.template.xml

### Deployment scripts ###
php /opt/kaltura/app/deployment/updates/scripts/2024_03_03_deploy_kafka_room_events.php

# Tucana-20.6.0
## Add partner and permissions for media repurposing ##
- Issue Type: Task
Expand Down