api-events

command
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 6 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL