Skip to content

What this module does not do

Each of these is a decision rather than a gap, and each is recorded in spec 0001.

It does not touch a transport

No connections, no subscriptions, no publishing. Marshal returns a map[string][]string and a []byte; what carries them is somebody else's problem.

The CloudEvents SDK ships protocol bindings, and they own the connection:

type Protocol struct{ Conn *nats.Conn }

func NewProtocol(url, sendSubject, receiveSubject string, natsOpts []nats.Option, ...)
func NewProtocolFromConn(conn *nats.Conn, sendSubject, receiveSubject string, ...)

NewProtocol dials. Even NewProtocolFromConn takes the raw connection and subscribes itself.

Adopting those would mean go/nats stops applying to CloudEvents traffic: no bounded subscriptions, no shed reporting, no controls lifecycle, no health probes. Two modules doing one job with different answers, and the safer one bypassed by the newer one.

TestNoTransportIsImported enforces the absence, because a convenience helper taking a nats.Header would look like an improvement in review.

It does not implement structured mode

Structured mode puts the whole envelope in the body as JSON. That hides the attributes from anything routing on them, which is most of what the attributes are for.

It is additive later — the two modes are distinguished by content-type — so nothing written today becomes wrong if a consumer needs it.

It does not resolve a dataschema

The attribute is carried as an opaque, absolute URI and never dereferenced or validated against. That is go/schema's job, and keeping it out is what lets a service use CloudEvents with no registry at all.

The two modules are coupled by the URN grammar and by nothing else.

It does not use the SDK's Event type

Ours is a struct with eight fields, a map and a byte slice. See Why the specification and not the SDK.

Not decided yet

Whether the estate wants a correlation or causation attribute. Deferred by agreement with scoutdm: adding one later is easy and removing one is not, and neither of us can yet name the query it would answer.