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.
- OTP 25.0 and later
- Elixir 1.13 and later
Spec | Status |
---|---|
Core Specification: | |
CloudEvents | v0.1, v0.2, v1.0 |
Optional Specifications: | |
AMQP Protocol Binding | out of scope for now (PR welcome) |
AVRO Event Format | todo (PR welcome) |
HTTP Protocol Binding | wip (done except batch mode) |
JSON Event Format | done |
Kafka Protocol Binding | v1.0 |
MQTT Protocol Binding | out of scope for now (PR welcome) |
NATS Protocol Binding | out of scope for now (PR welcome) |
Web hook | out of scope for now (PR welcome) |
Add cloudevents
to your list of dependencies in mix.exs
:
def deps do
[{:cloudevents, "~> 0.6.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 avrora
to your dependency list:
def deps do
[{:avrora, "~> 0.21"}]
end
Then, 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([])