mm_api_notify
is a service for emitting notifications about changes in the PBS Media Manager system.
- rustup - mm_api_notify is built in Rust. It is needed to compile the service, and can be installed easily with rustup
- MongoDB - mm_api_notify uses MongoDB to store a record of the records it has seen
git clone https://github.com/twincitiespublictelevision/mm_api_notify.git
- Create a release build
cargo build --release
- Use the
mm_api_import.example
sample or other scripts to create a service - Move application build to the location specified in service script
- Create a config file based on
config.toml.example
file (see below) - Start the service with
rebuild
to build the cache for the first time.
A sample config file is supplied in config.toml.example
Option | Value |
---|---|
thread_pool_size | Max number of threads to use |
min_runtime_delta | Min seconds to wait between updates |
lookback_timeframe | Number of seconds to look back during updates |
ignore_skip | Enables writing to storage for every entry |
enable_hooks | Global control over hooks |
These are the values required to connect to the MongoDB instance. Authentication currently is run against the admin
database.
Option |
---|
host |
port |
name |
username |
password |
Option | Value |
---|---|
key | Media Manager API key |
key | Media Manager API secret |
changelog_max_timespan | Max time allowed between update runs |
Option | Value |
---|---|
location | Path to log file |
level | Level to report |
Hooks allow for defining urls that the service should send notifications to when objects in Media Manager change. Hooks can be define for each of the emitted types. The service currently supports basic auth for authentication with urls.
Option | Value |
---|---|
type | List of hooks |
A hook consists of 1 required part and 2 optional parts.
{ url: required, username: optional, password: optional }
Each type has its own list of hooks that it should call to.
mm_api_notify watches for changes to resources via the changelog
endpoint of Media Manager API and when it sees a change, emits it out as a POST or DELETE against the defined hooks.
POST - Each change is emitted as a nested JSON structure containing the changed resource along with its parent chain up to a franchise.
DELETE - Deletes are emitted when an element is listed as a deletion in the changelog
or when the keys defined for the service are no longer able to access a resource (404 or 403).
The binary also offers a query mode to generate emit payloads that are useful for debugging what is being sent during and update POST request.
mm_api_notify --query asset 0146e77a-b7c2-4492-b791-47586bb2a154
mm_api_notify is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.