Agenda
Intro
Events in Computing
• History, definition, benefits
CloudEvents to the Rescue
• Introduction, example, benefits
Outlook on xRegistry
• Metamodel, event discovery
More Information
• SAP-related, community-related
PUBLIC 2
PUBLIC 3
The CloudEvents® Project
Project of the Cloud Native Computing Foundation® - CNCF®
Started in 2017 in Serverless Working Group
Became a sandbox project in 2018
Reached version 1.0 and incubation status in late 2019
Project graduation in January 2024
Ongoing effort
• A lot of improvements and additional protocol bindings for the spec (today v1.0.2)
• SDK work
• CE SQL
• Draft specs: Pagination and Subscriptions
• xRegistry for discovery related work
PUBLIC 4
Events in Computing
How it started for me
PUBLIC 6
Graphical Environment Manager (GEM)
AES (Application Environment Services), part of the Graphical Environment Manager (GEM)
• Provides Event API to pass control to the operating system and wait for relevant system
events
• Event filters are based on bit masks
• Wait for keyboard, mouse, window, or menu events
int16_t evnt_multi (int16_t ev_mflags, int16_t ev_mbclicks, int16_t ev_mbmask,
int16_t ev_mbstate, int16_t ev_mm1flags, int16_t ev_mm1x,
int16_t ev_mm1y, int16_t ev_mm1width, int16_t ev_mm1height,
int16_t ev_mm2flags, int16_t ev_mm2x, int16_t ev_mm2y,
MU_KEYBD
int16_t ev_mm2width, int16_t ev_mm2height, (0x0001)
int16_t Keyboard event
*ev_mmgpbuff,
MU_BUTTON
int16_t ev_mtlocount, int16_t ev_mthicount, (0x0002)*ev_mmox,
int16_t Button event
MU_M1
int16_t *ev_mmoy, int16_t *ev_mmbutton, (0x0004)
int16_t Mouse event 1
*ev_mmokstate,
MU_M2
int16_t *ev_mkreturn, int16_t *ev_mbreturn) (0x0008) Mouse event 2
MU_MESAG (0x0010) Messages
MU_TIMER (0x0020) Timer events
MU_WHEEL (0x0040) Mouse-wheel, XaAES
MU_MX (0x0080) Mouse movement, XaAES
MU_KEYBD4 (0x0100) GEM/4
MU_NORM_KEYBD (0x0100)Normalized key-codes, XaAES
MU_DYNAMIC_KEYBD (0x0200) XaAES, not yet implemented
Source: https://freemint.github.io/ X_MU_DIALOG (0x4000) (Geneva)
PUBLIC 7
What is an Event?
Occurrence
Producer
Old New
state state Data
Event
record
Subject
Consumer
PUBLIC 8
Benefits of Events
Inversion of Control
• “Don’t call us, we’ll call you”
• Decouple producer from consumer
Asynchronous processing
PUBLIC 9
Events in Distributed Systems
myReceiver.on('event', () => {
console.log('an event occurred!');
});
Challenges
• Multiple lifecycles
• Data (de-)serialization
• Routing
mySender.emit('event');
• Consistency
• Cross-organizational alignment
PUBLIC 10
CloudEvents
to the Rescue
From Event to CloudEvent
Context of the occurrence
• Source
Occurrence
Occurrence has a
• Type
• Identifier
• Timestamp
Old New • Subject
state state
• New state of subject
• Payload has
Subject • Schema
• Content type
PUBLIC 12
Events in SAP Subscription Billing
{
"specversion": "1.0",
"source": "/us10/sap.billing.sb/481987f2-561e-4f67-a86d-fae553eebc22",
Occurrence "type": "sap.billing.sb.subscription.deleted.v1",
"subject": "SB127",
"id": "33180db6-bde3-11e9-9cb5-2a2ae2dbcce4",
"time": "2029-01-01T05:00:00.000Z",
"sequence": "0000000002",
Old New
state state "datacontenttype": "application/json”,
“data”: {
"sequenceNumber": 2,
"subscriptionId": "be87c0a8-bde3-11e9-9cb5-2a2ae2dbcce4",
"subscriptionDocumentId": "SB127",
"eventType": "deleted",
Subject "eventLogEntryId": "9e7f3b2e-bde3-11e9-9cb5-2a2ae2dbcce4”
}
}
13
PUBLIC
Example from https://hub.sap.com/event/SAPSubscriptionBillingBusinessEvents_SubscriptionEvents/resource
HTTP Binary Mode HTTP Structured Mode with JSON
Format
content type: application/cloudevents+json
{
ce-specversion: 1.0 "specversion": "1.0",
ce-source: /us10/sap.billing.sb/481987f2-561e-4f67-a86d-fae553eebc22 "source": "/us10/sap.billing.sb/481987f2-561e-4f67-a86d-fae553eebc22",
ce-type: sap.billing.sb.subscription.deleted.v1 "type": "sap.billing.sb.subscription.deleted.v1",
ce-subject: SB127 "subject": "SB127",
ce-id: 33180db6-bde3-11e9-9cb5-2a2ae2dbcce4 "id": "33180db6-bde3-11e9-9cb5-2a2ae2dbcce4",
ce-time: 2029-01-01T05:00:00.000Z "time": "2029-01-01T05:00:00.000Z",
ce-sequence: 0000000002 "sequence": "0000000002",
content-type: application/json "datacontenttype": "application/json”,
{ “data”: {
"sequenceNumber": 2, "sequenceNumber": 2,
"subscriptionId": "be87c0a8-bde3-11e9-9cb5-2a2ae2dbcce4", "subscriptionId": "be87c0a8-bde3-11e9-9cb5-2a2ae2dbcce4",
"subscriptionDocumentId": "SB127", "subscriptionDocumentId": "SB127",
"eventType": "deleted", "eventType": "deleted",
"eventLogEntryId": "9e7f3b2e-bde3-11e9-9cb5-2a2ae2dbcce4” "eventLogEntryId": "9e7f3b2e-bde3-11e9-9cb5-2a2ae2dbcce4”
} }
}
PUBLIC 14
Protocols and Formats
Protocol Binding
• How to send a CloudEvent over a given protocol
Mode
• Binary
• Event payload is stored as-is in the message body
• Event context is transported as part of the message metadata
• Structured
• Payload + context are encoded according to an event format
• Batched
• Similar to structured mode, but a batch of events is encoded
• Must be supported by protocol binding and selected format
Format
JSON, Avro, Proto
Further formats as draft specifications available
PUBLIC 15
Benefits of CloudEvents
Cross-organizational alignment
• Defining an envelope for events is a wide-spread approach
• Example: SAP Business Accelerator Hub: https://hub.sap.com/content-type/Events/events/events
Separate business logic from event handling
• CloudEvents provide protocol-independent event definitions
• Comparable to programming concepts like generics CloudEvent<MyEventType
Infrastructure-agnostic
• Leverage existing protocol capabilities
Growing ecosystem
• Supported by many vendors
• SDKs
• Standardization
PUBLIC 16
• Defines common metadata for events
• Defines where to find that metadata in the messages
To aid in the delivery of events
No need to parse or understand the business logic just to route
• Defines an abstract model for how to manage metadata about resources
• Defines registries for messages, schemas, and endpoints on top
To aid in the discovery of event definitions, schemas, and endpoints
PUBLIC 17
Outlook on xRegistry
xRegistry Fundamentals
Extensible Registry
Group Core specification
• Common metamodel
• Store registry in a
– Single file
– Static folder structure
*
Resource – Full-blown registry implementing an API
*
Version
PUBLIC 19
Specific Registry Models Based on xRegistry
Message
Endpoint Schema Group
Group
* * *
Message Message Schema
Message Group *
* Version
(reference)
PUBLIC 20
Producer and consumer endpoints
Consumer Producer
Endpoint Endpoint
Producer Consumer Producer Consumer
Initiate Initiate
Connection Connection
• Event consumers consume messages from these • Event producers send messages to these
endpoints endpoints
• Sometimes referred to as Pull Model • Sometimes referred to as Push Model
• Examples • Examples
• Message consumption using MQTT or AMQP • Message publishing to an MQTT or AMQP topic
• Polling using HTTP (GET) • Posting events to an HTTP web hook
PUBLIC 21
Subscriber Endpoints
Subscriber
Endpoint
Producer
Consumer
PUBLIC 22
Protocols and Envelopes
protocol envelope
HTTP CloudEvents/1.0
Base
protocol
Message
AMQP/1.0
URL
Base
protocol envelope
Message
HTTP CloudEvents/1.0
URL
Base
protocol
Message
KAFKA
URL
PUBLIC 24
More information
CloudEvents at SAP
Blog:
CloudEvents at SAP
Further Devtoberfest Sessions by Antonio Maradiaga
PUBLIC 26
Join the Community!
On github
• https://github.com/cloudevents
• https://github.com/xregistry
• https://github.com/cncf/wg-serverless
On Slack
• Workspace maintained by the CNCF
• Various channels related to CloudEvents, SDKs, and xRegistry
Weekly Calls: every Thursday at 9:00 am PT
PUBLIC 27
Contact information:
Klaus Deissner, SAP
github.com: @deissnerk
LinkedIn: https://www.linkedin.com/in/klaus-deissner
© 2024 SAP SE or an SAP affiliate company. All rights reserved. See Legal Notice on www.sap.com/legal-notice for use terms, disclaimers, disclosures, or restrictions related to this material.