In our Tech Radar we put CloudEvents in the trial phase. We’d like to take you on a journey and show you what CloudEvents are and how they can be used. In this first blog we will be looking at the CloudEvent specification and the serialized end result!

Why CloudEvents?

Taken from their own specification:

CloudEvents is a specification for describing event data in common formats to provide interoperability across services, platforms and systems.

We could look at CloudEvents as something similar to SOAP or REST, a standardized way of communicating over a protocol, in this case for events.

So what does a CloudEvent look like?

The CloudEvent specification is a set of attributes, some required and some optional, that provide a standardized way to publish events including metadata about the event.

The required attributes
Attribute Description Example


Identifier for the event



Defines the context in which an event happened



The version of the CloudEvents specification which the event uses



Defines the type of event related to the originating occurrence

*Notice that the combination of source + id has to be unique.

The optional attributes
Attribute Description Example


Defines the content type of the data value



Defines the schema that the data value adheres to.


Defines the subject of the event in the context of the event producer. Allows for more specific filtering when source attribute does not suffice

Draft blog


Timestamp of when the occurrence happened



The event payload

<blog><title>A first look at CloudEvents</title><author>Laurens Westerlaken</author></blog>

Can I add my own metadata attributes?

If for some reason you require more propriatary metadata for your events, CloudEvents has you covered with their extensions concept. A few default extensions exist for example for tracability purposes or sequencing of events. In a future blog we will show you how to implement your own custom extension as well!

Serialized result

After building a CloudEvent it gets serialized, for example to JSON, and published. Taking the above examples and serializing to JSON would result in the following:

    "id" : "1",
    "source" : "/jdriven/blog",
    "specversion" : "1.0",
    "type" : "",
    "datacontenttype" : "text/xml",
    "dataschema" : "",
    "subject" : "Draft blog",
    "time" : "2024-06-07T17:15:00",
    "data" : "<blog><title>A first look at CloudEvents</title><author>Laurens Westerlaken</author></blog>"

In the next blog about CloudEvents we will look at how we can apply this specification in practice.