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.
Getting started
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([])