Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cloud events

Buzzvil
November 11, 2020

Cloud events

By Claud

Buzzvil

November 11, 2020
Tweet

More Decks by Buzzvil

Other Decks in Programming

Transcript

  1. Event • In programming and software design, an event is

    an action or occurrence recognized by software. • Events are everywhere. • But, event publishers tend to describe events differently.
  2. CloudEvents • A specification for describing event data in a

    common way • Provide interoperability across services, platforms and systems. • CNCF incubating project ◦ v1.0 released on October 24, 2019 Protocol Message Event Context Data Occurrence
  3. Occurrence • Capture of a statement of fact during the

    operation of a software system ◦ Signal raised by the system ◦ Signal observed by the system • Example ◦ Battery is low ◦ Virtual machine is about to perform a scheduled reboot Occurrence
  4. Event • A data record expressing an occurrence and its

    context • Routed from an event producer to interested event consumers Event Occurrence
  5. Event > Event Data • Represent the domain-specific information about

    the Occurrence • The payload will be encapsulated within data attribute • Encoded into a media format specified by the datacontenttype context attribute Event Data Occurrence { "datacontenttype": "text/xml", "data" : "<much wow=\"xml\"/>" }
  6. Event > Context • Provide contextual information about the Occurrence

    • Context metadata will be encapsulated in the Context Attributes • Context Attributes ◦ Strongly typed: Boolean, Integer, String, Binary, URI, URI-reference, Timestamp ◦ Required / Optional / Extension attributes Event Data Occurrence Context
  7. Event > Context > Required Attributes • id ◦ Identifies

    the event. ◦ Must be unique within the scope of the producer (ensure source + id is unique) • source ◦ Identifies the context in which an event happened. • specversion ◦ The version of the CloudEvents specification. • type ◦ Describe the type of event related to the originating occurrence Event Data Occurrence Context
  8. Event > Context > Other Attributes • Optional Attributes ◦

    datacontenttype, dataschema, subject, time • Extension Context Attributes ◦ A CloudEvent can include any number of additional context attributes with distinct names Event Data Occurrence Context
  9. Message • Events are transported from a source to a

    destination via messages • Encoded to ◦ Protobuf ◦ JSON ◦ Avro ◦ ..etc. Message Event Context Data Occurrence { "specversion" : "1.0", "type" : "com.github.pull.create", "source" : "https://github.com/cloudevents/spec/pull", "subject" : "123", "id" : "A234-1234-1234", "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleothervalue" : 5, "datacontenttype" : "text/xml", "data" : "<much wow=\"xml\"/>" } { "specversion" : "1.0", "type" : "com.github.pull.create", "source" : "https://github.com/cloudevents/spec/pull", "subject" : "123", "id" : "A234-1234-1234", "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleothervalue" : 5, "datacontenttype" : "application/octet-stream", "data" : "T3BlbkluZnJhRGF5cyBLb3JlYSAyMDE4" } { "specversion" : "1.0", "type" : "com.github.pull.create", "source" : "https://github.com/cloudevents/spec/pull", "subject" : "123", "id" : "A234-1234-1234", "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleothervalue" : 5, "datacontenttype" : "application/json", "data" : {"appinfoA": "abc"} } Context Data
  10. Protocol • Messages can be delivered through various protocol •

    Industry standard protocols ◦ HTTP, AMQP, MQTT, SMTP • Open-source protocols ◦ Kafka, NATS • Platform/Vendor specific protocols ◦ AWS Kinesis, Azure Event Grid Protocol Message Event Context Data Occurrence
  11. Routing • Producer: create the data structure describing the CloudEvent

    • Intermediary: receive a message and forward it to the next receiver • Consumer: receive the event and acts upon it Producer Intermediary Intermediary Consumer Consumer
  12. CloudEvent SDKs • CloudEvents provides SDKs for ◦ Go ◦

    Javascript ◦ Java ◦ C# ◦ Ruby ◦ Python
  13. CloudEvent Integrations > Knative • Knative is a set of

    open source components for Kubernetes ◦ Serving: run stateless workloads, such as microservices ◦ Eventing: support event subscription, delivery, and handling Some Event Producer Knative Eventing Knative Serving deliver events trigger some k8s workloads event occurrence
  14. Summary • CloudEvents is a specification for describing event data

    in a common way • CloudEvents can deliver any event with various content type / transport • CloudEvents supports SDKs for mainstream languages • Some major parties are already integrating their eventing with CloudEvents