kevinbader / cloudevents-ex Goto Github PK
View Code? Open in Web Editor NEWElixir SDK for CloudEvents
Home Page: https://hex.pm/packages/cloudevents
License: Apache License 2.0
Elixir SDK for CloudEvents
Home Page: https://hex.pm/packages/cloudevents
License: Apache License 2.0
I have a simple Avro schema for testing
{ "type": "record", "name": "Exampleschema", "fields": [ {"name": "example", "type": "string"} ] }
and starting Cloudevents with
Cloudevents.start_link([{:confluent_schema_registry_url, "http://schema-registry:8081"}, {:avro_schemas_path, "./priv/schemas"}, {:avro_event_schema_name, "Exampleschema"}])
The schema-registry is reachable through docker, and my schema lives in ./priv/schemas/Exampleschema.avsc
I copied over the event from one of your examples to make sure I'm not missing anything
event = Cloudevents.from_map!(%{specversion: "1.0",type: "some-type",source: "some-source",id: "1",data: %{"example" => "bar"}})
%Cloudevents.Format.V_1_0.Event{
data: %{"example" => "bar"},
datacontenttype: "application/json",
dataschema: nil,
extensions: %{},
id: "1",
source: "some-source",
specversion: "1.0",
subject: nil,
time: nil,
type: "some-type"
}
when i try to encode it with avro, I get the following
event |> Cloudevents.to_avro
[debug] reading schema `Exampleschema` from the file ./priv/schemas/Exampleschema.avsc
[debug] new schema `Exampleschema` stored with global id `121`
{:error,
%ErlangError{
original: {:"$avro_encode_error", :required_field_missed,
[record: "Exampleschema", field: "example"]}
}}
but the field is there in the data map.
I'm curious though, would you be fine with me making erlavro an optional dependency in addition to updating it? JSON is required, but we (and likely others) use this library without Avro and that would avoid bringing in extra dependencies (and for what it's worth I think we even got a build failure from one of them that we had to work around)
Originally posted by @brooksmtownsend in #5 (comment)
dependency :erlavro is using Rebar 2, which is no longer maintained and no longer works in recent Erlang/OTP versions. Remove the :manager option or set it to :rebar3 instead
I get this warning when using this package
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.