[ADP-603] CloudEvents Type Conventions
Guidance
MUST use namespaced events
MUST reverse domain names
MUST follow the naming convention
jsoncom.vivotek[.applicationId].resourceType.eventVersioning.eventInPastTense
- The applicationId part is optional; it can be omitted if the resourceType part is guaranteed to be unique under the (reversed) domain name
MAY use application specific domain without applicationId
jsoncom.vortexcloud.resourceType.eventVersioning.eventInPastTense
Event versioning SHOULD follow semantic versioning
SHOULD register and manage resource types in a centralized registry
SHOULD register and manage the overall event type in a centralized registry
SHOULD use past tense for event names.
SHOULD be in camelCase.
Examples
Here are some examples of event types that adhere to the above guidelines:
Basic event type:
httpcom.vivotek.camera.v1.recorded
Event type with application ID:
httpcom.vivotek.vms.user.v1.created
Event type with semantic versioning:
httpcom.vivotek.accesscontrol.door.v2.1.opened
OpenAPI Example
Here's an example using OpenAPI 3.0 to describe the CloudEvents type conventions:
components:
schemas:
CloudEvent:
type: object
required:
- specversion
- type
- source
- id
properties:
specversion:
type: string
enum: ['1.0']
type:
type: string
pattern: '^com\.vivotek(\.[a-z0-9]+)*\.[a-z0-9]+\.v\d+(\.\d+){0,2}\.[a-z]+$'
example: 'com.vivotek.camera.v1.recorded'
source:
type: string
format: uri-reference
id:
type: string
time:
type: string
format: date-time
data:
type: object
paths:
/events:
post:
summary: Publish a CloudEvent
requestBody:
content:
application/cloudevents+json:
schema:
$ref: '#/components/schemas/CloudEvent'
responses:
'201':
description: Event published successfully
'400':
description: Invalid event format
Notes
When designing new event types, it is recommended to consider existing event types to avoid unnecessary duplication or confusion.
Periodically review and update the event type conventions to ensure they continue to meet system requirements.
[Draft] Consider establishing a centralized event type registry to make it easy for team members to find and understand existing event types.