Documentation
¶
Overview ¶
Package api-events demonstrates the api/events builder: define channels with codec-backed payload types, get typed Decode/Encode helpers, and generate a full AsyncAPI 3.0 spec — all without importing any messaging library.
AsyncAPI 3.0 operations are app-centric:
- Subscribe (action: receive): this app RECEIVES messages on the channel (consumer)
- Publish (action: send): this app SENDS messages on the channel (producer)
- Both: bidirectional — pass both events.Subscribe and events.Publish to one AddChannel call
Security schemes are declared once via AddSecurityScheme and referenced per-channel via Subscribe.Security / Publish.Security. The spec output includes components/securitySchemes and per-operation security requirements.
The same ChannelHandle.Decode and ChannelHandle.Encode helpers work unchanged with MQTT (Paho), AMQP, Kafka, NATS, or any other message broker.
Run with: go run ./examples/api-events
Click to show internal directories.
Click to hide internal directories.