Hex pmHex DocsApache 2.0 license

Cloudevents is an Elixir SDK for consuming and producing CloudEvents with support for various transport protocols and codecs. If you want to learn more about the specification itself, make sure to check out the official spec on GitHub.

Cloudevents is released under the Apache License 2.0 - see the LICENSE file.

Supported versions

Status

SpecStatus
Core Specification:
CloudEventsv0.1, v0.2, v1.0
Optional Specifications:
AMQP Protocol Bindingout of scope for now (PR welcome)
AVRO Event Formattodo (PR welcome)
HTTP Protocol Bindingwip (done except batch mode)
JSON Event Formatdone
Kafka Protocol Bindingv1.0
MQTT Protocol Bindingout of scope for now (PR welcome)
NATS Protocol Bindingout of scope for now (PR welcome)
Web hookout of scope for now (PR welcome)

Getting started

Add cloudevents to your list of dependencies in mix.exs:

def deps do
[{:cloudevents, "~> 0.5.1"}]
end

Use Cloudevents.from_map/1 to create your first Cloudevent and see its JSON representation using Cloudevents.to_json/1.

If you're dealing with HTTP requests, Cloudevents.from_http_message/2, Cloudevents.to_http_binary_message/1 and Cloudevents.to_http_structured_message/2 are your friends.

If you need Avro, you need to add Cloudevents to your supervisor:

children = [
Cloudevents
]
Supervisor.start_link(children, strategy: :one_for_one)

Or start Cloudevents manually:

{:ok, pid} = Cloudevents.start_link()