Technical Note: CatDV 13 Notifications
Notifications are a new feature in the CatDV 13 client to give immediate feedback about the progress of worker transcodes and other operations, and also to automatically refresh the catalog if another user edits a clip (greatly reducing the risk of conflicting edits if two users work on the same catalog at the same time).
Sources of notifications
The way notifications work is that certain operations such as saving a clip to the server, deleting a clip, updating the task status, and so on generate a notification and the CatDV Server’s notification service then broadcasts these notifications to all the listeners that have subscribed to it.
The desktop client subscribes to all notifications, but only responds to notifications that relate to clips and catalogs that you have open.
There are different sources of notifications, including the Worker Node and the CatDV Server itself:
· The worker sends notifications when a task is queued, when a task starts, when it completes (successfully or with a failure), and when the task status is updated with progress messages while a task runs. It also sends notifications when the worker engine starts and stops.
· The server automatically sends notifications when a clip is inserted, updated, or deleted, amongst others. Crucially, it doesn’t make any difference whether the changes are being made by the desktop client, by the web client, by the worker, or using the REST API, so you can keep up to date with clip changes whoever made them.
· The CatDV web interface sends a notification when a file is uploaded
· Notifications are also used by the chat system.
Subscribing to notifications
To subscribe to notifications from the desktop client check the “Subscribe to notifications” option in the Server preferences. Additionally, in order to automatically update the catalog when another user makes a change, you also need to check the “Auto-save/auto-refresh” option.
Displaying notifications
To display the most recent notification received for any clip add the ‘Notification’ field (clip.notif) to a view. In a list view it will display a circular progress indicator for any percentages, in other views it will display text.
Notifications highlight changes to a clip as they occur in real time and aren’t persisted to the database. Instead, they fade out and disappear after a few minutes when they are no longer current.
It’s important to note that notifications don’t replace existing long term mechanisms (like the red/green proxy online indicator, the clip Status or History fields, or the worker task list) for checking whether a proxy exists or a task failed.
Notifications in the Worker Node
CatDV Worker Node 8 can be set up to automatically trigger server query and watch folder tasks when it receives a notification from the server. You can use this instead of (or as well as) the older mechanism of regularly polling the server query or scanning the watch folder.
Triggering actions based on notifications ensures the uploaded file or modified clip is processed immediately, rather than waiting for the next poll interval, and is much more efficient because it doesn’t rely on repeatedly running the same query over and over again,
Even if you’re using notifications instead of polling, the server query is still performed once (and the watch folder is scanned once) when the worker first starts up to get the worker into a consistent initial state ready for subsequent notifications and ensure that all pre-existing clips and files that match have been processed.
Troubleshooting notifications
As described here, notifications require Server 7.3.4, CatDV 13.0a6, and Worker 7.0.11 or 8.0b6, or later. Some features may be available in earlier versions (for example, Worker 7 already sends notifications when it performs a task, but only Worker 8 responds to notifications to trigger a task).
You can monitor notifications as they arrive using the Server > Server Control Panel > Notifications tab. This stores the last few hundred notifications that the client received and is useful for checking that notifications are being received. If you double click a row you will see the raw JSON notification message.
You can also see the raw JSON of all the recent notifications for a clip looking at the ‘Notifications’ field in the ‘All Fields’ tab. (Accessing fields in the full clip.notifications object might also be useful in JavaScript UI scripts.)
If notifications don’t seem to be being received then that can sometimes happen if your network configuration changes (for example if you’re on a laptop and move between networks). If that happens either disconnect from the server and log on again, or, if necessary, quit the desktop application and relaunch it. Entering the Notifications tab also tries to reconnect, but this may fail if you’re not on a network and ‘localhost’ is unreachable.
You can search the server log for messages about notifications, in particular for exceptions that show it failed to send a notification to a listener and so unsubscribed it, and for how many listeners or “endpoints” a notification is being sent to.