- 快召唤伙伴们来围观吧
- 微博 QQ QQ空间 贴吧
- 文档嵌入链接
- 复制
- 微信扫一扫分享
- 已成功复制到剪贴板
CNCF 无服务器工作组 / 云事件
展开查看详情
1 .Deep Dive: CNCF Serverless WG & CloudEvents Clemens Vasters - clemensv@microsoft.com Cathy Zhang - Cathy.H.Zhang@huawei.com
2 .Agenda ● CloudEvents Deep Dive ● Workflow Overview ● Q&A
3 .Eventing vs Messaging • Events and messages are both mailing envelopes for data, decorated by metadata – but they are different. • Events carry facts. They report things that have happened. • State transitions, observed conditions, objects having been created, … • Messages carry intents. The sender expects something to happen. • Command execution, job handling, workflow progress, … • Events are published as an information option for interested subscribers. The audience size may be zero or many. • Messages are sent to handlers. There may be delivery and handling status feedback, replies, conversations, or complex control flows like Workflows and Sagas. The audience size may be one or many.
4 .CloudEvents - Base Specification • CloudEvents is a lightweight common convention for events. • It’s intentionally not a messaging model to keep complexity low. • No reply-path indicators, no message-to-message correlation, no target address indicators, no command verbs/methods. • Metadata for handling of events by generic middleware and/or dispatchers • What kind of event is it? eventtype • When was it sent? eventtime • What context was it sent out of? source • What is this event’s unique identifier? eventid • What’s the shape of the carried event data? contenttype, schemaurl • Event data may be text-based (esp. JSON) or binary
5 .CloudEvents - Event Formats • Event formats bind the abstract CloudEvents information model to { specific wire encodings. "cloudeventsversion" : "0.1", • All implementation must support JSON. "eventtype" : "myevent", "source" : "uri:example-com:mydevice", JSON is the default encoding for where "eventid" : "A234-1234-1234", metadata text must be rendered, e.g. "eventtime" : "2018-04-05T17:31:00Z", "contenttype" : "text/plain", HTTP header values "data" : "Hello" • AMQP type system encoding defined for } metadata mapping to AMQP properties and annotations JSON Representation • Further compact binary event format candidates might be CBOR, or Protobuf.
6 .HTTP Transport Binding • Transport bindings bind the CloudEvent event metadata and data to the transport frame of an existing application or transfer protocol. • HTTP Transport Binding: • Binds a CloudEvent event to the HTTP message. Works for both requests and replies. Does not constrain usage of methods or status codes; can be used for all cases where HTTP carries entity bodies. • Structured mode: Complete event including metadata rendered carried in entity body. Upside: Easier to handle/forward • Binary mode: Only event data carried in entity body, metadata mapped to headers. Upside: More compact
7 .HTTP Structured Binding Mode HTTP/1.1 POST /myresource … content-type: application/cloudevents+json { "cloudeventsversion" : "0.1", "eventtype" : "myevent", "source" : "uri:example-com:mydevice", "eventid" : "A234-1234-1234", "eventtime" : "2018-04-05T17:31:00Z", "contenttype" : "text/plain", "data" : "Hello" }
8 .HTTP Binary Binding Mode HTTP/1.1 POST /myresource ce-cloudeventsversion: 0.1 ce-eventtype: myevent ce-source: uri:example-com:mydevice ce-eventid: A234-1234-1234 ce-eventtime: 2018-04-05T17:31:00Z content-type: text/plain Hello
9 .Other Transport Bindings • AMQP: ISO/IEC messaging protocol used for a variety of message brokers and event buses; defined in OASIS • Binds event to the AMQP message • Binary and structured modes • MQTT: ISO/IEC lightweight pub/sub protocol for device telemetry propagation; defines in OASIS • Binds event to MQTT PUBLISH frame. • Binary and Structured for MQTT v5 • Structured mode only for MQTT v3.1.1 (lacks custom frame headers) • NATS: Text-based lightweight pub/sub protocol • Binds event to the NATS message. • Structured mode only (lacks custom frame headers)
10 .Workflow Deep Dive
11 .Workflow Overview (Use Case)
12 .Workflow Overview (Key Primitives)
13 .Workflow Overview (Use Case)
14 .Workflow Overview
15 . Thank You! ● Serverless WG : https://github.com/cncf/wg-serverless ○ Workflow: https://github.com/cncf/wg-serverless/tree/master/workflow/spec ● CloudEvents : https://cloudevents.io/ ○ Org : https://github.com/cloudevents ○ Spec repo : https://github.com/cloudevents/spec ○ SDKs : https://github.com/cloudevents/sdk-... ● Questions?
16 .