tillkuhn / rubin

💿 rubin - a simple record producer for Kafka topics written in Go that acts as a thin wrapper around Confluent's REST Proxy API (v3)
https://pkg.go.dev/github.com/tillkuhn/rubin
Apache License 2.0
1 stars 0 forks source link

Consider Kafka Protocol Binding for CloudEvents #5

Closed tillkuhn closed 10 months ago

tillkuhn commented 10 months ago

For Example https://github.com/cloudevents/spec/blob/main/cloudevents/bindings/kafka-protocol-binding.md#331-kafka-content-type

content-type: application/cloudevents+json; charset=UTF-8

The receiver of the event can distinguish between the two content modes by inspecting the content-type Header of the Kafka message. If the header is present and its value is prefixed with the CloudEvents media type application/cloudevents, indicating the use of a known event format, the receiver uses structured mode, otherwise it defaults to binary mode.

------------------ Message -------------------

Topic Name: mytopic

------------------- key ----------------------

Key: mykey

------------------ headers -------------------

content-type: application/cloudevents+json; charset=UTF-8

------------------- value --------------------

{
    "specversion" : "1.0",
    "type" : "com.example.someevent",
    "source" : "/mycontext/subcontext",
    "id" : "1234-1234-1234",
    "time" : "2018-04-05T03:56:24Z",
    "datacontenttype" : "application/xml",

    ... further attributes omitted ...

    "data" : {
        ... application data encoded in XML ...
    }
}
tillkuhn commented 10 months ago

done