{
"tenantId": "tds76wkj",
"sourceId": "preview",
"eventType": "CONTENT",
"event": {
"batchType": "CONTENT",
"eventTimestamp": {
"time": 1715932890123
},
"events": [
{
"eventClass": "CONTENT",
"eventType": "CONTENT_CREATED",
"eventTimestamp": {
"time": 1715932884497,
"sequenceNumber": 19200,
"subsequenceNumber": 1,
"idTag": -1631061747
},
"contentId": "coremedia:///cap/content/1234",
"contentType": "CMArticle"
}
]
}
}
Introduction to the Event Hub Service
Getting started with the Event Hub Service.
Welcome to the CoreMedia Event Hub Service documentation. In this introduction, you will get a basic overview of the Event Hub and how to use it.
|
The Event Hub Service is an optional feature, please reach out to your sales representative or open a support request if you want to use it. |
|
There is only one version of the Event Hub Service, which all customers use. This documentation describes the current version. See the Event Hub Service Changelog for the changes of each version. |
Overview of the Architecture
The CoreMedia Event Hub Service is a cloud-only service, which enables you to subscribe to the events of CoreMedia Content Cloud. An event is created whenever a content item has been changed, created, or deleted on either the Content Management Server or the Master Live Server. Additionally, certain user actions in CoreMedia Studio and changes in workflows can trigger events.
Events happening on a CoreMedia Content Cloud instance are sent to the Event Hub Service. The service receives the events, processes, and distributes them to the registered webhooks.
Events
You can use the Event Hub Service to consume three kinds of events:
-
Content Events
Events from the content repository, analogous to the content events in the CoreMedia Unified API. Examples are:
-
content creation
-
content update
-
check-in/out
-
approval
-
publication/depublication
-
deletion
Directly repeated
PROPERTIES_CHANGEDevents of the same content item that differ only in their timestamp are merged: only the newer event is delivered. -
-
Workflow Events
Workflow relevant events like
-
Workflow assignments
-
Workflow status changes
Events that only have an internal meaning for the workflow engine never reach the Event Hub Service, so no subscription receives them:
WORKFLOW_PROPERTIES_CHANGED,WORKFLOW_TIMER_EXPIRED,TASK_GUARDS_CHECKED,TASK_CONTROL_TRANSFERRED,PROCESS_SIGNALEDandTASK_SIGNALED.TASK_ENTEREDandTASK_EXITEDare delivered. -
-
Notification Events
All events that are also available as Studio notifications are available as editorial events in the Event Hub. This includes:
-
Editorial Comments in Studio
-
Other notifications like project assignments.
-
Webhooks
Webhooks are simple URL endpoints. The Event Hub Service sends the events in JSON format in the request body to registered webhook endpoints. The API of the events is documented in Event Hub API.
Batches
Content, workflow and notification events are delivered as batches: each request carries one message with a batch of events of one event stream. For example, a message with content events looks like this (shortened):
-
batchTypeisCONTENT,WORKFLOWorNOTIFICATIONand is always present. -
eventsis ordered: process the events in the order of the array. -
A message holds up to 100 events. For content events, the limit applies to events, not to content items: one content item can have several events in one message.
-
Events that a filter of your subscription excludes are not delivered (see Filtering Events with the Event Hub Service). If a filter excludes all events of a message, the message is not delivered at all.
-
New properties may be added to the messages and events at any time. Your endpoint must ignore properties it does not know.
Stacks of Content Events
One change in the content repository can create several events, for example a check-in creates a new version and
checks in the content item. Such events have the same eventTimestamp.sequenceNumber and form a stack; within a stack,
eventTimestamp.subsequenceNumber numbers the events from 1 to n. This also applies to replays (see
Repeated Delivery). In a replay, a message never ends inside the events of a content item.
Test Events
A test event (eventType TEST) can be sent to any webhook endpoint, independent of the event streams of the
subscription, for example when you test a subscription (see
Test a Webhook Subscription).
Your endpoint must accept it with a success status code and can otherwise ignore it.
Delivery and Error Handling
The following guarantees and limits describe the current behavior of the Event Hub Service. The timings are current values that CoreMedia may change, for example to avoid congestion.
Successful Delivery
A message is delivered when your endpoint responds with a status code from 200 to 205. Every other status code, including redirects (3xx), is a failure.
Your endpoint must respond within 15 seconds; otherwise the call counts as a failure.
There is some delay between the change on the Content Server and the arrival at the webhook endpoint. The delay depends on the system load and is usually up to 1 minute.
Order and Retries
Per subscription and event stream, the messages are delivered in order. As long as a message is not accepted by your endpoint, the later messages of that subscription and event stream wait.
A message that is not accepted is retried for a limited time, currently at least 5 and at most 7 days. CoreMedia may shorten this limit if required, for example to avoid congestion. After the limit, the undelivered events are discarded. CoreMedia cannot deliver discarded events again.
A webhook endpoint that fails or accepts messages too slowly can also delay the delivery to the other subscriptions of the same event stream, if CoreMedia has to slow down the source of the events.
Disabling or deleting a subscription discards the events that have not yet been delivered to it.
Repeated Delivery
The Event Hub Service delivers events at least once. In every case your endpoint must expect events to be delivered again, for example after network errors or a restart on the CoreMedia side.
-
Content events from the change log of the content repository that are delivered again are identical to the first delivery.
-
In a replay, a content item that is delivered again is rebuilt from its current state, so its events may differ from the earlier delivery (another version, another state). The latest delivery of a content item is authoritative; discard the state from the earlier delivery.
-
If a content item was destroyed in between, no new events arrive for it in the replay; its destroy event follows with the regular events after the replay has finished (
REPLAY_FINISHED).
A replay of the existing content is sent when you create a content subscription with replay=true (see
Replay of Content Events).
In rare cases, for example when the content repository was restored from a backup or replaced by a wipe and an
export/import of the content, all content subscriptions receive a replay of the whole repository. It starts with an
INITIALIZED event and ends with a REPLAY_FINISHED event with syntheticReplay set to true. Such a replay
describes a new repository: everything you derived from earlier events is stale and must be discarded to get a
consistent view.
Recovering Lost Events
Content events that were lost, for example because they were discarded after the retry limit, cannot be delivered
again. A new subscription with a replay (replay=true) recovers the current state of the content, not the lost
events: content items that were destroyed in the meantime are not part of the replay. Rebuild your view from the
replay, or remove every content item from your view that the replay did not deliver. Lost workflow and notification
events cannot be recovered.
Operating Your Webhook Endpoint
CoreMedia does not monitor your webhook endpoints. To receive all events, you are responsible for the following:
-
Your endpoint must be reachable from the Internet.
-
Monitor your endpoint: alert on responses other than a success status code.
-
Accept every message first and handle processing errors on your side. Never answer with a 4xx status code because your application cannot process the content of a message: the message is retried and blocks all later messages of the subscription and event stream until it is accepted or discarded.
-
After changing the credentials of your endpoint, test the subscription (see Test a Webhook Subscription), so that a rejected authentication (401) is noticed at once.
-
Respond immediately and process the messages asynchronously, for example by persisting them to a durable storage and processing them with asynchronous workers. The acceptable response time depends on the event rate of your instance: under a high rate of changes even a few seconds per message can be too slow.
Configuration of the Webhook Subscription
You can use the Event Hub Webhook Subscription Service to administer the webhook endpoints for your CMOC instances by yourself. See Using the Event Hub Subscription Service.
Activation of the Event Hub Service
Contact the CoreMedia support at support@coremediaoncloud.com to get the Event Hub Service activated for your account.
The CoreMedia support will provide you with the URL of the subscription service and will provide secrets in the Cloud Manager of your instance. Use the secrets to get the token, necessary to access the subscription service.
