Demo - worker application
Yokai's showroom provides a worker demo application.
Overview
This worker demo application is a simple subscriber to Pub/Sub.
It provides:
- a Yokai application container, with the worker module to offer a subscriber worker using the fxgcppubsub contrib module
- a Pub/Sub emulator container, with preconfigured topic and subscription
- a Pub/Sub emulator UI container, preconfigured to work with the emulator container
- a Jaeger container to collect the application traces
Layout
This demo application is following the recommended project layout:
cmd/
: entry pointsconfigs/
: configuration filesinternal/
:worker/
: workersbootstrap.go
: bootstrapregister.go
: dependencies registration
Makefile
This demo application provides a Makefile
:
make up # start the docker compose stack
make down # stop the docker compose stack
make logs # stream the docker compose stack logs
make fresh # refresh the docker compose stack
make test # run tests
make lint # run linter
Usage
Start the application
To start the application, simply run:
After a short moment, the application will offer:
- http://localhost:8081: application core dashboard
- http://localhost:8680: pub/sub emulator UI
- http://localhost:16686: jaeger UI
Message publication
You can use the Pub/Sub emulator UI to publish a message to the preconfigured topic:
http://localhost:8680/project/demo-project/topic/demo-topic
Message subscription
Check your application logs by running:
You will see the SubscribeWorker subscribed to Pub/Sub in action, logging the received messages.