Repository navigation
feat(plugins): Added support for persistEvent - #21389
Conversation
…nd added all needed support in the back-end and front-end
WalkthroughThe pull request introduces a comprehensive plugin event persistence mechanism across multiple components of the BigBlueButton system. The changes enable plugins to generate and persist events that can be recorded in the Assessment against linked issues
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (6)
🧰 Additional context used🪛 Biome (1.9.4)bbb-graphql-actions/src/actions/pluginPersistEvent.ts[error] 16-16: Don't use 'String' as a type. Use lowercase primitives for consistency. (lint/complexity/noBannedTypes) [error] 17-17: Don't use 'String' as a type. Use lowercase primitives for consistency. (lint/complexity/noBannedTypes) ⏰ Context from checks skipped due to timeout of 90000ms (7)
🔇 Additional comments (4)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Actionable comments posted: 16
🧹 Outside diff range and nitpick comments (9)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/PluginEventPersistenceRecordEvent.scala (2)
5-9: Consider moving the event type string to a constant.The hardcoded string "PluginGeneratedEvent" should be defined as a constant in the companion object for better maintainability and reusability.
object PluginEventPersistenceRecordEvent { + protected final val EVENT_TYPE = "PluginGeneratedEvent" protected final val USER_ID = "userId" // ... other constants ... } class PluginEventPersistenceRecordEvent extends AbstractPluginRecordEvent { import PluginEventPersistenceRecordEvent._ - setEvent("PluginGeneratedEvent") + setEvent(EVENT_TYPE)
23-28: Add ScalaDoc comments for the constants.Consider adding documentation to explain the purpose and expected values for each constant.
object PluginEventPersistenceRecordEvent { + /** The ID of the user who triggered the event */ protected final val USER_ID = "userId" + /** The name of the event being persisted */ protected final val PERSISTED_EVENT_NAME = "persistedEventName" + /** The name of the plugin that generated the event */ protected final val PLUGIN_NAME = "pluginName" + /** The JSON-serialized payload containing event-specific data */ protected final val PAYLOAD = "payload" }akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractPluginRecordEvent.scala (2)
1-19: Update the copyright year in the license header.The copyright year is set to 2017, but this is a new file being added in 2024. Consider updating it to reflect the current year.
-* Copyright (c) 2017 BigBlueButton Inc. and by respective authors (see below). +* Copyright (c) 2024 BigBlueButton Inc. and by respective authors (see below).
22-30: Add ScalaDoc documentation to improve code maintainability.Consider adding documentation to describe the trait's purpose and the
setPluginNamemethod's behavior.+/** + * Base trait for plugin-related record events that can be written to events.xml. + * Provides common functionality for plugin event recording. + */ trait AbstractPluginRecordEvent extends RecordEvent { import AbstractPluginRecordEvent._ setModule("PLUGIN") + /** + * Sets the name of the plugin that generated this event. + * + * @param pluginName The identifier of the plugin + */ def setPluginName(pluginName: String) {bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/manager.tsx (1)
42-44: Remove unnecessary type casting in export.The type casting will be unnecessary once the component is properly typed as React.FC.
After implementing the earlier suggestion to use React.FC, this should be simplified to:
- }) as React.ElementType<PluginEventPersistenceManagerProps>; + }; export default PluginEventPersistenceManager;akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala (1)
9-10: Add documentation for the trait.Consider adding ScalaDoc comments to describe the trait's purpose and its relationship with
PluginHdlrs.+/** + * Handles persistence of plugin events to events.xml file. + * Must be mixed into a class that extends PluginHdlrs. + */ trait PluginPersistEventMsgHdlr extends HandlerHelpers {bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PluginMsgs.scala (2)
63-69: Consider adding documentation and payload type safety.The message definition follows the standard pattern, but could benefit from additional documentation and type safety:
- Add scaladoc comments explaining the purpose and usage of this message type
- Consider using a more specific type for payload instead of raw Object to prevent serialization issues
Example documentation:
/** * Message sent from plugins to request event persistence in events.xml * @param pluginName The name of the plugin requesting event persistence * @param eventName The name/type of the event being persisted * @param payload Event-specific data to be persisted */
70-76: Fix indentation and maintain consistency with event message.The indentation in the event message body differs from other message bodies in the file.
Apply this formatting fix:
case class PluginPersistEventEvtMsgBody( - pluginName: String, - eventName: String, - payload: Map[String, Object] - ) + pluginName: String, + eventName: String, + payload: Map[String, Object] + )akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala (1)
729-730: Consider tracking user activity for plugin events.For consistency with other user-initiated actions in the message handler, consider updating the user's last activity timestamp when handling plugin persistence events. This helps maintain accurate user activity tracking for inactivity checks.
- case m: PluginPersistEventMsg => pluginHdlrs.handle(m, state, liveMeeting, msgBus) + case m: PluginPersistEventMsg => + pluginHdlrs.handle(m, state, liveMeeting, msgBus) + updateUserLastActivity(m.header.userId)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
bigbluebutton-html5/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (14)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginHdlrs.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractPluginRecordEvent.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/PluginEventPersistenceRecordEvent.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala(2 hunks)bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PluginMsgs.scala(1 hunks)bbb-graphql-actions/src/actions/pluginPersistEvent.ts(1 hunks)bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/manager.tsx(1 hunks)bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/mutations.ts(1 hunks)bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/types.ts(1 hunks)bigbluebutton-html5/imports/ui/components/plugins-engine/manager.tsx(2 hunks)bigbluebutton-html5/package.json(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/mutations.ts
🧰 Additional context used
🪛 Biome
bbb-graphql-actions/src/actions/pluginPersistEvent.ts
[error] 16-16: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead
(lint/complexity/noBannedTypes)
[error] 17-17: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead
(lint/complexity/noBannedTypes)
🔇 Additional comments (21)
bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/types.ts (1)
1-3: Verify if additional type safety properties are needed.
The interface structure is clean and follows TypeScript naming conventions. However, given that plugins will be writing events with payloads to events.xml, consider if additional type definitions might be beneficial:
- A type definition for the event payload structure
- An enum or union type for allowed event names
- Optional validation rules for the plugin name
This would provide better type safety and documentation for plugin developers.
Let's check if there are any existing type definitions we should align with:
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginHdlrs.scala (2)
11-12: LGTM! Clean integration of the new message handler.
The addition of PluginPersistEventMsgHdlr follows the established pattern of message handlers in the class, maintaining good separation of concerns.
12-12: Verify the trait implementation and message flow.
Let's ensure the PluginPersistEventMsgHdlr trait is properly implemented and handles the event persistence correctly.
✅ Verification successful
The trait implementation and message flow are properly implemented
The verification shows that:
- The
PluginPersistEventMsgHdlrtrait is correctly implemented with proper message handling - It includes safety checks for disabled plugins and plugin existence
- The message flow is properly integrated in MeetingActor
- The implementation includes proper event persistence permission checks before broadcasting
- The message definitions are well-defined with appropriate fields for plugin events
The code structure follows the expected pattern and includes all necessary safeguards for plugin event persistence.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the implementation of PluginPersistEventMsgHdlr and its message flow
# Test 1: Check if the trait is defined and contains the necessary message handling logic
echo "Checking PluginPersistEventMsgHdlr implementation..."
ast-grep --pattern 'trait PluginPersistEventMsgHdlr {
$$$
handle($msg: PluginPersistEventMsg) {
$$$
}
$$$
}'
# Test 2: Verify the message flow in MeetingActor
echo "Checking message handling in MeetingActor..."
rg -A 5 "case msg: PluginPersistEventMsg =>"
# Test 3: Check for any related test cases
echo "Checking for related test cases..."
fd -e scala -e java --exec rg -l "PluginPersistEventMsg"
Length of output: 969
Script:
#!/bin/bash
# Let's check the actual implementation of PluginPersistEventMsgHdlr trait and its message handling
# Check the trait implementation
echo "=== PluginPersistEventMsgHdlr Implementation ==="
cat ./akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala
# Check how MeetingActor handles the message
echo -e "\n=== MeetingActor Message Handling ==="
rg -B 2 -A 5 "PluginPersistEventMsg" ./akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
# Check message definition
echo -e "\n=== Message Definition ==="
cat ./bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PluginMsgs.scala
Length of output: 7455
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/PluginEventPersistenceRecordEvent.scala (2)
1-4: LGTM!
The package structure and import are appropriate for the record event handling functionality.
1-28: Verify event recording in events.xml.
Let's verify that the events are properly recorded with all required fields.
✅ Verification successful
Based on the analysis of the code and search results, I can now provide a final response about the event recording verification:
Plugin events are properly recorded with all required fields
The PluginEventPersistenceRecordEvent class follows the established event recording pattern in the system where:
-
All required fields are properly set through the eventMap:
- Event name via
setEvent("PluginGeneratedEvent") - User ID via
setUserId - Persisted event name via
setPersistedEventName - Payload data via
setPayload(with proper JSON serialization)
- Event name via
-
The events are stored in events.xml which is the standard recording format used by BigBlueButton for:
- Raw recording storage
- Playback processing
- Recording rebuilds
- Analytics and post-processing
The implementation follows the same pattern as other recording events in the system (like presentation events, chat events, etc.) ensuring consistency and reliability in event persistence.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the events.xml structure matches the expected format
# and contains all required fields for plugin events.
# Test: Search for plugin event handling in the codebase
rg -A 5 "PluginGeneratedEvent.*events\.xml"
# Test: Look for XML event structure in test files
fd -e xml -e scala ".*test.*" --exec rg -l "PluginGeneratedEvent"
Length of output: 111
Script:
#!/bin/bash
# Let's try a broader search to understand the event recording mechanism
# Search for event recording implementations
rg -l "events\.xml" --type scala
# Look for references to PluginGeneratedEvent
rg -A 5 "PluginGeneratedEvent"
# Search for classes extending AbstractPluginRecordEvent
ast-grep --pattern 'class $_ extends AbstractPluginRecordEvent'
# Look for event persistence related code
rg -A 5 "eventMap.put|setEvent" --type scala
Length of output: 110983
Script:
#!/bin/bash
# Let's check how the events are processed and recorded
# Look for the code that handles event recording
rg -A 5 "RecordEvent.*toMap"
# Search for the event recording implementation
rg -A 10 "record.*events\.xml|events\.xml.*record"
# Look for the base record event class
ast-grep --pattern 'class RecordEvent'
Length of output: 16509
bbb-graphql-actions/src/actions/pluginPersistEvent.ts (3)
1-2: LGTM!
The imports are appropriate for the functionality being implemented.
4-4: LGTM!
The function signature is well-typed and follows TypeScript best practices.
1-33: Verify integration with events.xml processing.
The implementation looks good and aligns with the PR objectives. Since this is part of a larger feature for plugin event recording, we should verify that the message structure matches what the recording processor expects.
✅ Verification successful
The previous search was too specific. Let's broaden our search to find relevant event processing code that might help verify the message structure compatibility.
The output shows there's a dedicated handler for plugin events. Let's examine its implementation to verify the message structure compatibility.
The output shows the recording infrastructure and we found the relevant plugin event classes. Let's examine their specific implementations to verify the message structure compatibility.
Message structure is compatible with recording processor
The implementation is verified to be compatible with the recording infrastructure:
- The message structure from
buildRedisMessagematches the expected format for plugin events - The
PluginEventPersistenceRecordEventclass properly handles the event recording with all required fields (pluginName, eventName, payload) - The handler
PluginPersistEventMsgHdlrcorrectly processes and broadcasts the events while respecting plugin permissions
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Look for the recording processor's event handling code
rg -A 5 "events\.xml" --type scala
Length of output: 36
Script:
#!/bin/bash
# Look for event processing related files and patterns
rg -g "*.scala" -g "*.java" -l "plugin.*event|recording.*process"
# Search for XML event handling patterns
rg -g "*.scala" -g "*.java" -A 5 "processEvent|handleEvent|recordEvent"
Length of output: 1442
Script:
#!/bin/bash
# Let's check the plugin event handler implementation
cat "akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala"
# Also search for plugin event related message structures
rg -g "*.scala" "case class PluginPersistEvent" -A 10
Length of output: 68712
Script:
#!/bin/bash
# Let's check the plugin event persistence implementation
cat "akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/PluginEventPersistenceRecordEvent.scala"
# Also check the plugin event handler
cat "akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala"
Length of output: 3003
🧰 Tools
🪛 Biome
[error] 16-16: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead
(lint/complexity/noBannedTypes)
[error] 17-17: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead
(lint/complexity/noBannedTypes)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractPluginRecordEvent.scala (2)
32-34: LGTM!
The companion object is well-structured with appropriate visibility modifiers and naming conventions.
22-34: Let me gather more information to verify the plugin event integration.
#!/bin/bash
# Search for plugin event handling and recording-related code
# Look for RecordEvent implementations and usage
echo "RecordEvent implementations:"
ast-grep --pattern 'trait $_ extends RecordEvent'
ast-grep --pattern 'class $_ extends RecordEvent'
# Search for plugin event publishing/handling
echo -e "\nPlugin event handling:"
rg -A 5 "setModule.*PLUGIN"
# Check recording configuration and event processing
echo -e "\nRecording configuration and processing:"
rg -A 5 "record.*event" -g "*.{scala,conf}"bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/manager.tsx (2)
1-7: LGTM! Well-organized imports with proper type definitions.
The imports are cleanly organized, properly separating SDK dependencies from local modules.
1-44: Verify integration with events.xml persistence.
Based on the PR objectives, this component should enable plugins to write events to the events.xml file. Let's verify the complete flow.
✅ Verification successful
Integration with events.xml persistence is properly implemented
The verification shows a complete flow for plugin event persistence:
- The GraphQL mutation is correctly defined in
mutations.tswith required fields (pluginName, eventName, payload) - The event handling is implemented in Scala with
PluginPersistEventMsgHdlrwhich:- Validates plugin existence and enabled status
- Broadcasts events through the message bus
- The
RedisRecorderActorhandles the persistence by:- Converting events to the correct format via
PluginEventPersistenceRecordEvent - Recording to the events system via
record()method with proper meeting context
- Converting events to the correct format via
The implementation matches the requirements for writing plugin events to the recording system that generates events.xml.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the GraphQL mutation implementation and event format
# Check the GraphQL mutation definition
echo "Checking GraphQL mutation definition..."
rg -A 10 "PLUGIN_EVENT_PERSISTENCE_MUTATION"
# Check the mutation resolver implementation
echo "Checking mutation resolver..."
rg -A 15 "pluginEventPersistence"
# Check the event XML format handling
echo "Checking XML event handling..."
rg -A 10 "PluginPersistEventEvtMsg"
Length of output: 12289
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala (2)
1-8: LGTM! Imports are well-organized and specific.
All necessary dependencies are properly imported for handling plugin event persistence.
12-37: Verify plugin event persistence in events.xml.
Since this implementation is meant to persist events to events.xml, we should verify the integration with the recording system.
✅ Verification successful
Let me try a different search strategy to verify the plugin event persistence implementation.
This should help us find recording-related files and any plugin event persistence implementations.
Let me check the specific implementation of plugin event recording.
Based on the findings, I can now provide a final response:
Plugin event persistence is properly integrated with the recording system
The implementation correctly handles plugin event persistence through:
PluginEventPersistenceRecordEventclass that extendsAbstractPluginRecordEvent- Integration in
RedisRecorderActorthat creates and processes plugin events - Proper event mapping with required fields (pluginName, eventName, userId, payload)
The recording system will capture plugin events in events.xml when:
- Plugins are enabled for the meeting
- The specific plugin has eventPersistence enabled in its manifest
- The event is properly broadcasted through the message bus
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the recording system properly handles plugin events
# Test 1: Look for recording-related code that processes plugin events
echo "Searching for recording event handlers..."
rg -l "events\.xml" --type scala
# Test 2: Check for event processing implementations
echo "Checking event processing implementations..."
ast-grep --pattern 'def process$$$Event' --lang scala
Length of output: 282
Script:
#!/bin/bash
# Search for recording-related files and implementations
echo "Searching for recording-related files..."
fd "Record" --type f --extension scala
echo "Searching for plugin event handling in recording..."
rg -l "plugin" --type scala $(fd "Record" --type f --extension scala)
echo "Looking for event persistence implementations..."
rg -A 5 "eventPersistence" --type scala
Length of output: 17308
Script:
#!/bin/bash
# Check the implementation of plugin record events
echo "Checking PluginEventPersistenceRecordEvent implementation..."
cat akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/PluginEventPersistenceRecordEvent.scala
echo "Checking AbstractPluginRecordEvent implementation..."
cat akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractPluginRecordEvent.scala
echo "Checking RedisRecorderActor implementation for plugin events..."
rg -A 5 "PluginEventPersistence" akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala
Length of output: 2904
bigbluebutton-html5/imports/ui/components/plugins-engine/manager.tsx (2)
20-20: LGTM!
The import statement follows the established pattern and maintains consistency with other plugin manager imports.
84-86: Verify event persistence initialization order.
The component placement looks good, but we should ensure that the event persistence manager is initialized after core plugin functionality (loader, data channel) and before optional features.
Let's verify the initialization dependencies:
✅ Verification successful
Initialization order is correctly implemented
Based on the code analysis:
- The
PluginEventPersistenceManageris placed afterPluginLoaderManagerandPluginLearningAnalyticsDashboardManager, and beforePluginDataChannelManager - The implementation shows it only sets up an event listener for persistence events and doesn't have any dependencies on other plugin managers
- The manager's initialization is lightweight (just a window event listener setup) and doesn't interfere with other managers' operations
The current placement ensures proper initialization order without any dependency conflicts.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any initialization order dependencies in the event persistence manager
# Expected: No explicit initialization order requirements in the implementation
# Search for initialization-related code in the event persistence manager
ast-grep --pattern 'useEffect($$$)' ./bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/manager.tsx
# Search for any dependencies on other plugin managers
rg -l "import.*PluginEventPersistenceManager" --type ts --type tsx
Length of output: 338
Script:
#!/bin/bash
# Let's try a different approach to verify initialization dependencies
# Check the event persistence manager implementation
rg -A 10 "PluginEventPersistenceManager" ./bigbluebutton-html5/imports/ui/components/plugins-engine/ --type tsx
# Look for any useEffect or initialization code
rg -A 10 "useEffect|constructor|componentDidMount" ./bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/ --type tsx
# Check import order and dependencies
rg "import.*Plugin.*Manager" ./bigbluebutton-html5/imports/ui/components/plugins-engine/ --type tsx
Length of output: 439
Script:
#!/bin/bash
# Let's try without specifying file type since tsx isn't recognized
# Check the event persistence manager implementation
rg -A 10 "PluginEventPersistenceManager" ./bigbluebutton-html5/imports/ui/components/plugins-engine/
# Look for any useEffect or initialization code
rg -A 10 "useEffect|constructor|componentDidMount" ./bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/
# Check import order and component rendering order
rg "import.*Plugin.*Manager|<Plugin.*Manager" ./bigbluebutton-html5/imports/ui/components/plugins-engine/
Length of output: 12077
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PluginMsgs.scala (1)
63-76: Verify event message handling in the recording system.
The message structure aligns with the PR objectives for plugin event persistence, but we should verify the integration with the recording system.
✅ Verification successful
Based on the search results, I can now provide a definitive response about the plugin event persistence in the recording system. The code shows complete integration:
Plugin event persistence is properly integrated with the recording system
The verification shows:
- The
PluginPersistEventEvtMsgis handled byRedisRecorderActorwhich creates aPluginEventPersistenceRecordEvent - The event is properly structured with the required fields (pluginName, eventName, userId, payload)
- The event is integrated into the recording system's event framework alongside other core events
- The event uses the standard recording event infrastructure with proper module designation ("PLUGIN")
The implementation follows the same pattern as other recording events in the system, ensuring consistent handling and persistence of plugin events.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the handling of PluginPersistEventEvtMsg in the recording system
# Test 1: Check for event handling in recorder actor
rg -A 5 "PluginPersistEventEvtMsg"
# Test 2: Verify XML event writing implementation
rg -A 10 "events.xml.*write|recordEvent.*xml"
Length of output: 5371
Script:
#!/bin/bash
# Let's verify the recording system integration by checking:
# 1. The PluginEventPersistenceRecordEvent class implementation
# 2. The recording event handler infrastructure
# Check for PluginEventPersistenceRecordEvent implementation
rg -l "class PluginEventPersistenceRecordEvent"
# Search for recording event handlers and XML writing logic
rg -A 5 "RecordEvent|recordEvent.*xml"
# Look for recording event registration or processing
rg -A 5 "addEventToQueue|handleRecordingEvent"
Length of output: 126030
bigbluebutton-html5/package.json (1)
61-61: Ensure lock file is updated.
Please verify that the corresponding lock file (package-lock.json or yarn.lock) has been updated to reflect this dependency change. This ensures consistent installations across different environments.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala (1)
446-448: LGTM! Message routing implementation looks correct.
The addition of PluginPersistEventMsg handling follows the established patterns and is correctly placed in the plugin-related section.
Let's verify the message type definition and routing:
✅ Verification successful
The verification results show that PluginPersistEventMsg is properly defined and integrated:
- Message definition exists in
PluginMsgs.scala - Handler implementation exists in
PluginPersistEventMsgHdlr.scala - Message routing is correctly set up in both
ReceivedJsonMsgHandlerActorandMeetingActor - The message follows the standard pattern with header and body structure
Let's verify the handler implementation to ensure complete correctness:
Message routing implementation is correctly integrated with proper handler logic
The verification confirms that:
- Message type is properly defined with standard header/body structure
- Handler implementation includes appropriate permission checks for event persistence
- Message routing is correctly set up in both the receiver and meeting actor
- The implementation follows the established pattern for plugin message handling
- Proper error handling and logging is in place for disabled plugins and missing permissions
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the PluginPersistEventMsg definition and related components
# Test 1: Check the message type definition
rg "PluginPersistEventMsg" --type scala
# Test 2: Check for any existing usages of the message
ast-grep --pattern 'case class PluginPersistEventMsg'
Length of output: 2209
Script:
#!/bin/bash
# Check the handler implementation
cat akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala
Length of output: 2104
akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala (2)
130-132: LGTM! Case match follows existing patterns.
The new case match for PluginPersistEventEvtMsg is correctly integrated into the message handling pattern and follows the established code structure.
700-708: LGTM! Implementation follows existing patterns.
The handlePluginPersistEvent method correctly implements the plugin event persistence functionality and follows the established patterns in the codebase.
|
This pull request has conflicts ☹ |
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala (1)
14-23:⚠️ Potential issueAdd error handling for message broadcasting.
The message broadcasting implementation should handle potential failures when sending messages through the message bus.
Apply this diff to add error handling:
def broadcastEvent(msg: PluginPersistEventMsg, bus: MessageBus): Unit = { val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId) val envelope = BbbCoreEnvelope(PluginPersistEventEvtMsg.NAME, routing) val header = BbbClientMsgHeader(PluginPersistEventEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId) val body = PluginPersistEventEvtMsgBody(msg.body.pluginName, msg.body.eventName, msg.body.payload) val event = PluginPersistEventEvtMsg(header, body) val msgEvent = BbbCommonEnvCoreMsg(envelope, event) - bus.outGW.send(msgEvent) + try { + bus.outGW.send(msgEvent) + } catch { + case e: Exception => + log.error(s"Failed to broadcast plugin event: ${e.getMessage}") + } }
🧹 Nitpick comments (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala (1)
30-47: Improve error logging for better debugging.The current implementation uses
log.infofor all scenarios. Consider using appropriate log levels:
- Use
log.warnfor validation failures- Use
log.errorfor critical failures- Add more context to log messages
Apply this diff to improve error logging:
PluginModel.getPluginByName(liveMeeting.plugins, msg.body.pluginName) match { case Some(p) => if (msg.body.eventName.trim.isEmpty) { - log.info(s"Empty event name received for plugin '${msg.body.pluginName}'") + log.warn(s"Empty event name received for plugin '${msg.body.pluginName}'. Event persistence skipped.") } else { val eventPersistence = p.manifest.content.eventPersistence eventPersistence match { case Some(permissions) if permissions.isEnabled => broadcastEvent(msg, bus) case Some(_) => - log.info(s"Event persistence is disabled for plugin '${msg.body.pluginName}'") + log.warn(s"Event persistence is disabled for plugin '${msg.body.pluginName}'. Event '${msg.body.eventName}' not persisted.") case None => - log.info(s"Event persistence permissions not defined for plugin '${msg.body.pluginName}'") + log.error(s"Event persistence permissions not defined for plugin '${msg.body.pluginName}'. Event '${msg.body.eventName}' not persisted. Check plugin manifest.") } } case None => - log.info(s"Plugin '${msg.body.pluginName}' not found.") + log.error(s"Plugin '${msg.body.pluginName}' not found. Event '${msg.body.eventName}' not persisted. Check plugin registration.")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractPluginRecordEvent.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/PluginEventPersistenceRecordEvent.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala(2 hunks)bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/manager.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- bigbluebutton-html5/imports/ui/components/plugins-engine/event-persistence/manager.tsx
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractPluginRecordEvent.scala
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/PluginEventPersistenceRecordEvent.scala
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: build-package (others)
- GitHub Check: build-package (bbb-html5)
- GitHub Check: build-package (bbb-fsesl-akka)
- GitHub Check: build-package (bbb-web)
- GitHub Check: build-package (bbb-graphql-server)
- GitHub Check: build-package (bbb-playback-record)
- GitHub Check: build-package (bbb-apps-akka)
🔇 Additional comments (3)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/plugin/PluginPersistEventMsgHdlr.scala (1)
25-29: LGTM! Proper permission check implementation.The implementation correctly checks if plugins are disabled and ejects users with appropriate error messaging.
akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala (2)
134-136: LGTM! Well-organized message handling.The new case for handling plugin persistence events is correctly placed in the plugin section and follows the established pattern.
751-759: Add validation and logging for better robustness.Consider these improvements:
- Add payload validation to handle potential null or malformed data
- Add debug logging to aid in troubleshooting
Apply this diff to improve the implementation:
private def handlePluginPersistEvent(msg: PluginPersistEventEvtMsg): Unit = { + log.debug(s"Persisting plugin event: ${msg.body.eventName} from plugin: ${msg.body.pluginName}") + val ev = new PluginEventPersistenceRecordEvent() ev.setPersistedEventName(msg.body.eventName) ev.setPluginName(msg.body.pluginName) ev.setUserId(msg.header.userId) - ev.setPayload(msg.body.payload) + // Validate payload before persisting + val sanitizedPayload = Option(msg.body.payload).getOrElse("{}") + ev.setPayload(sanitizedPayload) record(msg.header.meetingId, ev.toMap.asJava) }
|
Looks like the issue requested a payload like: And it was implemented like: If we are going to keep the value as json only, maybe the field name should be @TiagoJacobs any thoughts? |
|
I suggest to create a Hasura action |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
bbb-graphql-server/metadata/actions.yaml (1)
278-283: Add documentation comment for consistency.Consider adding a comment field to document the action's purpose, similar to the
presentationExportaction.Apply this diff to improve documentation:
- name: pluginPersistEvent definition: kind: synchronous handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}' permissions: - role: bbb_client + comment: Persists plugin-generated events to events.xml for recording
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala(1 hunks)akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala(1 hunks)bbb-graphql-server/metadata/actions.graphql(1 hunks)bbb-graphql-server/metadata/actions.yaml(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: build-package (others)
- GitHub Check: build-package (bbb-html5)
- GitHub Check: build-package (bbb-fsesl-akka)
- GitHub Check: build-package (bbb-web)
- GitHub Check: build-package (bbb-graphql-server)
- GitHub Check: build-package (bbb-playback-record)
- GitHub Check: build-package (bbb-apps-akka)
|
Automated tests Summary✅ All the CI tests have passed! |
|
@GuiLeme @gustavotrott any news on this? |
Looks good to merge |


What does this PR do?
This PR implemented the
pluginApi.persistEventfunction just as requested by bigbluebutton/bigbluebutton-html-plugin-sdk#121.Closes Issue(s)
Closes bigbluebutton/bigbluebutton-html-plugin-sdk#121
How to test
Create a meeting with
record=trueto captureevents.xmland with the following parameter:run the sample-use-meeting plugin with an
npm startand with the correct SDK.Wait for a few seconds, end the meeting and check the
events.xmlby doing the folloing commands:sudo updatedb vi $(locate events.xml | grep <meeting-id>)If you are using the use-meeting sample, then, your
events.xmlshould look something like:The meeting id can be found with
/getMeetingInfoendpoint in the ApiMate for instance.More
Closely related to bigbluebutton/bigbluebutton-html-plugin-sdk#122
Depends on #21368