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.
Click to show internal directories.
Click to hide internal directories.