PSM Uploader and Encoder Flow
The PSM Uploader and Encoder components are divided into two separate and independent services: Encoder and Uploader. Each service operates through its own set of CronJobs and workflows to process and manage session recordings.
Encoder
The encoder converts video files from .guac
format to .mp4
. It utilizes two CronJobs that run independently to manage this conversion process.
First CronJob
Initialization: Starts every 5 minutes, reads filenames from the directory.
Session Polling: Passes sessions to EID using the endpoint
/api/services/v1/secureaccessgateway/polling
to check for closed/terminated sessions.Filtering Sessions: Retains only closed sessions.
Recording Status Check: Uses the endpoint
/api/services/v1/secureAccessGateway/GetRecordingProcessStatus
to get the recording status and avoid duplication. Example response:{ "PrivSessionID": "a15494e9-8568-4cc4-a055-0e40dfbe1c57", "RecordingStatus": "Processing" }
Queue Management: Adds sessions with
RecordingStatus: null
to thesessionsQueue
after verifying they don't already exist in thesessionsQueue
orfailedJobs
array. Sessions are queued as objects to handle retries:{"07a44b9f-568c-47c8-bbf2-f433d7b49104": 0}
Â
Second CronJob
Initialization: Starts every 10 minutes, independently of the first CronJob.
Failed Jobs Retrieval: Fetches
failedJobs
array from the cache.Session Handling: Adds first 5 sessions from
failedJobs
to an array. Dequeues sessions fromsessionsQueue
and adds them to the array until it contains 10 sessions.Worker Processing: Passes sessions to a worker thread, updating their
recordingStatus
to "Processing" using the endpoint/api/services/v1/secureAccessGateway/UpdateRecordingProcessStatus
. Example payload:{ "privSessionId": "81930caf-f6f7-46b3-bbab-c1faa2d29f16", "recordingStatus": "Processing" }
Video Conversion: Converts videos to
.mp4
usingguacnec
andffmpeg
utilities. Manages failed jobs by retrying up to 3 times and updating the status to "Failed" if retries are exhausted. Successfully processed sessions are marked as "Processed".
Â
Â
Uploader
The Uploader manages the final step of uploading processed video files. It runs a single cron job to handle this task.
Initialization: Starts every 5 minutes, reads files from the
/recording
directory.Session Filtering: Filters out closed sessions and fetches their recording status using the endpoint
/api/services/v1/secureAccessGateway/GetRecordingProcessStatus
.Processing: Only sessions with the status "Processed" are considered for uploading. Fetches storage mode settings for each session from the endpoint:
Queue Management: Adds sessions to the
sessionsQueue
after checking they don't already exist in the queue orfailedJobs
array.Failed Jobs Handling: Retrieves
failedJobs
array from the cache, processes the first 5 sessions, and combines them with dequeued sessions to form an array of 10 sessions.Worker Processing: Updates
recordingStatus
to "Uploading" before starting the upload. Example payload:Uploading: Uploads videos to the specified storage mode (e.g., AWS, Azure). Manages failed uploads by retrying up to 3 times and updating the status to "Failed" if retries are exhausted. Successfully uploaded sessions are marked as "Uploaded".
Â
Â
By following this structured approach, the PSM Uploader and Encoder services ensure that video sessions are efficiently converted and uploaded while handling failures and retries systematically. This workflow ensures reliability and accuracy in managing session recordings.
Â