pubsub

command
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Demonstrates nexus's typed pub/sub primitive end-to-end:

  • A package-level Topic[T] declared once, publishable from anywhere.
  • A REST endpoint that publishes to the topic on each request.
  • Two independent subscriptions on the same topic, registered as module options. Each one becomes a worker the dashboard surfaces under "pubsub:<topic>:<subscription>".
  • pubsub.UseInMemory() — zero-broker default, suitable for tests and `nexus dev` runs. Production swaps in pubsub.UseRabbit(...).

Run with: go run ./examples/pubsub Then: curl -X POST localhost:8080/adopt -d '{"petId":"42","ownerId":"7"}' Watch the logs — both subscribers fire for each adoption event.

Jump to

Keyboard shortcuts

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