CloudEvents.jl

Julia SDK for https://github.com/cloudevents/spec
Author oolong-dev
Popularity
0 Stars
Updated Last
1 Year Ago
Started In
January 2022

CloudEvents

This package provides the Julia SDK for CloudEvents.

Basic Usage

Below we provide the most common usages.

using CloudEvents

# Create a CloudEvent manually
data = Dict("message" => "Hello World!")
ce = CloudEvent(data; type="example", source="https://example.com/event-producer")

headers, body = to_http(ce)  # structure mode by default
# headers, body = to_http(ce, :binary)  # or binary mode

# Send CloudEvent
using HTTP

HTTP.post("<your url>", headers, body)

# Receive CloudEvent
using JSON3
HTTP.serve() do req
    ce = from_http(HTTP.headers(req), JSON3.read(req.body))
end

Used By Packages

No packages found.