Cloud Event
Overview
CloudEvent is a wrapper format used throughout the OpenDSO platform for exchanging data between services via NATS messaging. Almost all DTOs in OpenDSO are wrapped in CloudEvent structures when transmitted over the message bus or returned from API calls. This standardized envelope provides consistent metadata about the message including its source, type, timestamp, and content type.
The data field of the CloudEvent contains the actual payload, which can be any DTO type (CIMEX equipment data, rule parameters, service responses, etc.). This wrapper pattern enables OpenDSO services to handle messages uniformly while supporting diverse payload types.
For example, the Event Service API returns CloudEvent DTOs with RuleEvent data:
CloudEvent DTO
data: Array(RuleEvent)
CloudEvent wrappers are used by all OpenDSO service APIs:
- Event Service API - Wraps RuleEvent data
- Topology Genesis Service API - Wraps CIMEX and Region data
- Topology Nodes Service API - Wraps CIMEX topology data
- DER Dispatch Service API - Wraps dispatch configuration data
Cloud Event
| Field | Type | Label | Description |
|---|---|---|---|
| id | string | getUUID() | |
| source | string | ||
| specversion | string | "1.0" | |
| type | string | ||
| datacontenttype | Optional<std::string> | ||
| subject | Optional<std::string> | ||
| timestamp | Optional<std::string> | getTimestamp() | |
| data | generic(T) |